mmr_metadata_split()

Updated: October 26, 2022

Get metadata properties of a single track or image inside the input file

Synopsis:

#include <mm/renderer/events.h>
strm_dict_t* mmr_metadata_split(strm_dict_t const *md,
                                const char *type,
                                unsigned idx)

Arguments:

md
A handle to a dictionary containing a complete metadata set read from a METADATA event. The function doesn't consume the handle, so the caller can keep using it afterwards.
type
The media properties to look for in the metadata. For information about audio, video, or subpicture tracks, use audio, video, or subpicture. For artwork, use image.
idx
The zero-based index of the dictionary entry from which to extract metadata. This index corresponds to the input track or image for which you're retrieving properties.

Library:

mmrndclient

Description:

This function examines the metadata set stored in the md dictionary and extracts the properties indicated by type from the entry stored at idx. These properties are parsed into key-value pairs and put into a new dictionary, and a handle to this dictionary is returned.

When you receive a METADATA event through mmr_event_get(), the data field in the returned structure stores a dictionary containing the metadata properties of the attached input or a track referenced by it (e.g., a playlist entry). The dictionary's handle can be passed into mmr_metadata_split() to read properties of audio, video, and subpicture tracks, and artwork inside the input.

The following properties are stored in the new dictionary, based on the value of type:
Type Properties
audio sample_rate, channels, bitrate, fourcc, and lang
image width, height, mime, and type
subpicture Same as for video, except frame_rate isn't present
video frame_rate, bitrate, width, height, pixel_width, pixel_height, fourcc, and lang

For information about reading these values in the dictionary, see the Dictionary Object API reference.

Returns:

A handle to a new dictionary containing the parsed properties on success, or NULL if no metadata properties are found or an error occurs. In the latter case, check errno, which can be one of:
  • ENOENT, if no properties were found
  • EINVAL, if either md or type is a null pointer or has an invalid value
  • ENOMEM, if there's not enough memory