diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java
index 07d1f7542b263..0bfeaed36282f 100644
--- a/media/java/android/media/MediaCodecInfo.java
+++ b/media/java/android/media/MediaCodecInfo.java
@@ -541,6 +541,72 @@ public final class MediaCodecInfo {
* frame rate}. Use
* format.setString(MediaFormat.KEY_FRAME_RATE, null)
* to clear any existing frame rate setting in the format.
+ *
+ * + * The following table summarizes the format keys considered by this method. + * + *
| OS Version(s) | + *{@code MediaFormat} keys considered for + * | ||
|---|---|---|---|
| Audio Codecs | + *Video Codecs | + *Encoders | + *|
| {@link android.os.Build.VERSION_CODES#LOLLIPOP} + * | {@link MediaFormat#KEY_MIME}*, + * {@link MediaFormat#KEY_SAMPLE_RATE}, + * {@link MediaFormat#KEY_CHANNEL_COUNT}, |
+ * {@link MediaFormat#KEY_MIME}*, + * {@link CodecCapabilities#FEATURE_AdaptivePlayback}D, + * {@link CodecCapabilities#FEATURE_SecurePlayback}D, + * {@link CodecCapabilities#FEATURE_TunneledPlayback}D, + * {@link MediaFormat#KEY_WIDTH}, + * {@link MediaFormat#KEY_HEIGHT}, + * no {@code KEY_FRAME_RATE} |
+ * {@link MediaFormat#KEY_BITRATE_MODE}, + * {@link MediaFormat#KEY_PROFILE} + * (and/or {@link MediaFormat#KEY_AAC_PROFILE}~), + * + * {@link MediaFormat#KEY_COMPLEXITY} + * (and/or {@link MediaFormat#KEY_FLAC_COMPRESSION_LEVEL}~) |
+ *
| {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1} + * | as above, plus + * {@link MediaFormat#KEY_FRAME_RATE} |
+ * ||
| {@link android.os.Build.VERSION_CODES#M} + * | |||
| {@link android.os.Build.VERSION_CODES#N} + * | as above, plus + * {@link MediaFormat#KEY_PROFILE}, + * + * {@link MediaFormat#KEY_BIT_RATE} |
+ * as above, plus + * {@link MediaFormat#KEY_PROFILE}, + * {@link MediaFormat#KEY_LEVEL}+, + * + * {@link MediaFormat#KEY_BIT_RATE}, + * {@link CodecCapabilities#FEATURE_IntraRefresh}E |
+ * |
|
+ * Notes: |
+ * |||
format.setString(MediaFormat.KEY_FRAME_RATE, null)
* to clear any existing frame rate setting in the format.
*
+ * @see MediaCodecList.CodecCapabilities.isFormatSupported for format keys
+ * considered per android versions when evaluating suitable codecs.
+ *
* @param format A decoder media format with optional feature directives.
* @throws IllegalArgumentException if format is not a valid media format.
* @throws NullPointerException if format is null.
@@ -222,6 +225,9 @@ final public class MediaCodecList {
* format.setString(MediaFormat.KEY_FRAME_RATE, null)
* to clear any existing frame rate setting in the format.
*
+ * @see MediaCodecList.CodecCapabilities.isFormatSupported for format keys
+ * considered per android versions when evaluating suitable codecs.
+ *
* @param format An encoder media format with optional feature directives.
* @throws IllegalArgumentException if format is not a valid media format.
* @throws NullPointerException if format is null.
diff --git a/media/java/android/media/MediaExtractor.java b/media/java/android/media/MediaExtractor.java
index 24a400e481899..6f5199b6959c9 100644
--- a/media/java/android/media/MediaExtractor.java
+++ b/media/java/android/media/MediaExtractor.java
@@ -333,7 +333,113 @@ final public class MediaExtractor {
/**
* Get the track format at the specified index.
+ *
* More detail on the representation can be found at {@link android.media.MediaCodec}
+ * + * The following table summarizes support for format keys across android releases: + * + *
| OS Version(s) | + *{@code MediaFormat} keys used for + * | ||
|---|---|---|---|
| All Tracks | + *Audio Tracks | + *Video Tracks | + *|
| {@link android.os.Build.VERSION_CODES#JELLY_BEAN} | + *{@link MediaFormat#KEY_MIME}, + * {@link MediaFormat#KEY_DURATION}, + * {@link MediaFormat#KEY_MAX_INPUT_SIZE} |
+ * {@link MediaFormat#KEY_SAMPLE_RATE}, + * {@link MediaFormat#KEY_CHANNEL_COUNT}, + * {@link MediaFormat#KEY_CHANNEL_MASK}, + * gapless playback information.mp3, .mp4, + * {@link MediaFormat#KEY_IS_ADTS}AAC if streaming, + * codec-specific dataAAC, Vorbis |
+ * {@link MediaFormat#KEY_WIDTH}, + * {@link MediaFormat#KEY_HEIGHT}, + * codec-specific dataAVC, MPEG4 |
+ *
| {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR1} | + *|||
| {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2} | + *as above, plus + * Pixel aspect ratio informationAVC, * |
+ * ||
| {@link android.os.Build.VERSION_CODES#KITKAT} | + *|||
| {@link android.os.Build.VERSION_CODES#KITKAT_WATCH} | + *|||
| {@link android.os.Build.VERSION_CODES#LOLLIPOP} | + *as above, plus + * {@link MediaFormat#KEY_BIT_RATE}AAC, + * codec-specific dataOpus |
+ * as above, plus + * {@link MediaFormat#KEY_ROTATION}.mp4, + * {@link MediaFormat#KEY_BIT_RATE}MPEG4, + * codec-specific dataHEVC |
+ * |
| {@link android.os.Build.VERSION_CODES#LOLLIPOP_MR1} | + *|||
| {@link android.os.Build.VERSION_CODES#M} | + *as above, plus + * gapless playback informationOpus |
+ * as above, plus + * {@link MediaFormat#KEY_FRAME_RATE} (integer) |
+ * |
| {@link android.os.Build.VERSION_CODES#N} | + *as above, plus + * {@link MediaFormat#KEY_TRACK_ID}, + * + * {@link MediaFormat#KEY_BIT_RATE}#, .mp4 |
+ * as above, plus + * {@link MediaFormat#KEY_PCM_ENCODING}, + * {@link MediaFormat#KEY_PROFILE}AAC |
+ * as above, plus + * {@link MediaFormat#KEY_HDR_STATIC_INFO}#, .webm, + * {@link MediaFormat#KEY_COLOR_STANDARD}#, + * {@link MediaFormat#KEY_COLOR_TRANSFER}#, + * {@link MediaFormat#KEY_COLOR_RANGE}#, + * {@link MediaFormat#KEY_PROFILE}MPEG2, H.263, MPEG4, AVC, HEVC, VP9, + * {@link MediaFormat#KEY_LEVEL}H.263, MPEG4, AVC, HEVC, VP9, + * codec-specific dataVP9 |
+ *
|
+ * Notes: |
+ * |||
|
+ * Note that that level information contained in the container many times + * does not match the level of the actual bitstream. You may want to clear the level using + * {@code MediaFormat.setString(KEY_LEVEL, null)} before using the track format to find a + * decoder that can play back a particular track. + * |
+ * |||
|
+ * *Pixel (sample) aspect ratio is returned in the following + * keys. The display width can be calculated for example as: + * + * display-width = display-height * crop-width / crop-height * sar-width / sar-height + * |
+ * |||
| Format Key | Value Type | Description | + *|
| {@code "sar-width"} | Integer | Pixel aspect ratio width | + *|
| {@code "sar-height"} | Integer | Pixel aspect ratio height | + *|