[vlc-devel] Open() on a video filter gets called twice...

Peter Tap ptrtap at yahoo.com
Tue May 26 08:48:54 CEST 2015


I have written a video filter module for VLC:

vlc_module_begin ()
  set_category( CAT_VIDEO )
  set_subcategory( SUBCAT_VIDEO_VFILTER )
  set_capability( "video filter2", 0 )
  set_callbacks( OpenVideo, Close )
vlc_module_end ()

In my OpenVideo() routine, I try to obtain the media file currently being played:
intf_thread_t* p_intf = (intf_thread_t*)p_this;
p_sys->p_playlist = pl_Get(p_intf);
p_sys->p_input = playlist_CurrentInput(p_sys->p_playlist);

When I run vlc, it seems OpenVideo() is getting called twice. The first time when the media file is opened and the second time when the running media is stopped. 

When OpenVideo() is called the second time, the call to playlist_CurrentInput() just hangs. I cannot even debug beyond this point as gdb itself returns an error.

Two questions:
1. Why does VLC call OpenVideo() once again when the media file is stopped?
2. For now, I am using a global static counter in my code. The counter gets incremented each time OpenVideo is called. If the counter value is odd, I proceed with my logic. Otherwise, I simply return VLC_EGENERIC. This seems to work. However, I am thinking this is not really good programming. Is there a better way?


More information about the vlc-devel mailing list