Remove callback from within same callback

This forum is about all development around libVLC.
Vaselinessa
Blank Cone
Blank Cone
Posts: 48
Joined: 03 Apr 2011 02:26
Location: Sacramento, CA

Remove callback from within same callback

Postby Vaselinessa » 18 Nov 2012 00:13

I wish to remove a callback function after it runs, if a certain condition is met. However, when I call var_DelCallback from within the callback function, the GUI controls freeze up. How can I accomplish my aim?

Details:

My routine adds a filter to a filter_chain on a given vout thread, but I know of no callback that will fire when a vout thread becomes created, so I'm using an "item-change" callback on the playlist. Each time the "item-change" callback fires, I check the input thread for a vout thread, and if a vout thread is available, I would like to remove the "item-change" callback. As stated before, I can't call remove the callback from within the callback itself, however.

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Remove callback from within same callback

Postby Rémi Denis-Courmont » 18 Nov 2012 10:07

var_DelCallback() waits for any pending invocation of the callback to complete. That is necessary as most var_DelCallback() call paths will promptly deallocate resources used by the callback afterward.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 0 guests