[vlc-commits] iomx: add android GraphicBuffers functions.

Thomas Guillem git at videolan.org
Thu Jul 24 17:15:04 CEST 2014


vlc | branch: master | Thomas Guillem <guillem at archos.com> | Thu Jul 24 15:11:26 2014 +0200| [a72ed50cf0e39a85d2d9ada43f78a5ebcdafa156] | committer: Martin Storsjö

iomx: add android GraphicBuffers functions.

- OMXAndroid_EnableGraphicBuffers: activate GraphicBuffers.
  Next call of OMX_GetParameter(OMX_IndexParamPortDefinition) will return a
  private eColorFormat compatible with android hal_format.

- OMXAndroid_GetGraphicBufferUsage: return hw_usage that will be used to
  allocate android hw buffers.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a72ed50cf0e39a85d2d9ada43f78a5ebcdafa156
---

 modules/codec/omxil/iomx.cpp     |   20 ++++++++++++++++++++
 modules/codec/omxil/omxil_core.c |    6 ++++++
 modules/codec/omxil/omxil_core.h |    4 ++++
 3 files changed, 30 insertions(+)

diff --git a/modules/codec/omxil/iomx.cpp b/modules/codec/omxil/iomx.cpp
index 5bc5aee..291bd8c 100644
--- a/modules/codec/omxil/iomx.cpp
+++ b/modules/codec/omxil/iomx.cpp
@@ -404,5 +404,25 @@ OMX_ERRORTYPE PREFIX(OMX_GetComponentsOfRole)(OMX_STRING role, OMX_U32 *num_comp
     *num_comps = i;
     return OMX_ErrorNone;
 }
+
+#ifdef HAS_USE_BUFFER
+OMX_ERRORTYPE PREFIX(OMXAndroid_EnableGraphicBuffers)(OMX_HANDLETYPE component, OMX_U32 port_index, OMX_BOOL enable)
+{
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    int ret = ctx->iomx->enableGraphicBuffers(node->node, port_index, enable);
+    if (ret != OK)
+        return OMX_ErrorUndefined;
+    return OMX_ErrorNone;
+}
+
+OMX_ERRORTYPE PREFIX(OMXAndroid_GetGraphicBufferUsage)(OMX_HANDLETYPE component, OMX_U32 port_index, OMX_U32* usage)
+{
+    OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
+    int ret = ctx->iomx->getGraphicBufferUsage(node->node, port_index, usage);
+    if (ret != OK)
+        return OMX_ErrorUndefined;
+    return OMX_ErrorNone;
+}
+#endif
 }
 
diff --git a/modules/codec/omxil/omxil_core.c b/modules/codec/omxil/omxil_core.c
index 5a934e6..8b866a7 100644
--- a/modules/codec/omxil/omxil_core.c
+++ b/modules/codec/omxil/omxil_core.c
@@ -87,6 +87,9 @@ OMX_ERRORTYPE (*pf_get_handle) (OMX_HANDLETYPE *, OMX_STRING,
 OMX_ERRORTYPE (*pf_free_handle) (OMX_HANDLETYPE);
 OMX_ERRORTYPE (*pf_component_enum)(OMX_STRING, OMX_U32, OMX_U32);
 OMX_ERRORTYPE (*pf_get_roles_of_component)(OMX_STRING, OMX_U32 *, OMX_U8 **);
+OMX_ERRORTYPE (*pf_enable_graphic_buffers)(OMX_HANDLETYPE, OMX_U32, OMX_BOOL);
+OMX_ERRORTYPE (*pf_get_graphic_buffer_usage)(OMX_HANDLETYPE, OMX_U32, OMX_U32*);
+
 int (*pf_omx_hwbuffer_connect) (void *);
 int (*pf_omx_hwbuffer_disconnect) (void *);
 int (*pf_omx_hwbuffer_setup) (void *, int, int, int, int, unsigned int *,
@@ -169,6 +172,9 @@ int InitOmxCore(vlc_object_t *p_this)
         return VLC_EGENERIC;
     }
 #if defined(USE_IOMX)
+    pf_enable_graphic_buffers = dlsym( dll_handle, "OMXAndroid_EnableGraphicBuffers" );
+    pf_get_graphic_buffer_usage = dlsym( dll_handle, "OMXAndroid_GetGraphicBufferUsage" );
+
     pf_omx_hwbuffer_connect = dlsym( dll_handle, "OMXHWBuffer_Connect" );
     pf_omx_hwbuffer_disconnect = dlsym( dll_handle, "OMXHWBuffer_Disconnect" );
     pf_omx_hwbuffer_setup = dlsym( dll_handle, "OMXHWBuffer_Setup" );
diff --git a/modules/codec/omxil/omxil_core.h b/modules/codec/omxil/omxil_core.h
index 38faba2..0326179 100644
--- a/modules/codec/omxil/omxil_core.h
+++ b/modules/codec/omxil/omxil_core.h
@@ -33,6 +33,10 @@ OMX_ERRORTYPE (*pf_free_handle) (OMX_HANDLETYPE);
 OMX_ERRORTYPE (*pf_component_enum)(OMX_STRING, OMX_U32, OMX_U32);
 OMX_ERRORTYPE (*pf_get_roles_of_component)(OMX_STRING, OMX_U32 *, OMX_U8 **);
 
+/* Extra IOMX android functions. Can be NULL if we don't link with libiomx */
+OMX_ERRORTYPE (*pf_enable_graphic_buffers)(OMX_HANDLETYPE, OMX_U32, OMX_BOOL);
+OMX_ERRORTYPE (*pf_get_graphic_buffer_usage)(OMX_HANDLETYPE, OMX_U32, OMX_U32*);
+
 /* OMXHWBuffer functions */
 int (*pf_omx_hwbuffer_connect) (void *);
 int (*pf_omx_hwbuffer_disconnect) (void *);



More information about the vlc-commits mailing list