Merge "Add MediaCodec constants for HDR10+"
diff --git a/api/current.txt b/api/current.txt
index 75b0d68..1b6229e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -23973,6 +23973,7 @@
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";
@@ -24246,6 +24247,7 @@
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
@@ -24307,8 +24309,10 @@
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;
}
@@ -24707,6 +24711,7 @@
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 1d27c03..242ae46 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -3308,6 +3308,55 @@
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 @@
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 6301993..95e3df2 100644
--- a/media/java/android/media/MediaCodecInfo.java
+++ b/media/java/android/media/MediaCodecInfo.java
@@ -2516,6 +2516,8 @@
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 @@
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 @@
// 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 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 b7743c9..b62108f 100644
--- a/media/java/android/media/MediaFormat.java
+++ b/media/java/android/media/MediaFormat.java
@@ -910,6 +910,27 @@
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