Top
audio_capture
audio_decode
audio_encode
audio_lowpower
audio_mixer
audio_processor
audio_render
audio_splitter
image_decode
image_encode
image_fx
image_read
image_write
resize
source
transition
write_still
clock
null_sink
text_scheduler
visualisation
read_media
write_media
camera
egl_render
video_decode
video_encode
video_render
video_scheduler
video_splitter
Custom Index
Metadata

Metadata Extraction

Metadata is represented within a tree of container nodes, starting at the root node of OMX_ALL. Each container node can encompass any number of child nodes, which in themselves may be container/parent nodes, but each node can only have a single parent. There are two anticipated use cases for extracting metadata from a component -- reading all the metadata tags into a client-side structure, or searching for a specific metadata key within the metadata items.

Extracting the entire tree

To extract the entire tree:

  1. Issue a OMX_IndexConfigContainerNodeCount query with nParentNodeID as the root node (OMX_ALL) to obtain the number of nodes for that parent.
  2. For the reported number of nodes, query for OMX_IndexConfigCounterNodeID to obtain the node ID for each of these nodes. This query also returns bIsLeaf to identify nodes that are themselves parents.
  3. For nodes where bIsLeaf is OMX_TRUE, issue an OMX_IndexConfigMetadataItem query with eSearchMode as OMX_MetadataSearchItemByIndex to retrieve the actual metadata item value.
  4. For nodes where bIsLeaf is OMX_FALSE (ie a parent to other nodes), repeat from step 1 using the obtained node number as nParentNodeID.

Extracting a specific metadata item by key

To extract a node from the tree, each level of the tree must be queried in turn to obtain the relevant node IDs.
  1. Issue an OMX_IndexConfigMetadataItem query with
    • eSearchMode as OMX_MetadataSearchNextItemByKey
    • nScopeSpecifier as the parent node (start with OMX_ALL)
    • nScopeMode as OMX_MetadataScopeNodeLevel
    • nKey set to the text of the node name.
    • {nKeySizeUsed} set to the length of the node name text.
    Obtain the nMetadataItemIndex for this node.
  2. Repeat step 1 for each level of the query, amending nScopeSpecifier to be the value of nMetadataItemIndex from the previous query.

When each level of the metadata specifiers have been followed, the resulting metadata value should be in nValue, and the length in nValueSize.

As an alternative where the metadata for the currently selected stream is on a specific port, nScopeSpecifier can be set to OMX_MetadataScopePortLevel, nScopeSpecifier set to the port number to which the metadata key refers, and nKey / nKeySize set appropriately for the lowest level key name (ie ignoring all the container levels). Assuming the name is unique within the scope of that port, it will return the metadata information for the currently-selected stream on the specified port (assuming the component supports port streams, and a stream is selected).