From ea1234c887b040b9fb3d2d4155b684310fc6eea4 Mon Sep 17 00:00:00 2001 From: Taehwan Kim Date: Thu, 3 Jan 2013 10:37:45 +0000 Subject: [PATCH] video: added OMX_IndexVendorGetBufferFD support in order to get the FD about buffer, added OMX_IndexVendorGetBufferFD support. Change-Id: I2034d97c7afcdabe41876e08380ec4f8b120f52f Signed-off-by: Taehwan Kim --- component/video/dec/Exynos_OMX_VdecControl.c | 16 ++++++++++++++++ component/video/enc/Exynos_OMX_VencControl.c | 16 ++++++++++++++++ include/exynos/Exynos_OMX_Def.h | 9 +++++++++ 3 files changed, 41 insertions(+) diff --git a/component/video/dec/Exynos_OMX_VdecControl.c b/component/video/dec/Exynos_OMX_VdecControl.c index 7f814ce..b4e4809 100644 --- a/component/video/dec/Exynos_OMX_VdecControl.c +++ b/component/video/dec/Exynos_OMX_VdecControl.c @@ -1336,6 +1336,18 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeGetConfig( } switch (nIndex) { + case OMX_IndexVendorGetBufferFD: + { + EXYNOS_OMX_VIDEODEC_COMPONENT *pVideoDec = (EXYNOS_OMX_VIDEODEC_COMPONENT *)pExynosComponent->hComponentHandle; + EXYNOS_OMX_VIDEO_CONFIG_BUFFERINFO *pBufferInfo = (EXYNOS_OMX_VIDEO_CONFIG_BUFFERINFO *)pComponentConfigStructure; + + ret = Exynos_OMX_Check_SizeVersion(pBufferInfo, sizeof(EXYNOS_OMX_VIDEO_CONFIG_BUFFERINFO)); + if (ret != OMX_ErrorNone) + goto EXIT; + + pBufferInfo->fd = Exynos_OSAL_SharedMemory_VirtToION(pVideoDec->hSharedMemory, pBufferInfo->pVirAddr); + } + break; default: ret = Exynos_OMX_GetConfig(hComponent, nIndex, pComponentConfigStructure); break; @@ -1441,6 +1453,10 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeGetExtensionIndex( *pIndexType = (OMX_INDEXTYPE) OMX_IndexVendorNeedContigMemory; ret = OMX_ErrorNone; goto EXIT; + } else if (Exynos_OSAL_Strcmp(cParameterName, EXYNOS_INDEX_CONFIG_GET_BUFFER_FD) == 0) { + *pIndexType = (OMX_INDEXTYPE) OMX_IndexVendorGetBufferFD; + ret = OMX_ErrorNone; + goto EXIT; } #ifdef USE_ANB diff --git a/component/video/enc/Exynos_OMX_VencControl.c b/component/video/enc/Exynos_OMX_VencControl.c index 2dd1b11..73e94cd 100644 --- a/component/video/enc/Exynos_OMX_VencControl.c +++ b/component/video/enc/Exynos_OMX_VencControl.c @@ -1720,6 +1720,18 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetConfig( } } break; + case OMX_IndexVendorGetBufferFD: + { + EXYNOS_OMX_VIDEOENC_COMPONENT *pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle; + EXYNOS_OMX_VIDEO_CONFIG_BUFFERINFO *pBufferInfo = (EXYNOS_OMX_VIDEO_CONFIG_BUFFERINFO *)pComponentConfigStructure; + + ret = Exynos_OMX_Check_SizeVersion(pBufferInfo, sizeof(EXYNOS_OMX_VIDEO_CONFIG_BUFFERINFO)); + if (ret != OMX_ErrorNone) + goto EXIT; + + pBufferInfo->fd = Exynos_OSAL_SharedMemory_VirtToION(pVideoEnc->hSharedMemory, pBufferInfo->pVirAddr); + } + break; default: { ret = Exynos_OMX_GetConfig(hComponent, nParamIndex, pComponentConfigStructure); @@ -1871,6 +1883,10 @@ OMX_ERRORTYPE Exynos_OMX_VideoEncodeGetExtensionIndex( *pIndexType = (OMX_INDEXTYPE) OMX_IndexVendorNeedContigMemory; ret = OMX_ErrorNone; goto EXIT; + } else if (Exynos_OSAL_Strcmp(szParamName, EXYNOS_INDEX_CONFIG_GET_BUFFER_FD) == 0) { + *pIndexType = (OMX_INDEXTYPE) OMX_IndexVendorGetBufferFD; + ret = OMX_ErrorNone; + goto EXIT; } #ifdef USE_STOREMETADATA diff --git a/include/exynos/Exynos_OMX_Def.h b/include/exynos/Exynos_OMX_Def.h index 3877da2..eacb8a5 100644 --- a/include/exynos/Exynos_OMX_Def.h +++ b/include/exynos/Exynos_OMX_Def.h @@ -73,6 +73,13 @@ typedef struct _EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE { OMX_BOOL bNeedContigMem; } EXYNOS_OMX_VIDEO_PARAM_PORTMEMTYPE; +typedef struct _EXYNOS_OMX_VIDEO_CONFIG_BUFFERINFO { + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_PTR OMX_IN pVirAddr; + OMX_S32 OMX_OUT fd; +} EXYNOS_OMX_VIDEO_CONFIG_BUFFERINFO; + typedef enum _EXYNOS_OMX_INDEXTYPE { #define EXYNOS_INDEX_PARAM_ENABLE_THUMBNAIL "OMX.SEC.index.ThumbnailMode" @@ -85,6 +92,8 @@ typedef enum _EXYNOS_OMX_INDEXTYPE #endif #define EXYNOS_INDEX_PARAM_NEED_CONTIG_MEMORY "OMX.SEC.index.NeedContigMemory" OMX_IndexVendorNeedContigMemory = 0x7F000004, +#define EXYNOS_INDEX_CONFIG_GET_BUFFER_FD "OMX.SEC.index.GetBufferFD" + OMX_IndexVendorGetBufferFD = 0x7F000005, /* for Android Native Window */ #define EXYNOS_INDEX_PARAM_ENABLE_ANB "OMX.google.android.index.enableAndroidNativeBuffers" -- 2.20.1