OMX-IL Video decoder: OMX_IndexParamVideoPortFormat


I am working an OpenMAX-IL video decoder and have looked at the example code (MPEG2 decoder) and the conformance test code. I noticed that both of these allow the app to modify the OMX_IndexParamVideoPortFormat data using the SetParameter method.

I don’t understand what this is used for. From the example code, I can see that the codec can provide a number of different port settings (e.g. different raw data formats on an output port), but why would the app overwrite these?

Any help appreciated.

The idea is that it allows the component to support multiple formats - for example an encoder supporting multiple codecs. Looking at OMX_CONF_ParameterTest.c, it enumerates each supported format, and in turn sets that format using OMX_IndexParamVideoPortFormat. It then queries for the port definition, and checks that the settings match between the two structures.

Whether the component also supports selecting the format based on just setting the port definition type is probably implementation specific.

The application might want to control the format so for a particular output file it might want to use a specific codec, or if the decoded video is being used as a video thumbnail it might want an RGB format rather than YUV.

Hi Tim,

I don’t think I phrased the question very well.

The OMX_IndexParamVideoPortFormat index (OMX_VIDEO_PARAM_PORTFORMATTYPE structure) allows a component to provide an enumerated list of port settings that are supported. No problem there…

How does the Client change the port settings? I assume that it would call SetParameter for the OMX_PortDomainVideo index. If the client calls SetParameter for the OMX_IndexParamVideoPortFormat index, the client is changing the list of formats supported, rather than the current format in use. I would have thought that this list of supported formats is fixed. Is that true?


If the client sets the OMX_PortDomainVideo index, then the nIndex field in the structure is ignored, and the components selects the eEncoding (or whatever is appropriate) value for the current mode. The set is treated as a mode switch, not a change of the list.