raspberrypi/userland — pull request #162 by julianscheel (2014-04-07 12:39:45+00:00)
Title: tvservice: Enhance callback mechanism

While working on our VLC mmal plugins, which use tvservice to get notified about display mode changes we ran into a small problem:
VLC might create multiple vout instances in parallel of which each one needs to register a callback to get notified about mode changes. The first problem is the limit of 2 callbacks, which may be triggered in this case. The second, even more critical one, is the unregister function which only checks the function pointer for removal of the callback list.
In our case we register the same function pointer multiple times but with different context data each. So when a vout is destroyed we need to ensure that the correct callback is unregistered, which can be done with vc_tv_unregister_callback_full as proposed in this pull requests. It simply takes the data pointer as second argument and requires a match of function and data pointer for removal.