Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tvservice: Enhance callback mechanism #162

Merged
merged 2 commits into from
Apr 7, 2014

Conversation

julianscheel
Copy link
Contributor

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.

In some circumstances an application may register multiple callback instances
using the same function pointer but differerent data context. To allow proper
unregister of these callbacks add a new method which checks for function
pointer and data pointer before removal.

Signed-off-by: Julian Scheel <julian@jusst.de>
A maximum callback count of 2 might be too low for some usecases.

Signed-off-by: Julian Scheel <julian@jusst.de>
@popcornmix
Copy link
Contributor

Looks fine. I has been meaning to increase the number of callbacks. 2 always seemed a bit mean...

popcornmix added a commit that referenced this pull request Apr 7, 2014
tvservice: Enhance callback mechanism
@popcornmix popcornmix merged commit 15b6996 into raspberrypi:master Apr 7, 2014
popcornmix pushed a commit to raspberrypi/firmware that referenced this pull request Apr 7, 2014
popcornmix pushed a commit to Hexxeh/rpi-firmware that referenced this pull request Apr 7, 2014
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this pull request Feb 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants