From 7a4118bc5bbffb252b1b02b84f6ef1425455601c Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 6 Aug 2021 17:32:37 -0700 Subject: [PATCH] MediaFormat: Add more audio MIME types Add audio MIME types that have corresponding android.media.AudioFormat.ENCODING_* constants. For the types related to MPEG4 audio use the convention described in RFC 6381 where various codecs are specified using the Audio Object Type Identifier from the ISO/IEC 14496-3 standard and its amendments. For the types related to MPEG-H audio use the identifiers from the ISO/IEC 23008-3 standard. Bug: 188932434 Test: m Change-Id: I411e31e123873f7ed8e952f2baa3f96b5166db5f --- core/api/current.txt | 16 ++++++ media/java/android/media/MediaFormat.java | 61 +++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index e4e5a1acc420e..dc62931f0d9db 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -22630,16 +22630,32 @@ package android.media { field public static final String KEY_VIDEO_QP_P_MIN = "video-qp-p-min"; field public static final String KEY_WIDTH = "width"; field public static final String MIMETYPE_AUDIO_AAC = "audio/mp4a-latm"; + field public static final String MIMETYPE_AUDIO_AAC_ELD = "audio/mp4a.40.39"; + field public static final String MIMETYPE_AUDIO_AAC_HE_V1 = "audio/mp4a.40.05"; + field public static final String MIMETYPE_AUDIO_AAC_HE_V2 = "audio/mp4a.40.29"; + field public static final String MIMETYPE_AUDIO_AAC_LC = "audio/mp4a.40.02"; + field public static final String MIMETYPE_AUDIO_AAC_XHE = "audio/mp4a.40.42"; field public static final String MIMETYPE_AUDIO_AC3 = "audio/ac3"; field public static final String MIMETYPE_AUDIO_AC4 = "audio/ac4"; field public static final String MIMETYPE_AUDIO_AMR_NB = "audio/3gpp"; field public static final String MIMETYPE_AUDIO_AMR_WB = "audio/amr-wb"; + field public static final String MIMETYPE_AUDIO_DOLBY_MAT = "audio/vnd.dolby.mat"; + field public static final String MIMETYPE_AUDIO_DOLBY_TRUEHD = "audio/vnd.dolby.mlp"; + field public static final String MIMETYPE_AUDIO_DRA = "audio/vnd.dra"; + field public static final String MIMETYPE_AUDIO_DTS = "audio/vnd.dts"; + field public static final String MIMETYPE_AUDIO_DTS_HD = "audio/vnd.dts.hd"; + field public static final String MIMETYPE_AUDIO_DTS_UHD = "audio/vnd.dts.uhd"; field public static final String MIMETYPE_AUDIO_EAC3 = "audio/eac3"; field public static final String MIMETYPE_AUDIO_EAC3_JOC = "audio/eac3-joc"; field public static final String MIMETYPE_AUDIO_FLAC = "audio/flac"; field public static final String MIMETYPE_AUDIO_G711_ALAW = "audio/g711-alaw"; field public static final String MIMETYPE_AUDIO_G711_MLAW = "audio/g711-mlaw"; + field public static final String MIMETYPE_AUDIO_IEC61937 = "audio/x-iec61937"; field public static final String MIMETYPE_AUDIO_MPEG = "audio/mpeg"; + field public static final String MIMETYPE_AUDIO_MPEGH_BL_L3 = "audio/mhm1.03"; + field public static final String MIMETYPE_AUDIO_MPEGH_BL_L4 = "audio/mhm1.04"; + field public static final String MIMETYPE_AUDIO_MPEGH_LC_L3 = "audio/mhm1.0d"; + field public static final String MIMETYPE_AUDIO_MPEGH_LC_L4 = "audio/mhm1.0e"; field public static final String MIMETYPE_AUDIO_MPEGH_MHA1 = "audio/mha1"; field public static final String MIMETYPE_AUDIO_MPEGH_MHM1 = "audio/mhm1"; field public static final String MIMETYPE_AUDIO_MSGSM = "audio/gsm"; diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java index 9bf0db52f66d7..16543b0d41422 100644 --- a/media/java/android/media/MediaFormat.java +++ b/media/java/android/media/MediaFormat.java @@ -174,6 +174,67 @@ 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. */ + public static final String MIMETYPE_AUDIO_DTS = "audio/vnd.dts"; + /** MIME type for DTS HD (up to 7.1 channels) audio stream. */ + public static final String MIMETYPE_AUDIO_DTS_HD = "audio/vnd.dts.hd"; + /** MIME type for DTS UHD (object-based) audio stream. */ + 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"; + /** MIME type for Dolby Metadata-enhanced Audio Transmission (MAT) audio stream. */ + public static final String MIMETYPE_AUDIO_DOLBY_MAT = "audio/vnd.dolby.mat"; + /** MIME type for Dolby TrueHD audio format, based on Meridian Lossless Packing (MLP). */ + public static final String MIMETYPE_AUDIO_DOLBY_TRUEHD = "audio/vnd.dolby.mlp"; + /** + * MIME type for AAC Low Complexity (LC) audio stream. Uses the scheme defined by + * RFC 6381 with OTI of MPEG-4 (40) and AOT of AAC LC (2) from ISO/IEC 14496-3. + */ + public static final String MIMETYPE_AUDIO_AAC_LC = "audio/mp4a.40.02"; + /** + * MIME type for HE-AAC v1 (LC + SBR) audio stream. Uses the scheme defined by + * RFC 6381 with OTI of MPEG-4 (40) and AOT of AAC SBR (5) from ISO/IEC 14496-3. + */ + public static final String MIMETYPE_AUDIO_AAC_HE_V1 = "audio/mp4a.40.05"; + /** + * MIME type for HE-AAC v2 (LC + SBR + PS) audio stream. Uses the scheme defined by + * RFC 6381 with OTI of MPEG-4 (40) and AOT of PS (29) from ISO/IEC 14496-3. + */ + public static final String MIMETYPE_AUDIO_AAC_HE_V2 = "audio/mp4a.40.29"; + /** + * MIME type for AAC Enhanced Low Delay (ELD) audio stream. Uses the scheme defined by + * RFC 6381 with OTI of MPEG-4 (40) and AOT of ELD (39) from ISO/IEC 14496-3. + */ + public static final String MIMETYPE_AUDIO_AAC_ELD = "audio/mp4a.40.39"; + /** + * MIME type for AAC XHE audio stream. Uses the scheme defined by + * RFC 6381 with OTI of MPEG-4 (40) and AOT of USAC (42) from ISO/IEC 14496-3. + */ + public static final String MIMETYPE_AUDIO_AAC_XHE = "audio/mp4a.40.42"; + /** + * MIME type for MPEG-H Baseline (BL) Profile L3 audio stream. Uses the scheme defined by + * RFC 6381 with mpegh3daProfileLevelIndication for main profile/L3 (0x3) from ISO/IEC 23008-3. + */ + public static final String MIMETYPE_AUDIO_MPEGH_BL_L3 = "audio/mhm1.03"; + /** + * MIME type for MPEG-H Baseline (BL) Profile L4 audio stream. Uses the scheme defined by + * RFC 6381 with mpegh3daProfileLevelIndication for main profile/L4 (0x4) from ISO/IEC 23008-3. + */ + public static final String MIMETYPE_AUDIO_MPEGH_BL_L4 = "audio/mhm1.04"; + /** + * MIME type for MPEG-H Low Complexity (LC) L3 audio stream. Uses the scheme defined by + * RFC 6381 with mpegh3daProfileLevelIndication for LC profile/L3 (0xD) from ISO/IEC 23008-3. + */ + public static final String MIMETYPE_AUDIO_MPEGH_LC_L3 = "audio/mhm1.0d"; + /** + * MIME type for MPEG-H Low Complexity (LC) L4 audio stream. Uses the scheme defined by + * RFC 6381 with mpegh3daProfileLevelIndication for LC profile/L4 (0xE) from ISO/IEC 23008-3. + */ + public static final String MIMETYPE_AUDIO_MPEGH_LC_L4 = "audio/mhm1.0e"; + /** + * MIME type for the IEC61937 audio stream encapsulation. This type isn't defined by IANA. + */ + public static final String MIMETYPE_AUDIO_IEC61937 = "audio/x-iec61937"; /** * MIME type for HEIF still image data encoded in HEVC.