diff options
| author | 2018-11-29 11:40:18 -0800 | |
|---|---|---|
| committer | 2018-12-06 10:42:24 -0800 | |
| commit | 6e4fa27afdde5336a98a287248b75301e8a62877 (patch) | |
| tree | 79554a40fdd0558e58d59ec489cc054342fab52b | |
| parent | 797aa66e71eec636b470e763e970d46c1f2300ef (diff) | |
Add MediaCodec constants for HDR10+
bug: 118507186
Change-Id: I742b93ba4475fb82b7a9f9aaf237f43cfa66a915
| -rw-r--r-- | api/current.txt | 5 | ||||
| -rw-r--r-- | media/java/android/media/MediaCodec.java | 58 | ||||
| -rw-r--r-- | media/java/android/media/MediaCodecInfo.java | 7 | ||||
| -rw-r--r-- | media/java/android/media/MediaFormat.java | 21 |
4 files changed, 90 insertions, 1 deletions
diff --git a/api/current.txt b/api/current.txt index 2eb90d50c1c8..cbf16b843204 100644 --- a/api/current.txt +++ b/api/current.txt @@ -23883,6 +23883,7 @@ package android.media { field public static final deprecated int INFO_OUTPUT_BUFFERS_CHANGED = -3; // 0xfffffffd field public static final int INFO_OUTPUT_FORMAT_CHANGED = -2; // 0xfffffffe field public static final int INFO_TRY_AGAIN_LATER = -1; // 0xffffffff + field public static final java.lang.String PARAMETER_KEY_HDR10_PLUS_INFO = "hdr10-plus-info"; field public static final java.lang.String PARAMETER_KEY_REQUEST_SYNC_FRAME = "request-sync"; field public static final java.lang.String PARAMETER_KEY_SUSPEND = "drop-input-frames"; field public static final java.lang.String PARAMETER_KEY_VIDEO_BITRATE = "video-bitrate"; @@ -24156,6 +24157,7 @@ package android.media { field public static final int HEVCProfileMain = 1; // 0x1 field public static final int HEVCProfileMain10 = 2; // 0x2 field public static final int HEVCProfileMain10HDR10 = 4096; // 0x1000 + field public static final int HEVCProfileMain10HDR10Plus = 8192; // 0x2000 field public static final int HEVCProfileMainStill = 4; // 0x4 field public static final int MPEG2LevelH14 = 2; // 0x2 field public static final int MPEG2LevelHL = 3; // 0x3 @@ -24217,8 +24219,10 @@ package android.media { field public static final int VP9Profile1 = 2; // 0x2 field public static final int VP9Profile2 = 4; // 0x4 field public static final int VP9Profile2HDR = 4096; // 0x1000 + field public static final int VP9Profile2HDR10Plus = 16384; // 0x4000 field public static final int VP9Profile3 = 8; // 0x8 field public static final int VP9Profile3HDR = 8192; // 0x2000 + field public static final int VP9Profile3HDR10Plus = 32768; // 0x8000 field public int level; field public int profile; } @@ -24617,6 +24621,7 @@ package android.media { field public static final java.lang.String KEY_FRAME_RATE = "frame-rate"; field public static final java.lang.String KEY_GRID_COLUMNS = "grid-cols"; field public static final java.lang.String KEY_GRID_ROWS = "grid-rows"; + field public static final java.lang.String KEY_HDR10_PLUS_INFO = "hdr10-plus-info"; field public static final java.lang.String KEY_HDR_STATIC_INFO = "hdr-static-info"; field public static final java.lang.String KEY_HEIGHT = "height"; field public static final java.lang.String KEY_INTRA_REFRESH_PERIOD = "intra-refresh-period"; diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java index 1d27c03e1dcb..242ae46f4d33 100644 --- a/media/java/android/media/MediaCodec.java +++ b/media/java/android/media/MediaCodec.java @@ -3308,6 +3308,55 @@ final public class MediaCodec { public static final String PARAMETER_KEY_REQUEST_SYNC_FRAME = "request-sync"; /** + * Set the HDR10+ metadata on the next queued input frame. + * + * Provide a byte array of data that's conforming to the + * user_data_registered_itu_t_t35() syntax of SEI message for ST 2094-40. + *<p> + * For decoders: + *<p> + * When a decoder is configured for one of the HDR10+ profiles that uses + * out-of-band metadata (such as {@link + * MediaCodecInfo.CodecProfileLevel#VP9Profile2HDR10Plus} or {@link + * MediaCodecInfo.CodecProfileLevel#VP9Profile3HDR10Plus}), this + * parameter sets the HDR10+ metadata on the next input buffer queued + * to the decoder. A decoder supporting these profiles must propagate + * the metadata to the format of the output buffer corresponding to this + * particular input buffer (under key {@link MediaFormat#KEY_HDR10_PLUS_INFO}). + * The metadata should be applied to that output buffer and the buffers + * following it (in display order), until the next output buffer (in + * display order) upon which an HDR10+ metadata is set. + *<p> + * This parameter shouldn't be set if the decoder is not configured for + * an HDR10+ profile that uses out-of-band metadata. In particular, + * it shouldn't be set for HDR10+ profiles that uses in-band metadata + * where the metadata is embedded in the input buffers, for example + * {@link MediaCodecInfo.CodecProfileLevel#HEVCProfileMain10HDR10Plus}. + *<p> + * For encoders: + *<p> + * When an encoder is configured for one of the HDR10+ profiles and the + * operates in byte buffer input mode (instead of surface input mode), + * this parameter sets the HDR10+ metadata on the next input buffer queued + * to the encoder. For the HDR10+ profiles that uses out-of-band metadata + * (such as {@link MediaCodecInfo.CodecProfileLevel#VP9Profile2HDR10Plus}, + * or {@link MediaCodecInfo.CodecProfileLevel#VP9Profile3HDR10Plus}), + * the metadata must be propagated to the format of the output buffer + * corresponding to this particular input buffer (under key {@link + * MediaFormat#KEY_HDR10_PLUS_INFO}). For the HDR10+ profiles that uses + * in-band metadata (such as {@link + * MediaCodecInfo.CodecProfileLevel#HEVCProfileMain10HDR10Plus}), the + * metadata info must be embedded in the corresponding output buffer itself. + *<p> + * This parameter shouldn't be set if the encoder is not configured for + * an HDR10+ profile, or if it's operating in surface input mode. + *<p> + * + * @see MediaFormat#KEY_HDR10_PLUS_INFO + */ + public static final String PARAMETER_KEY_HDR10_PLUS_INFO = MediaFormat.KEY_HDR10_PLUS_INFO; + + /** * Communicate additional parameter changes to the component instance. * <b>Note:</b> Some of these parameter changes may silently fail to apply. * @@ -3325,7 +3374,14 @@ final public class MediaCodec { int i = 0; for (final String key: params.keySet()) { keys[i] = key; - values[i] = params.get(key); + Object value = params.get(key); + + // Bundle's byte array is a byte[], JNI layer only takes ByteBuffer + if (value instanceof byte[]) { + values[i] = ByteBuffer.wrap((byte[])value); + } else { + values[i] = value; + } ++i; } diff --git a/media/java/android/media/MediaCodecInfo.java b/media/java/android/media/MediaCodecInfo.java index 6301993a74be..95e3df2fd7c5 100644 --- a/media/java/android/media/MediaCodecInfo.java +++ b/media/java/android/media/MediaCodecInfo.java @@ -2516,6 +2516,8 @@ public final class MediaCodecInfo { case CodecProfileLevel.VP9Profile3: case CodecProfileLevel.VP9Profile2HDR: case CodecProfileLevel.VP9Profile3HDR: + case CodecProfileLevel.VP9Profile2HDR10Plus: + case CodecProfileLevel.VP9Profile3HDR10Plus: break; default: Log.w(TAG, "Unrecognized profile " @@ -2608,7 +2610,9 @@ public final class MediaCodecInfo { switch (profileLevel.profile) { case CodecProfileLevel.HEVCProfileMain: case CodecProfileLevel.HEVCProfileMain10: + case CodecProfileLevel.HEVCProfileMainStill: case CodecProfileLevel.HEVCProfileMain10HDR10: + case CodecProfileLevel.HEVCProfileMain10HDR10Plus: break; default: Log.w(TAG, "Unrecognized profile " @@ -2999,6 +3003,8 @@ public final class MediaCodecInfo { // HDR profiles also support passing HDR metadata public static final int VP9Profile2HDR = 0x1000; public static final int VP9Profile3HDR = 0x2000; + public static final int VP9Profile2HDR10Plus = 0x4000; + public static final int VP9Profile3HDR10Plus = 0x8000; // from OMX_VIDEO_VP9LEVELTYPE public static final int VP9Level1 = 0x1; @@ -3021,6 +3027,7 @@ public final class MediaCodecInfo { public static final int HEVCProfileMain10 = 0x02; public static final int HEVCProfileMainStill = 0x04; public static final int HEVCProfileMain10HDR10 = 0x1000; + public static final int HEVCProfileMain10HDR10Plus = 0x2000; // from OMX_VIDEO_HEVCLEVELTYPE public static final int HEVCMainTierLevel1 = 0x1; diff --git a/media/java/android/media/MediaFormat.java b/media/java/android/media/MediaFormat.java index b7743c9db4c0..b62108f1f4e7 100644 --- a/media/java/android/media/MediaFormat.java +++ b/media/java/android/media/MediaFormat.java @@ -910,6 +910,27 @@ public final class MediaFormat { public static final String KEY_HDR_STATIC_INFO = "hdr-static-info"; /** + * An optional key describing the HDR10+ metadata of the video content. + * + * The associated value is a ByteBuffer containing HDR10+ metadata conforming to the + * user_data_registered_itu_t_t35() syntax of SEI message for ST 2094-40. This key will + * be present on: + *<p> + * - The formats of output buffers of a decoder configured for HDR10+ profiles (such as + * {@link MediaCodecInfo.CodecProfileLevel#VP9Profile2HDR10Plus}, {@link + * MediaCodecInfo.CodecProfileLevel#VP9Profile3HDR10Plus} or {@link + * MediaCodecInfo.CodecProfileLevel#HEVCProfileMain10HDR10Plus}), or + *<p> + * - The formats of output buffers of an encoder configured for an HDR10+ profiles that + * uses out-of-band metadata (such as {@link + * MediaCodecInfo.CodecProfileLevel#VP9Profile2HDR10Plus} or {@link + * MediaCodecInfo.CodecProfileLevel#VP9Profile3HDR10Plus}). + * + * @see MediaCodec#PARAMETER_KEY_HDR10_PLUS_INFO + */ + public static final String KEY_HDR10_PLUS_INFO = "hdr10-plus-info"; + + /** * A key describing a unique ID for the content of a media track. * * <p>This key is used by {@link MediaExtractor}. Some extractors provide multiple encodings |