[vlc-devel] [RFC PATCH 02/11] iomx: simplify param/config size getter.
Thomas Guillem
guillem at archos.com
Tue Jun 24 16:15:04 CEST 2014
"OMX_U32 nSize" is the first element of each OMX param/config struct.
---
modules/codec/omxil/iomx.cpp | 75 +++---------------------------------------
1 file changed, 4 insertions(+), 71 deletions(-)
diff --git a/modules/codec/omxil/iomx.cpp b/modules/codec/omxil/iomx.cpp
index c3b096c..b399018 100644
--- a/modules/codec/omxil/iomx.cpp
+++ b/modules/codec/omxil/iomx.cpp
@@ -125,73 +125,6 @@ static OMX_ERRORTYPE get_error(status_t err)
return OMX_ErrorUndefined;
}
-static int get_param_size(OMX_INDEXTYPE param_index)
-{
- switch (param_index) {
- case OMX_IndexParamPortDefinition:
- return sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
- case OMX_IndexParamStandardComponentRole:
- return sizeof(OMX_PARAM_COMPONENTROLETYPE);
- case OMX_IndexParamVideoInit:
- case OMX_IndexParamAudioInit:
- case OMX_IndexParamImageInit:
- case OMX_IndexParamOtherInit:
- return sizeof(OMX_PORT_PARAM_TYPE);
- case OMX_IndexParamNumAvailableStreams:
- return sizeof(OMX_PARAM_U32TYPE);
- case OMX_IndexParamAudioPcm:
- return sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
- case OMX_IndexParamAudioAdpcm:
- return sizeof(OMX_AUDIO_PARAM_AMRTYPE);
- case OMX_IndexParamAudioAmr:
- return sizeof(OMX_AUDIO_PARAM_AMRTYPE);
- case OMX_IndexParamAudioG723:
- return sizeof(OMX_AUDIO_PARAM_G723TYPE);
- case OMX_IndexParamAudioG726:
- return sizeof(OMX_AUDIO_PARAM_G726TYPE);
- case OMX_IndexParamAudioG729:
- return sizeof(OMX_AUDIO_PARAM_G729TYPE);
- case OMX_IndexParamAudioAac:
- return sizeof(OMX_AUDIO_PARAM_AACPROFILETYPE);
- case OMX_IndexParamAudioMp3:
- return sizeof(OMX_AUDIO_PARAM_MP3TYPE);
- case OMX_IndexParamAudioSbc:
- return sizeof(OMX_AUDIO_PARAM_SBCTYPE);
- case OMX_IndexParamAudioVorbis:
- return sizeof(OMX_AUDIO_PARAM_VORBISTYPE);
- case OMX_IndexParamAudioWma:
- return sizeof(OMX_AUDIO_PARAM_WMATYPE);
- case OMX_IndexParamAudioRa:
- return sizeof(OMX_AUDIO_PARAM_RATYPE);
- case OMX_IndexParamVideoPortFormat:
- return sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE);
- case OMX_IndexParamVideoBitrate:
- return sizeof(OMX_VIDEO_PARAM_BITRATETYPE);
- case OMX_IndexParamVideoH263:
- return sizeof(OMX_VIDEO_PARAM_H263TYPE);
- case OMX_IndexParamVideoMpeg4:
- return sizeof(OMX_VIDEO_PARAM_MPEG4TYPE);
- case OMX_IndexParamVideoAvc:
- return sizeof(OMX_VIDEO_PARAM_AVCTYPE);
- case OMX_IndexParamVideoWmv:
- return sizeof(OMX_VIDEO_PARAM_WMVTYPE);
- default:
- return 0;
- }
-}
-
-static int get_config_size(OMX_INDEXTYPE param_index)
-{
- switch (param_index) {
- case OMX_IndexConfigCommonOutputCrop:
- return sizeof(OMX_CONFIG_RECTTYPE);
- default:
- /* Dynamically queried config indices could have any size, but
- * are currently only used with OMX_BOOL. */
- return sizeof(OMX_BOOL);
- }
-}
-
static OMX_ERRORTYPE iomx_send_command(OMX_HANDLETYPE component, OMX_COMMANDTYPE command, OMX_U32 param1, OMX_PTR)
{
OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
@@ -201,13 +134,13 @@ static OMX_ERRORTYPE iomx_send_command(OMX_HANDLETYPE component, OMX_COMMANDTYPE
static OMX_ERRORTYPE iomx_get_parameter(OMX_HANDLETYPE component, OMX_INDEXTYPE param_index, OMX_PTR param)
{
OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
- return get_error(ctx->iomx->getParameter(node->node, param_index, param, get_param_size(param_index)));
+ return get_error(ctx->iomx->getParameter(node->node, param_index, param, *(OMX_U32*)param));
}
static OMX_ERRORTYPE iomx_set_parameter(OMX_HANDLETYPE component, OMX_INDEXTYPE param_index, OMX_PTR param)
{
OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
- return get_error(ctx->iomx->setParameter(node->node, param_index, param, get_param_size(param_index)));
+ return get_error(ctx->iomx->setParameter(node->node, param_index, param, *(OMX_U32*)param));
}
static OMX_ERRORTYPE iomx_get_state(OMX_HANDLETYPE component, OMX_STATETYPE *ptr) {
@@ -292,13 +225,13 @@ static OMX_ERRORTYPE iomx_get_extension_index(OMX_HANDLETYPE component, OMX_STRI
static OMX_ERRORTYPE iomx_set_config(OMX_HANDLETYPE component, OMX_INDEXTYPE index, OMX_PTR param)
{
OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
- return get_error(ctx->iomx->setConfig(node->node, index, param, get_config_size(index)));
+ return get_error(ctx->iomx->setConfig(node->node, index, param, *(OMX_U32*)param));
}
static OMX_ERRORTYPE iomx_get_config(OMX_HANDLETYPE component, OMX_INDEXTYPE index, OMX_PTR param)
{
OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate;
- return get_error(ctx->iomx->getConfig(node->node, index, param, get_config_size(index)));
+ return get_error(ctx->iomx->getConfig(node->node, index, param, *(OMX_U32*)param));
}
extern "C" {
--
1.7.10.4
--
This email and any files transmitted with it are confidential and are
intended solely for the use of the individual or entity to which they are
addressed. Access to this e-mail by anyone else is unauthorised. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken or omitted to be taken in reliance on it, is prohibited.
E-mail messages are not necessarily secure. Archos does not accept
responsibility for any changes made to this message after it was sent.
More information about the vlc-devel
mailing list