Commit a65a4ad7 authored by Martin Storsjö's avatar 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ö's avatarMartin Storsjö <martin@martin.st>
parent 28b8fd48
......@@ -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;
......
......@@ -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,
......
......@@ -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" );
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment