diff options
author | Emil Velikov <[email protected]> | 2014-06-10 02:14:18 +0100 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2014-06-26 14:05:12 +0100 |
commit | c35cf3400f57c5ed60df4c4a801a71fe897edfb8 (patch) | |
tree | 8b2f2ddf2d89edbd299825404ee55538912cab74 | |
parent | 9a9742f92c9ad9d8af7fbddc96a18157f7945d61 (diff) |
st/omx: avoid using dynamic vid_(enc|dec)_base and avc_(name|role)
Strictly speaking we should not have done this in the
first place, as all of the above should be static across
the system.
Currently this may cause some minor issues, which will be
resolved in the following patches, by providing a single
library for the OMX api.
Cleanup a few unneeded strcpy cases while we're around.
Note: Make sure to rebuild the .omxregister file, by executing
$ omxregister-bellagio
If you have more than one omx library (libomx-radeonsi, libomx-r600),
make sure to temporary move the unused one. By the end of the series
there will be only one library that will be used for all hardware -
r600, radeonsi and nouveau.
Cc: Leo Liu <[email protected]>
Cc: Christian König <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>
-rw-r--r-- | src/gallium/state_trackers/omx/vid_dec.c | 69 | ||||
-rw-r--r-- | src/gallium/state_trackers/omx/vid_dec.h | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/omx/vid_enc.c | 33 | ||||
-rw-r--r-- | src/gallium/state_trackers/omx/vid_enc.h | 4 |
4 files changed, 18 insertions, 94 deletions
diff --git a/src/gallium/state_trackers/omx/vid_dec.c b/src/gallium/state_trackers/omx/vid_dec.c index de1c3825ebb..4442c5c925d 100644 --- a/src/gallium/state_trackers/omx/vid_dec.c +++ b/src/gallium/state_trackers/omx/vid_dec.c @@ -64,21 +64,6 @@ static OMX_ERRORTYPE vid_dec_DecodeBuffer(omx_base_PortType *port, OMX_BUFFERHEA static OMX_ERRORTYPE vid_dec_FreeDecBuffer(omx_base_PortType *port, OMX_U32 idx, OMX_BUFFERHEADERTYPE *buf); static void vid_dec_FrameDecoded(OMX_COMPONENTTYPE *comp, OMX_BUFFERHEADERTYPE* input, OMX_BUFFERHEADERTYPE* output); -static void vid_dec_name(char str[OMX_MAX_STRINGNAME_SIZE]) -{ - snprintf(str, OMX_MAX_STRINGNAME_SIZE, OMX_VID_DEC_BASE_NAME, driver_descriptor.name); -} - -static void vid_dec_name_mpeg2(char str[OMX_MAX_STRINGNAME_SIZE]) -{ - snprintf(str, OMX_MAX_STRINGNAME_SIZE, OMX_VID_DEC_MPEG2_NAME, driver_descriptor.name); -} - -static void vid_dec_name_avc(char str[OMX_MAX_STRINGNAME_SIZE]) -{ - snprintf(str, OMX_MAX_STRINGNAME_SIZE, OMX_VID_DEC_AVC_NAME, driver_descriptor.name); -} - OMX_ERRORTYPE vid_dec_LoaderComponent(stLoaderComponentType *comp) { comp->componentVersion.s.nVersionMajor = 0; @@ -87,67 +72,35 @@ OMX_ERRORTYPE vid_dec_LoaderComponent(stLoaderComponentType *comp) comp->componentVersion.s.nStep = 1; comp->name_specific_length = 2; - comp->name = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); - if (comp->name == NULL) - goto error; - comp->name_specific = CALLOC(comp->name_specific_length, sizeof(char *)); if (comp->name_specific == NULL) goto error; - comp->name_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); - if (comp->name_specific[0] == NULL) - goto error; - - comp->name_specific[1] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); - if (comp->name_specific[1] == NULL) - goto error; - comp->role_specific = CALLOC(comp->name_specific_length, sizeof(char *)); if (comp->role_specific == NULL) goto error; - comp->role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); - if (comp->role_specific[0] == NULL) - goto error; - - comp->role_specific[1] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); - if (comp->role_specific[1] == NULL) - goto error; - - vid_dec_name(comp->name); - vid_dec_name_mpeg2(comp->name_specific[0]); - vid_dec_name_avc(comp->name_specific[1]); + comp->name = OMX_VID_DEC_BASE_NAME; + comp->name_specific[0] = OMX_VID_DEC_MPEG2_NAME; + comp->name_specific[1] = OMX_VID_DEC_AVC_NAME; - strcpy(comp->role_specific[0], OMX_VID_DEC_MPEG2_ROLE); - strcpy(comp->role_specific[1], OMX_VID_DEC_AVC_ROLE); + comp->role_specific[0] = OMX_VID_DEC_MPEG2_ROLE; + comp->role_specific[1] = OMX_VID_DEC_AVC_ROLE; comp->constructor = vid_dec_Constructor; - + return OMX_ErrorNone; error: - FREE(comp->name); - - if (comp->name_specific) { - FREE(comp->name_specific[0]); - FREE(comp->name_specific[1]); - FREE(comp->name_specific); - } - - if (comp->role_specific) { - FREE(comp->role_specific[0]); - FREE(comp->role_specific[1]); - FREE(comp->role_specific); - } + FREE(comp->name_specific); + FREE(comp->role_specific); return OMX_ErrorInsufficientResources; } static OMX_ERRORTYPE vid_dec_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING name) { - char tmpstr[OMX_MAX_STRINGNAME_SIZE]; vid_dec_PrivateType *priv; omx_base_video_PortType *port; struct pipe_screen *screen; @@ -166,12 +119,10 @@ static OMX_ERRORTYPE vid_dec_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam priv->profile = PIPE_VIDEO_PROFILE_UNKNOWN; - vid_dec_name_mpeg2(tmpstr); - if (!strcmp(name, tmpstr)) + if (!strcmp(name, OMX_VID_DEC_MPEG2_NAME)) priv->profile = PIPE_VIDEO_PROFILE_MPEG2_MAIN; - vid_dec_name_avc(tmpstr); - if (!strcmp(name, tmpstr)) + if (!strcmp(name, OMX_VID_DEC_AVC_NAME)) priv->profile = PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH; priv->BufferMgmtCallback = vid_dec_FrameDecoded; diff --git a/src/gallium/state_trackers/omx/vid_dec.h b/src/gallium/state_trackers/omx/vid_dec.h index d6c35b56321..9acf872cfe2 100644 --- a/src/gallium/state_trackers/omx/vid_dec.h +++ b/src/gallium/state_trackers/omx/vid_dec.h @@ -50,12 +50,12 @@ #include "os/os_thread.h" #include "util/u_double_list.h" -#define OMX_VID_DEC_BASE_NAME "OMX.%s.video_decoder" +#define OMX_VID_DEC_BASE_NAME "OMX.mesa.video_decoder" -#define OMX_VID_DEC_MPEG2_NAME "OMX.%s.video_decoder.mpeg2" +#define OMX_VID_DEC_MPEG2_NAME "OMX.mesa.video_decoder.mpeg2" #define OMX_VID_DEC_MPEG2_ROLE "video_decoder.mpeg2" -#define OMX_VID_DEC_AVC_NAME "OMX.%s.video_decoder.avc" +#define OMX_VID_DEC_AVC_NAME "OMX.mesa.video_decoder.avc" #define OMX_VID_DEC_AVC_ROLE "video_decoder.avc" struct vl_vlc; diff --git a/src/gallium/state_trackers/omx/vid_enc.c b/src/gallium/state_trackers/omx/vid_enc.c index db4fc8f47e9..15eeb091225 100644 --- a/src/gallium/state_trackers/omx/vid_enc.c +++ b/src/gallium/state_trackers/omx/vid_enc.c @@ -96,16 +96,6 @@ static void vid_enc_BufferEncoded(OMX_COMPONENTTYPE *comp, OMX_BUFFERHEADERTYPE* static void enc_ReleaseTasks(struct list_head *head); -static void vid_enc_name(char str[OMX_MAX_STRINGNAME_SIZE]) -{ - snprintf(str, OMX_MAX_STRINGNAME_SIZE, OMX_VID_ENC_BASE_NAME, driver_descriptor.name); -} - -static void vid_enc_name_avc(char str[OMX_MAX_STRINGNAME_SIZE]) -{ - snprintf(str, OMX_MAX_STRINGNAME_SIZE, OMX_VID_ENC_AVC_NAME, driver_descriptor.name); -} - OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp) { comp->componentVersion.s.nVersionMajor = 0; @@ -115,11 +105,7 @@ OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp) comp->name_specific_length = 1; comp->constructor = vid_enc_Constructor; - comp->name = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); - if (!comp->name) - return OMX_ErrorInsufficientResources; - - vid_enc_name(comp->name); + comp->name = OMX_VID_ENC_BASE_NAME; comp->name_specific = CALLOC(1, sizeof(char *)); if (!comp->name_specific) @@ -129,28 +115,15 @@ OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp) if (!comp->role_specific) goto error_arrays; - comp->name_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); - if (!comp->name_specific[0]) - goto error_specific; - - vid_enc_name_avc(comp->name_specific[0]); + comp->name_specific[0] = OMX_VID_ENC_AVC_NAME; - comp->role_specific[0] = CALLOC(1, OMX_MAX_STRINGNAME_SIZE); - if (!comp->role_specific[0]) - goto error_specific; - - strcpy(comp->role_specific[0], OMX_VID_ENC_AVC_ROLE); + comp->role_specific[0] = OMX_VID_ENC_AVC_ROLE; return OMX_ErrorNone; -error_specific: - FREE(comp->name_specific[0]); - FREE(comp->role_specific[0]); - error_arrays: FREE(comp->role_specific); FREE(comp->name_specific); - FREE(comp->name); return OMX_ErrorInsufficientResources; } diff --git a/src/gallium/state_trackers/omx/vid_enc.h b/src/gallium/state_trackers/omx/vid_enc.h index 47e4b963d89..ca6ee910dc7 100644 --- a/src/gallium/state_trackers/omx/vid_enc.h +++ b/src/gallium/state_trackers/omx/vid_enc.h @@ -46,8 +46,8 @@ #include "vl/vl_defines.h" #include "vl/vl_compositor.h" -#define OMX_VID_ENC_BASE_NAME "OMX.%s.video_encoder" -#define OMX_VID_ENC_AVC_NAME "OMX.%s.video_encoder.avc" +#define OMX_VID_ENC_BASE_NAME "OMX.mesa.video_encoder" +#define OMX_VID_ENC_AVC_NAME "OMX.mesa.video_encoder.avc" #define OMX_VID_ENC_AVC_ROLE "video_encoder.avc" #define OMX_VID_ENC_BITRATE_MIN 64000 |