[Gstreamer-openmax] [PATCH] add some utility macros to get/set core and port configs/params
Rob Clark
rob at ti.com
Wed Nov 25 10:16:43 PST 2009
On Nov 25, 2009, at 11:21 AM, Felipe Contreras wrote:
> On Mon, Nov 23, 2009 at 7:25 AM, Rob Clark <rob at ti.com> wrote:
>> but an inline function could not figure out sizeof() properly.. so
>> this
>> would have to be passed as an additional parameter. (although a
>> combination
>> of a macro calling an inline fxn could work)
>>
>> sometimes macro's are a necessary evil ;-)
>
> Right, but in my opinion if you need a macro chances are you are doing
> something wrong and the code becomes more convoluted.
>
> I this particular case I think it makes sense to write a macro that
> wraps:
> OMX_AUDIO_PARAM_PCMMODETYPE param = {
> .nSize = sizeof(param),
> .nVersion = OMX_VERSION,
> };
>
> But that's it. Then a separate inline function that does:
> param.nPortIndex = 1;
> OMX_GetParameter(omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm,
> ¶m);
>
> This way it would be possible to call OMX_SetParameter without
> OMX_GetParameter (in case you are setting all the fields).
yeah, macro+fxn combo would work..
I was thinking it would be nice to maybe even add some error checking
(maybe verify nPortIndex is set correctly on the SET_PARAM macro/
function to catch places that do a SET_PARAM without a matching
GET_PARAM..
BR,
-R
More information about the Gstreamer-openmax
mailing list