mmr_event_data_set()

Updated: April 19, 2023

Set user data for the dictionary returned with the last event

Synopsis:

#include <mm/renderer/events.h>
int mmr_event_data_set(mmr_context_t *ctxt,
                       void *usrdata)

Arguments:

ctxt
A context handle
usrdata
A pointer to the user data to associate with the dictionary

Library:

mmrndclient

Description:

Set user data to associate with the dictionary returned with the last event. The dictionary contains all of the mm-renderer properties reported by this event and gets stored in the data field of the mmr_event_t structures returned for subsequent events.

Note:

This function is thread-safe only when using different context handles in each call. It's neither interrupt handler-safe nor signal-handler safe.

Some event types, including STATE, ERROR, and WARNING, share a single dictionary and therefore have a common user data pointer. So, if you set the user data after receiving, say, a STATE event, the same user data pointer is returned with any subsequent STATE, ERROR, or WARNING event.

Other event types, including METADATA, OUTPUT, and TRKPAR, each have multiple dictionaries, distinguished by an index stored in the mmr_event_t details field. So, if you set the user data after receiving, say, a METADATA event with an index of 2, the same user data get returned only for other METADATA events whose index is also 2.

Returns:

Zero on success, or -1 if there is no longer a pending event or the last event was a deletion