From 716cbceaa4705cb4de8be1b09a4e1d7cbc5d991d Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 8 Jul 2021 11:07:56 +0100 Subject: [PATCH 1/4] Updates to mp4 atom extractor/parser for dtsx support. --- .../java/com/google/android/exoplayer2/extractor/mp4/Atom.java | 3 +++ .../google/android/exoplayer2/extractor/mp4/AtomParsers.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Atom.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Atom.java index 1cb554151f1..ffdab2f6e8c 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Atom.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/Atom.java @@ -162,6 +162,9 @@ @SuppressWarnings("ConstantCaseForConstants") public static final int TYPE_dtse = 0x64747365; + @SuppressWarnings("ConstantCaseForConstants") + public static final int TYPE_dtsx = 0x64747378; + @SuppressWarnings("ConstantCaseForConstants") public static final int TYPE_ddts = 0x64647473; diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java index 5da35527a5e..7156be96af6 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java @@ -964,6 +964,7 @@ private static StsdData parseStsd( || childAtomType == Atom.TYPE_dtse || childAtomType == Atom.TYPE_dtsh || childAtomType == Atom.TYPE_dtsl + || childAtomType == Atom.TYPE_dtsx || childAtomType == Atom.TYPE_samr || childAtomType == Atom.TYPE_sawb || childAtomType == Atom.TYPE_lpcm @@ -1368,6 +1369,8 @@ private static void parseAudioSampleEntry( mimeType = MimeTypes.AUDIO_DTS_HD; } else if (atomType == Atom.TYPE_dtse) { mimeType = MimeTypes.AUDIO_DTS_EXPRESS; + } else if (atomType == Atom.TYPE_dtsx) { + mimeType = MimeTypes.AUDIO_DTS_X; } else if (atomType == Atom.TYPE_samr) { mimeType = MimeTypes.AUDIO_AMR_NB; } else if (atomType == Atom.TYPE_sawb) { From dffcf258ee6b341becee854dcdd7d45d4039e863 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 8 Jul 2021 11:11:26 +0100 Subject: [PATCH 2/4] Updated mimetypes to support DTSX and to correct assign dtse to DTS Express --- .../java/com/google/android/exoplayer2/util/MimeTypes.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java b/library/common/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java index 066cdc9ea44..b4de7e15ce1 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java @@ -76,6 +76,7 @@ public final class MimeTypes { public static final String AUDIO_DTS = BASE_TYPE_AUDIO + "/vnd.dts"; public static final String AUDIO_DTS_HD = BASE_TYPE_AUDIO + "/vnd.dts.hd"; public static final String AUDIO_DTS_EXPRESS = BASE_TYPE_AUDIO + "/vnd.dts.hd;profile=lbr"; + public static final String AUDIO_DTS_X = BASE_TYPE_AUDIO + "/vnd.dts.uhd"; public static final String AUDIO_VORBIS = BASE_TYPE_AUDIO + "/vorbis"; public static final String AUDIO_OPUS = BASE_TYPE_AUDIO + "/opus"; public static final String AUDIO_AMR = BASE_TYPE_AUDIO + "/amr"; @@ -380,8 +381,12 @@ public static String getMediaMimeType(@Nullable String codec) { return MimeTypes.AUDIO_E_AC3_JOC; } else if (codec.startsWith("ac-4") || codec.startsWith("dac4")) { return MimeTypes.AUDIO_AC4; - } else if (codec.startsWith("dtsc") || codec.startsWith("dtse")) { + } else if (codec.startsWith("dtsc")) { return MimeTypes.AUDIO_DTS; + } else if (codec.startsWith("dtse")) { + return MimeTypes.AUDIO_DTS_EXPRESS; + } else if (codec.startsWith("dtsx")) { + return MimeTypes.AUDIO_DTS_X; } else if (codec.startsWith("dtsh") || codec.startsWith("dtsl")) { return MimeTypes.AUDIO_DTS_HD; } else if (codec.startsWith("opus")) { From 83d2c39a363ab76bc7415f30b47aa7aff4e55a23 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 8 Jul 2021 11:17:24 +0100 Subject: [PATCH 3/4] Updated MediaCodecInfo with correct channel adjustments for DTS codecs --- .../google/android/exoplayer2/mediacodec/MediaCodecInfo.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java index 6d4c11603ae..6c933cef8ed 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java @@ -624,6 +624,10 @@ private static int adjustMaxInputChannelCount(String name, String mimeType, int || MimeTypes.AUDIO_FLAC.equals(mimeType) || MimeTypes.AUDIO_ALAW.equals(mimeType) || MimeTypes.AUDIO_MLAW.equals(mimeType) + || MimeTypes.AUDIO_DTS.equals(mimeType) + || MimeTypes.AUDIO_DTS_HD.equals(mimeType) + || MimeTypes.AUDIO_DTS_EXPRESS.equals(mimeType) + || MimeTypes.AUDIO_DTS_X.equals(mimeType) || MimeTypes.AUDIO_MSGSM.equals(mimeType)) { // Platform code should have set a default. return maxChannelCount; From 3003fc91fc8c65d7caf6bfefcd8e27c301c0c1e3 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 22 Jul 2021 17:17:51 +0100 Subject: [PATCH 4/4] Reverted MediaCodecinfo adjustMaxInputChannelCount to ignore the 1 channel response --- .../google/android/exoplayer2/mediacodec/MediaCodecInfo.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java index 6c933cef8ed..6d4c11603ae 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java @@ -624,10 +624,6 @@ private static int adjustMaxInputChannelCount(String name, String mimeType, int || MimeTypes.AUDIO_FLAC.equals(mimeType) || MimeTypes.AUDIO_ALAW.equals(mimeType) || MimeTypes.AUDIO_MLAW.equals(mimeType) - || MimeTypes.AUDIO_DTS.equals(mimeType) - || MimeTypes.AUDIO_DTS_HD.equals(mimeType) - || MimeTypes.AUDIO_DTS_EXPRESS.equals(mimeType) - || MimeTypes.AUDIO_DTS_X.equals(mimeType) || MimeTypes.AUDIO_MSGSM.equals(mimeType)) { // Platform code should have set a default. return maxChannelCount;