AudioFormat: add ENCODING_IEC61937

Allows applications to wrap compressed audio in a PCM
stream and pass through directly to HDMI output.

Bug: 24541671
Bug: 20891646
Bug: 26373761
Change-Id: I67a25672a3b5066b5747380d013c26e60c14c272
Signed-off-by: Phil Burk <philburk@google.com>
This commit is contained in:
Phil Burk
2016-01-27 11:45:06 -08:00
parent a1c7bc7550
commit 4ddbc0e377
4 changed files with 38 additions and 1 deletions

View File

@@ -19320,6 +19320,7 @@ package android.media {
field public static final int ENCODING_DTS = 7; // 0x7
field public static final int ENCODING_DTS_HD = 8; // 0x8
field public static final int ENCODING_E_AC3 = 6; // 0x6
field public static final int ENCODING_IEC61937 = 13; // 0xd
field public static final int ENCODING_INVALID = 0; // 0x0
field public static final int ENCODING_PCM_16BIT = 2; // 0x2
field public static final int ENCODING_PCM_8BIT = 3; // 0x3

View File

@@ -20660,6 +20660,7 @@ package android.media {
field public static final int ENCODING_DTS = 7; // 0x7
field public static final int ENCODING_DTS_HD = 8; // 0x8
field public static final int ENCODING_E_AC3 = 6; // 0x6
field public static final int ENCODING_IEC61937 = 13; // 0xd
field public static final int ENCODING_INVALID = 0; // 0x0
field public static final int ENCODING_PCM_16BIT = 2; // 0x2
field public static final int ENCODING_PCM_8BIT = 3; // 0x3

View File

@@ -19328,6 +19328,7 @@ package android.media {
field public static final int ENCODING_DTS = 7; // 0x7
field public static final int ENCODING_DTS_HD = 8; // 0x8
field public static final int ENCODING_E_AC3 = 6; // 0x6
field public static final int ENCODING_IEC61937 = 13; // 0xd
field public static final int ENCODING_INVALID = 0; // 0x0
field public static final int ENCODING_PCM_16BIT = 2; // 0x2
field public static final int ENCODING_PCM_8BIT = 3; // 0x3

View File

@@ -251,6 +251,10 @@ public class AudioFormat {
* @hide
* */
public static final int ENCODING_AAC_HE_V2 = 12;
/** Audio data format: compressed audio wrapped in PCM for HDMI
* or S/PDIF passthrough.
*/
public static final int ENCODING_IEC61937 = 13;
/** Invalid audio channel configuration */
/** @deprecated Use {@link #CHANNEL_INVALID} instead. */
@@ -418,6 +422,7 @@ public class AudioFormat {
case ENCODING_PCM_8BIT:
return 1;
case ENCODING_PCM_16BIT:
case ENCODING_IEC61937:
case ENCODING_DEFAULT:
return 2;
case ENCODING_PCM_FLOAT:
@@ -443,6 +448,7 @@ public class AudioFormat {
case ENCODING_AAC_LC:
case ENCODING_AAC_HE_V1:
case ENCODING_AAC_HE_V2:
case ENCODING_IEC61937:
return true;
default:
return false;
@@ -460,6 +466,7 @@ public class AudioFormat {
case ENCODING_E_AC3:
case ENCODING_DTS:
case ENCODING_DTS_HD:
case ENCODING_IEC61937:
return true;
default:
return false;
@@ -483,6 +490,7 @@ public class AudioFormat {
case ENCODING_AAC_LC:
case ENCODING_AAC_HE_V1:
case ENCODING_AAC_HE_V2:
case ENCODING_IEC61937: // wrapped in PCM but compressed
return false;
case ENCODING_INVALID:
default:
@@ -490,6 +498,30 @@ public class AudioFormat {
}
}
/** @hide */
public static boolean isEncodingLinearFrames(int audioFormat)
{
switch (audioFormat) {
case ENCODING_PCM_8BIT:
case ENCODING_PCM_16BIT:
case ENCODING_PCM_FLOAT:
case ENCODING_IEC61937: // same size as stereo PCM
case ENCODING_DEFAULT:
return true;
case ENCODING_AC3:
case ENCODING_E_AC3:
case ENCODING_DTS:
case ENCODING_DTS_HD:
case ENCODING_MP3:
case ENCODING_AAC_LC:
case ENCODING_AAC_HE_V1:
case ENCODING_AAC_HE_V2:
return false;
case ENCODING_INVALID:
default:
throw new IllegalArgumentException("Bad audio format " + audioFormat);
}
}
/**
* Returns an array of public encoding values extracted from an array of
* encoding values.
@@ -715,6 +747,7 @@ public class AudioFormat {
case ENCODING_E_AC3:
case ENCODING_DTS:
case ENCODING_DTS_HD:
case ENCODING_IEC61937:
mEncoding = encoding;
break;
case ENCODING_INVALID:
@@ -859,7 +892,8 @@ public class AudioFormat {
ENCODING_AC3,
ENCODING_E_AC3,
ENCODING_DTS,
ENCODING_DTS_HD
ENCODING_DTS_HD,
ENCODING_IEC61937
})
@Retention(RetentionPolicy.SOURCE)
public @interface Encoding {}