HardwareAPI: add MediaImage2 and DescribeColorFormat2Params
Bug: 25684127
Change-Id: I4726d43951732664ed0b8c452203d2ac110f7df8
diff --git a/include/media/hardware/HardwareAPI.h b/include/media/hardware/HardwareAPI.h
index 1008c22..99c87d3 100644
--- a/include/media/hardware/HardwareAPI.h
+++ b/include/media/hardware/HardwareAPI.h
@@ -190,6 +190,7 @@
// Structure describing a media image (frame)
// Currently only supporting YUV
+// @deprecated. Use MediaImage2 instead
struct MediaImage {
enum Type {
MEDIA_IMAGE_TYPE_UNKNOWN = 0,
@@ -219,6 +220,45 @@
PlaneInfo mPlane[MAX_NUM_PLANES];
};
+struct MediaImage2 {
+ enum Type {
+ MEDIA_IMAGE_TYPE_UNKNOWN = 0,
+ MEDIA_IMAGE_TYPE_YUV,
+ MEDIA_IMAGE_TYPE_YUVA,
+ MEDIA_IMAGE_TYPE_RGB,
+ MEDIA_IMAGE_TYPE_RGBA,
+ MEDIA_IMAGE_TYPE_Y,
+ };
+
+ enum PlaneIndex {
+ Y = 0,
+ U = 1,
+ V = 2,
+ R = 0,
+ G = 1,
+ B = 2,
+ A = 3,
+ MAX_NUM_PLANES = 4,
+ };
+
+ Type mType;
+ uint32_t mNumPlanes; // number of planes
+ uint32_t mWidth; // width of largest plane (unpadded, as in nFrameWidth)
+ uint32_t mHeight; // height of largest plane (unpadded, as in nFrameHeight)
+ uint32_t mBitDepth; // useable bit depth (always MSB)
+ uint32_t mBitDepthAllocated; // bits per component (must be 8 or 16)
+
+ struct PlaneInfo {
+ uint32_t mOffset; // offset of first pixel of the plane in bytes
+ // from buffer offset
+ int32_t mColInc; // column increment in bytes
+ int32_t mRowInc; // row increment in bytes
+ uint32_t mHorizSubsampling; // subsampling compared to the largest plane
+ uint32_t mVertSubsampling; // subsampling compared to the largest plane
+ };
+ PlaneInfo mPlane[MAX_NUM_PLANES];
+};
+
// A pointer to this struct is passed to OMX_GetParameter when the extension
// index for the 'OMX.google.android.index.describeColorFormat'
// extension is given. This method can be called from any component state
@@ -245,6 +285,8 @@
// For non-YUV packed planar/semiplanar image formats, or if bUsingNativeBuffers
// is OMX_TRUE and the component does not support this color format with native
// buffers, the component shall set mNumPlanes to 0, and mType to MEDIA_IMAGE_TYPE_UNKNOWN.
+
+// @deprecated: use DescribeColorFormat2Params
struct DescribeColorFormatParams {
OMX_U32 nSize;
OMX_VERSIONTYPE nVersion;
@@ -260,6 +302,25 @@
MediaImage sMediaImage;
};
+// A pointer to this struct is passed to OMX_GetParameter when the extension
+// index for the 'OMX.google.android.index.describeColorFormat2'
+// extension is given. This is operationally the same as DescribeColorFormatParams
+// but can be used for HDR and RGBA/YUVA formats.
+struct DescribeColorFormat2Params {
+ OMX_U32 nSize;
+ OMX_VERSIONTYPE nVersion;
+ // input: parameters from OMX_VIDEO_PORTDEFINITIONTYPE
+ OMX_COLOR_FORMATTYPE eColorFormat;
+ OMX_U32 nFrameWidth;
+ OMX_U32 nFrameHeight;
+ OMX_U32 nStride;
+ OMX_U32 nSliceHeight;
+ OMX_BOOL bUsingNativeBuffers;
+
+ // output: fill out the MediaImage2 fields
+ MediaImage2 sMediaImage;
+};
+
// A pointer to this struct is passed to OMX_SetParameter or OMX_GetParameter
// when the extension index for the
// 'OMX.google.android.index.configureVideoTunnelMode' extension is given.