Merge "Add AudioCapabilities for DTS audio formats" am: b84433bd71
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1996350 Change-Id: I22e16c0ad3cacb049eca5a4735afc20de72143a7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -981,8 +981,20 @@ public final class MediaCodecInfo {
|
||||
continue;
|
||||
}
|
||||
|
||||
// AAC does not use levels
|
||||
if (level == null || mMime.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_AAC)) {
|
||||
// No specific level requested
|
||||
if (level == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// AAC doesn't use levels
|
||||
if (mMime.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_AAC)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// DTS doesn't use levels
|
||||
if (mMime.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_DTS)
|
||||
|| mMime.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_DTS_HD)
|
||||
|| mMime.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_DTS_UHD)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1410,6 +1422,7 @@ public final class MediaCodecInfo {
|
||||
int[] sampleRates = null;
|
||||
Range<Integer> sampleRateRange = null, bitRates = null;
|
||||
int maxChannels = MAX_INPUT_CHANNEL_COUNT;
|
||||
CodecProfileLevel[] profileLevels = mParent.profileLevels;
|
||||
String mime = mParent.getMimeType();
|
||||
|
||||
if (mime.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_MPEG)) {
|
||||
@@ -1473,6 +1486,53 @@ public final class MediaCodecInfo {
|
||||
sampleRates = new int[] { 44100, 48000, 96000, 192000 };
|
||||
bitRates = Range.create(16000, 2688000);
|
||||
maxChannels = 24;
|
||||
} else if (mime.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_DTS)) {
|
||||
sampleRates = new int[] { 44100, 48000 };
|
||||
bitRates = Range.create(96000, 1524000);
|
||||
maxChannels = 6;
|
||||
} else if (mime.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_DTS_HD)) {
|
||||
for (CodecProfileLevel profileLevel: profileLevels) {
|
||||
switch (profileLevel.profile) {
|
||||
case CodecProfileLevel.DTS_HDProfileLBR:
|
||||
sampleRates = new int[]{ 22050, 24000, 44100, 48000 };
|
||||
bitRates = Range.create(32000, 768000);
|
||||
break;
|
||||
case CodecProfileLevel.DTS_HDProfileHRA:
|
||||
case CodecProfileLevel.DTS_HDProfileMA:
|
||||
sampleRates = new int[]{ 44100, 48000, 88200, 96000, 176400, 192000 };
|
||||
bitRates = Range.create(96000, 24500000);
|
||||
break;
|
||||
default:
|
||||
Log.w(TAG, "Unrecognized profile "
|
||||
+ profileLevel.profile + " for " + mime);
|
||||
mParent.mError |= ERROR_UNRECOGNIZED;
|
||||
sampleRates = new int[]{ 44100, 48000, 88200, 96000, 176400, 192000 };
|
||||
bitRates = Range.create(96000, 24500000);
|
||||
}
|
||||
}
|
||||
maxChannels = 8;
|
||||
} else if (mime.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_DTS_UHD)) {
|
||||
for (CodecProfileLevel profileLevel: profileLevels) {
|
||||
switch (profileLevel.profile) {
|
||||
case CodecProfileLevel.DTS_UHDProfileP2:
|
||||
sampleRates = new int[]{ 48000 };
|
||||
bitRates = Range.create(96000, 768000);
|
||||
maxChannels = 10;
|
||||
break;
|
||||
case CodecProfileLevel.DTS_UHDProfileP1:
|
||||
sampleRates = new int[]{ 44100, 48000, 88200, 96000, 176400, 192000 };
|
||||
bitRates = Range.create(96000, 24500000);
|
||||
maxChannels = 32;
|
||||
break;
|
||||
default:
|
||||
Log.w(TAG, "Unrecognized profile "
|
||||
+ profileLevel.profile + " for " + mime);
|
||||
mParent.mError |= ERROR_UNRECOGNIZED;
|
||||
sampleRates = new int[]{ 44100, 48000, 88200, 96000, 176400, 192000 };
|
||||
bitRates = Range.create(96000, 24500000);
|
||||
maxChannels = 32;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.w(TAG, "Unsupported mime " + mime);
|
||||
mParent.mError |= ERROR_UNSUPPORTED;
|
||||
|
||||
@@ -174,11 +174,20 @@ public final class MediaFormat {
|
||||
public static final String MIMETYPE_AUDIO_MPEGH_MHA1 = "audio/mha1";
|
||||
/** MIME type for MPEG-H Audio single stream, encapsulated in MHAS */
|
||||
public static final String MIMETYPE_AUDIO_MPEGH_MHM1 = "audio/mhm1";
|
||||
/** MIME type for DTS (up to 5.1 channels) audio stream. */
|
||||
/** MIME type for DTS Digital Surround (up to 5.1 channels) audio stream, aka DTS-CA. */
|
||||
public static final String MIMETYPE_AUDIO_DTS = "audio/vnd.dts";
|
||||
/** MIME type for DTS HD (up to 7.1 channels) audio stream. */
|
||||
/**
|
||||
* MIME type for DTS HD (up to 7.1 channels) audio stream.
|
||||
* With codec profile DTS_HDProfileHRA represents DTS HD High Resolution Audio.
|
||||
* With codec profile DTS_HDProfileMA represents DTS HD Master Audio.
|
||||
* With codec profile DTS_HDProfileLBR represents DTS Express.
|
||||
*/
|
||||
public static final String MIMETYPE_AUDIO_DTS_HD = "audio/vnd.dts.hd";
|
||||
/** MIME type for DTS UHD (object-based) audio stream. */
|
||||
/**
|
||||
* MIME type for DTS UHD (object-based) audio stream, aka DTS:X.
|
||||
* With codec profile DTS_UHDProfileP1 represents DTS-UHD P1.
|
||||
* With codec profile DTS_UHDProfileP2 represents DTS-UHD P2.
|
||||
*/
|
||||
public static final String MIMETYPE_AUDIO_DTS_UHD = "audio/vnd.dts.uhd";
|
||||
/** MIME type for Dynamic Resolution Adaptation (DRA) audio stream. */
|
||||
public static final String MIMETYPE_AUDIO_DRA = "audio/vnd.dra";
|
||||
|
||||
Reference in New Issue
Block a user