1 /* 2 * Copyright 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.media.tv.tuner.filter; 18 19 import android.annotation.SystemApi; 20 21 /** 22 * Meta data from AD (Audio Descriptor) according to ETSI TS 101 154 V2.1.1. 23 * 24 * @hide 25 */ 26 @SystemApi 27 public class AudioDescriptor { 28 private final byte mAdFade; 29 private final byte mAdPan; 30 private final char mVersionTextTag; 31 private final byte mAdGainCenter; 32 private final byte mAdGainFront; 33 private final byte mAdGainSurround; 34 35 // This constructor is used by JNI code only AudioDescriptor(byte adFade, byte adPan, char versionTextTag, byte adGainCenter, byte adGainFront, byte adGainSurround)36 private AudioDescriptor(byte adFade, byte adPan, char versionTextTag, byte adGainCenter, 37 byte adGainFront, byte adGainSurround) { 38 mAdFade = adFade; 39 mAdPan = adPan; 40 mVersionTextTag = versionTextTag; 41 mAdGainCenter = adGainCenter; 42 mAdGainFront = adGainFront; 43 mAdGainSurround = adGainSurround; 44 } 45 46 /** 47 * Gets AD fade byte. 48 * 49 * <p>Takes values between 0x00 (representing no fade of the main programme sound) and 0xFF 50 * (representing a full fade). Over the range 0x00 to 0xFE one lsb represents a step in 51 * attenuation of the programme sound of 0.3 dB giving a range of 76.2 dB. The fade value of 52 * 0xFF represents no programme sound at all (i.e. mute). 53 */ getAdFade()54 public byte getAdFade() { 55 return mAdFade; 56 } 57 58 /** 59 * Gets AD pan byte. 60 * 61 * <p>Takes values between 0x00 representing a central forward presentation of the audio 62 * description and 0xFF, each increment representing a 360/256 degree step clockwise looking 63 * down on the listener (i.e. just over 1.4 degrees). 64 */ getAdPan()65 public byte getAdPan() { 66 return mAdPan; 67 } 68 69 /** 70 * Gets AD version tag. A single ASCII character version indicates the version. 71 * 72 * <p>A single ASCII character version designator (here "1" indicates revision 1). 73 */ getAdVersionTextTag()74 public char getAdVersionTextTag() { 75 return mVersionTextTag; 76 } 77 78 /** 79 * Gets AD gain byte center in dB. 80 * 81 * <p>Represents a signed value in dB. Takes values between 0x7F (representing +76.2 dB boost of 82 * the main programme center) and 0x80 (representing a full fade). Over the range 0x00 to 0x7F 83 * one lsb represents a step in boost of the programme center of 0.6 dB giving a maximum boost 84 * of +76.2 dB. Over the range 0x81 to 0x00 one lsb represents a step in attenuation of the 85 * programme center of 0.6 dB giving a maximum attenuation of -76.2 dB. The gain value of 0x80 86 * represents no main center level at all (i.e. mute). 87 */ getAdGainCenter()88 public byte getAdGainCenter() { 89 return mAdGainCenter; 90 } 91 92 /** 93 * Gets AD gain byte front in dB. 94 * 95 * <p>Same as {@link #getAdGainCenter()}, but applied to left and right front channel. 96 */ getAdGainFront()97 public byte getAdGainFront() { 98 return mAdGainFront; 99 } 100 101 /** 102 * Gets AD gain byte surround in dB. 103 * 104 * <p>Same as {@link #getAdGainCenter()}, but applied to all surround channels 105 */ getAdGainSurround()106 public byte getAdGainSurround() { 107 return mAdGainSurround; 108 } 109 } 110