Skip to content

Add a user data pointer to Dav1dDataProps (version 2)

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

This is a revised version of !497 (closed).

To be honest, I'm not 100% happy with this. I want to use a void * to store the user data pointer, but using Dav1dRef's free_callback API requires using a function signature that takes a const uint8_t *. That doesn't necessitate storing the user data pointer as a const uint8_t *, but I find it clearer/more consistent to store the pointer using the same type that the function takes.

An alternative approach I considered was an API similar to the Dav1dPicAllocator. In particular, I considered passing the whole Dav1dDataProps to the free_callback. I did not pursue this because it would require an extra malloc for every Dav1dDataProps that holds a user-provided pointer and because doing so was a bit more work.

I'm happy to rework this design based on feedback.

This is an ABI-breaking change.

Merge request reports