Skip to content

Add a user data pointer to Dav1dDataProps

Michael Bradshaw requested to merge mjbshaw/dav1d:data into master

See #59 (closed) for some past discussion.

I need to track extra per-picture information (i.e., which adaptive stream a packet is from, metadata about that stream, etc.). I could do this using the timestamp or offset fields of Dav1dDataProps, but that requires maintaining extra data structures and manually looking up the metadata based on the timestamp or offset fields.

I believe my needs are not unique; many players will likely need to track extra per-picture metadata. Adding a single catch-all pointer to Dav1dDataProps is the simplest way to accomplish this.

This could make some of Dav1dDataProps's existing fields obsolete (as the user could define their own struct with just the fields they need, and store that in the user_data). I have kept the existing fields because some (if not all) of them are universally needed (e.g., timestamp, and probably duration). Integrating Dav1d into a player is simpler with them present. (I personally have no need for offset or size, but I can imagine scenarios in which they would be commonly useful.)

Merge request reports