osal: add procssing of kMetadataBufferTypeNativeHandleSource metadata
authorDanny Wood <danwood76@gmail.com>
Fri, 10 Apr 2020 19:42:22 +0000 (20:42 +0100)
committerDanny Wood <danwood76@gmail.com>
Sat, 11 Apr 2020 09:47:54 +0000 (10:47 +0100)
Change-Id: Id64f6728c5d74a266be2ef525ba5d220b51125ea

osal/Exynos_OSAL_Android.cpp

index 2402479bf6b43164afaad66905e3f9193bc32a30..bb2baacdaadc42976a80699fbde23710d37a77ff 100644 (file)
@@ -1037,6 +1037,12 @@ OMX_ERRORTYPE Exynos_OSAL_GetInfoFromMetaData(OMX_IN OMX_BYTE pBuffer,
  * ---------------------------------------------------------------
  * | kMetadataBufferTypeGrallocSource |     buffer_handle_t      |
  * ---------------------------------------------------------------
+ *
+ * If MetadataBufferType is kMetadataBufferTypeNativeHandleSource, then
+ * ---------------------------------------------------------------
+ * |  kMetadataBufferTypeNativeHandleSource | native_handle_t*   |
+ * ---------------------------------------------------------------
+ *
  */
 
     /* MetadataBufferType */
@@ -1072,6 +1078,23 @@ OMX_ERRORTYPE Exynos_OSAL_GetInfoFromMetaData(OMX_IN OMX_BYTE pBuffer,
             ret = OMX_ErrorBadParameter;
         }
     }
+        break;
+    case kMetadataBufferTypeNativeHandleSource:
+    {
+        native_handle_t*    pNativeHandle;
+
+        /* native_handle_t */
+        Exynos_OSAL_Memcpy(&pNativeHandle, pBuffer + sizeof(MetadataBufferType), sizeof(native_handle_t*));
+
+        ppBuf[0] = INT_TO_PTR(pNativeHandle->data[0]);
+        ppBuf[1] = INT_TO_PTR(pNativeHandle->data[1]);
+
+        if (ppBuf[0] == NULL || ppBuf[1] == NULL) {
+            Exynos_OSAL_Log(EXYNOS_LOG_WARNING, "NativeHandle's fd is NULL");
+            ret = OMX_ErrorBadParameter;
+        }
+    }
+
         break;
     default:
     {