[vlc-commits] iomx: Move hal_format overriding into iomx_hwbuffer
Martin Storsjö
git at videolan.org
Mon Jul 28 09:52:43 CEST 2014
vlc | branch: master | Martin Storsjö <martin at martin.st> | Mon Jul 28 10:29:24 2014 +0300| [a65a4ad7a0c4f69fba28a7fe8118c50253241790] | committer: Martin Storsjö
iomx: Move hal_format overriding into iomx_hwbuffer
This simplifies doing device/version specific overrides for the
hal format, which seems to be more necessary on older platform versions.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a65a4ad7a0c4f69fba28a7fe8118c50253241790
---
modules/codec/omxil/iomx_hwbuffer.c | 22 ++++++++++++++++++++++
modules/codec/omxil/omxil.c | 17 +++++------------
modules/codec/omxil/omxil_core.c | 2 ++
modules/codec/omxil/omxil_core.h | 1 +
4 files changed, 30 insertions(+), 12 deletions(-)
diff --git a/modules/codec/omxil/iomx_hwbuffer.c b/modules/codec/omxil/iomx_hwbuffer.c
index 4eb7548..f62f4ab 100644
--- a/modules/codec/omxil/iomx_hwbuffer.c
+++ b/modules/codec/omxil/iomx_hwbuffer.c
@@ -27,6 +27,9 @@
#include <errno.h>
#include <stdio.h>
+#include <OMX_Core.h>
+#include <OMX_Component.h>
+
#if ANDROID_API <= 11
#include <ui/android_native_buffer.h>
#include <ui/egl/android_natives.h>
@@ -100,6 +103,25 @@ int IOMXHWBuffer_Disconnect( void *window )
}
+int IOMXHWBuffer_GetHalFormat( const char *comp_name, int* hal_format )
+{
+ if( !strncmp( comp_name, "OMX.SEC.", 8 ) ) {
+ switch( *hal_format ) {
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ *hal_format = 0x105; // HAL_PIXEL_FORMAT_YCbCr_420_SP
+ break;
+ case OMX_COLOR_FormatYUV420Planar:
+ *hal_format = 0x101; // HAL_PIXEL_FORMAT_YCbCr_420_P
+ break;
+ }
+ }
+ else if( !strcmp( comp_name, "OMX.TI.720P.Decoder" ) ||
+ !strcmp( comp_name, "OMX.TI.Video.Decoder" ) )
+ *hal_format = 0x14; // HAL_PIXEL_FORMAT_YCbCr_422_I
+
+ return 0;
+}
+
int IOMXHWBuffer_Setup( void *window, int w, int h, int hal_format, int hw_usage )
{
ANativeWindow *anw = (ANativeWindow *)window;
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index b7a586f..376aa44 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -2055,6 +2055,7 @@ static void HwBuffer_Init( decoder_t *p_dec, OmxPort *p_port )
pf_omx_hwbuffer_set_buffer_count && pf_omx_hwbuffer_setcrop &&
pf_omx_hwbuffer_dequeue && pf_omx_hwbuffer_lock &&
pf_omx_hwbuffer_queue && pf_omx_hwbuffer_cancel &&
+ pf_omx_hwbuffer_get_hal_format &&
((OMX_COMPONENTTYPE*)p_port->omx_handle)->UseBuffer) )
{
msg_Warn( p_dec, "direct output port enabled but can't find "
@@ -2157,19 +2158,11 @@ static int HwBuffer_AllocateBuffers( decoder_t *p_dec, OmxPort *p_port )
if( !p_port->p_hwbuf )
return 0;
- if( !strncmp( p_sys->psz_component, "OMX.SEC.", 8 ) ) {
- switch( colorFormat ) {
- case OMX_COLOR_FormatYUV420SemiPlanar:
- colorFormat = 0x105; // HAL_PIXEL_FORMAT_YCbCr_420_SP
- break;
- case OMX_COLOR_FormatYUV420Planar:
- colorFormat = 0x101; // HAL_PIXEL_FORMAT_YCbCr_420_P
- break;
- }
+ omx_error = pf_omx_hwbuffer_get_hal_format( p_sys->psz_component, &colorFormat );
+ if( omx_error != OMX_ErrorNone )
+ {
+ msg_Warn( p_dec, "pf_omx_hwbuffer_get_hal_format failed (Not fatal)" );
}
- else if( !strcmp( p_sys->psz_component, "OMX.TI.720P.Decoder" ) ||
- !strcmp( p_sys->psz_component, "OMX.TI.Video.Decoder" ) )
- colorFormat = 0x14; // HAL_PIXEL_FORMAT_YCbCr_422_I
omx_error = pf_get_graphic_buffer_usage( p_port->omx_handle,
p_port->i_port_index,
diff --git a/modules/codec/omxil/omxil_core.c b/modules/codec/omxil/omxil_core.c
index aed5251..c196ec2 100644
--- a/modules/codec/omxil/omxil_core.c
+++ b/modules/codec/omxil/omxil_core.c
@@ -92,6 +92,7 @@ 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_get_hal_format) (const char *, int *);
int (*pf_omx_hwbuffer_setup) (void *, int, int, int, int );
int (*pf_omx_hwbuffer_get_min_undequeued) (void *, unsigned int *);
int (*pf_omx_hwbuffer_set_buffer_count) (void *, unsigned int );
@@ -179,6 +180,7 @@ int InitOmxCore(vlc_object_t *p_this)
pf_omx_hwbuffer_connect = dlsym( dll_handle, "OMXHWBuffer_Connect" );
pf_omx_hwbuffer_disconnect = dlsym( dll_handle, "OMXHWBuffer_Disconnect" );
+ pf_omx_hwbuffer_get_hal_format = dlsym( dll_handle, "OMXHWBuffer_GetHalFormat" );
pf_omx_hwbuffer_setup = dlsym( dll_handle, "OMXHWBuffer_Setup" );
pf_omx_hwbuffer_get_min_undequeued = dlsym( dll_handle, "OMXHWBuffer_GetMinUndequeued" );
pf_omx_hwbuffer_set_buffer_count = dlsym( dll_handle, "OMXHWBuffer_SetBufferCount" );
diff --git a/modules/codec/omxil/omxil_core.h b/modules/codec/omxil/omxil_core.h
index 955e965..92d8caa 100644
--- a/modules/codec/omxil/omxil_core.h
+++ b/modules/codec/omxil/omxil_core.h
@@ -40,6 +40,7 @@ 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 *);
+int (*pf_omx_hwbuffer_get_hal_format) (const char *, int *);
int (*pf_omx_hwbuffer_setup) (void *, int, int, int, int );
int (*pf_omx_hwbuffer_get_min_undequeued) (void *, unsigned int *);
int (*pf_omx_hwbuffer_set_buffer_count) (void *, unsigned int );
More information about the vlc-commits
mailing list