video: added OMX_IndexVendorGetBufferFD support
authorTaehwan Kim <t_h.kim@samsung.com>
Thu, 3 Jan 2013 10:37:45 +0000 (10:37 +0000)
committerTaehwan Kim <t_h.kim@samsung.com>
Thu, 17 Jan 2013 10:10:10 +0000 (10:10 +0000)
in order to get the FD about buffer,
added OMX_IndexVendorGetBufferFD support.

Change-Id: I2034d97c7afcdabe41876e08380ec4f8b120f52f
Signed-off-by: Taehwan Kim <t_h.kim@samsung.com>
component/video/dec/Exynos_OMX_VdecControl.c
component/video/enc/Exynos_OMX_VencControl.c
include/exynos/Exynos_OMX_Def.h

index 7f814ce8a2bac295f934de7967605275a71c521f..b4e4809a652762d9d665ed3556b314fcad8e92ba 100644 (file)
@@ -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
index 2dd1b11baefacd4523a9170026d33e54947c4a01..73e94cd30c9e1f033d6b37d0607cd0b3073612a8 100644 (file)
@@ -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
index 3877da28a574b8f631ed5e660a49395121f73388..eacb8a59b72a9241e531871fd35e82c320cf2f1b 100644 (file)
@@ -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"