Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

venc: Support OMX_COLOR_FormatAndroidOpaque color format

- The OMX IL Client can set color format to OMX_COLOR_FormatAndroidOpaque
  if the client is unaware of the input color format. (e.g. live effects)
- If OMX_COLOR_FormatAndroidOpaque is set, we internally map it to
  one of the supported input formats (e.g. OMX_COLOR_FormatYUV420SemiPlanar)

Change-Id: I611f98bb032e1791e40da9a5b84b17db0768e39b
(cherry picked from commit 79535a2)
  • Loading branch information...
commit e3d843fba9b5532ff840830a0a9fa74f21c6df49 1 parent f4c0068
Haynes Mathew George authored Zhoulu Luo committed
View
1  vidc/venc/inc/omx_video_base.h
@@ -151,6 +151,7 @@ class omx_video: public qc_omx_component
bool meta_mode_enable;
encoder_media_buffer_type meta_buffers[MAX_NUM_INPUT_BUFFERS];
OMX_BUFFERHEADERTYPE meta_buffer_hdr[MAX_NUM_INPUT_BUFFERS];
+ bool mUseProxyColorFormat;
#endif
public:
omx_video(); // constructor
View
18 vidc/venc/src/omx_video_base.cpp
@@ -1450,6 +1450,10 @@ OMX_ERRORTYPE omx_video::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
{
portDefn->nBufferSize = sizeof(encoder_media_buffer_type);
}
+
+ if (mUseProxyColorFormat) {
+ portDefn->format.video.eColorFormat = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FormatAndroidOpaque;
+ }
#endif
}
else if(portDefn->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
@@ -1482,7 +1486,19 @@ OMX_ERRORTYPE omx_video::get_parameter(OMX_IN OMX_HANDLETYPE hComp,
if(portFmt->nPortIndex == (OMX_U32) PORT_INDEX_IN)
{
- memcpy(portFmt, &m_sInPortFormat, sizeof(m_sInPortFormat));
+ int index = portFmt->nIndex;
+ memcpy(portFmt, &m_sInPortFormat, sizeof(m_sInPortFormat));
+
+#ifdef _ANDROID_ICS_
+ if (index == 1) {
+ //we support two formats
+ //index 0 - YUV420SP
+ //index 1 - opaque which internally maps to YUV420SP.
+ //this can be extended in the future
+ portFmt->nIndex = index; //restore index set from client
+ portFmt->eColorFormat = (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FormatAndroidOpaque;
+ }
+#endif
}
else if(portFmt->nPortIndex == (OMX_U32) PORT_INDEX_OUT)
{
View
23 vidc/venc/src/omx_video_encoder.cpp
@@ -1,5 +1,5 @@
/*--------------------------------------------------------------------------
-Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
+Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@@ -59,6 +59,7 @@ omx_venc::omx_venc()
meta_mode_enable = false;
memset(meta_buffer_hdr,0,sizeof(meta_buffer_hdr));
memset(meta_buffers,0,sizeof(meta_buffers));
+ mUseProxyColorFormat = false;
#endif
}
@@ -493,6 +494,13 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
DEBUG_PRINT_LOW("\n i/p previous min cnt = %d\n", m_sInPortDef.nBufferCountMin);
memcpy(&m_sInPortDef, portDefn,sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+#ifdef _ANDROID_ICS_
+ if (portDefn->format.video.eColorFormat == (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FormatAndroidOpaque) {
+ m_sInPortDef.format.video.eColorFormat =
+ OMX_COLOR_FormatYUV420SemiPlanar;
+ mUseProxyColorFormat = true;
+ } //else case not needed as color format is already updated in the memcpy above
+#endif
/*Query Input Buffer Requirements*/
dev_get_buf_req (&m_sInPortDef.nBufferCountMin,
&m_sInPortDef.nBufferCountActual,
@@ -552,7 +560,18 @@ OMX_ERRORTYPE omx_venc::set_parameter(OMX_IN OMX_HANDLETYPE hComp,
DEBUG_PRINT_LOW("set_parameter: OMX_IndexParamVideoPortFormat %d\n",
portFmt->eColorFormat);
update_profile_level(); //framerate
- m_sInPortFormat.eColorFormat = portFmt->eColorFormat;
+
+#ifdef _ANDROID_ICS_
+ if (portFmt->eColorFormat ==
+ (OMX_COLOR_FORMATTYPE)QOMX_COLOR_FormatAndroidOpaque) {
+ m_sInPortFormat.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
+ mUseProxyColorFormat = true;
+ }
+ else
+#endif
+ {
+ m_sInPortFormat.eColorFormat = portFmt->eColorFormat;
+ }
m_sInPortFormat.xFramerate = portFmt->xFramerate;
}
//TODO if no use case for O/P port,delet m_sOutPortFormat
Please sign in to comment.
Something went wrong with that request. Please try again.