Programmatically requiring module of cap "video filter2"

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

Programmatically requiring module of cap "video filter2"

Postby Vaselinessa » 28 Sep 2012 21:11

I'm trying to require a video filter module from an interface module.
  • Is there a better function for this than module_need? (I have tried to understand alternatives. See notes *)
  • What callback trigger is appropriate for triggering said function? (I have made attempts. See notes **)
  • Had I better module_unneed the filter module at any time?
TMI:

* I have looked at the possibility of using filter_chain_AppendFilter or a related function, but I don't see how to get a hold of the pointer to the current video filter chain. Any instruction is welcome.

** I tried attaching attaching a callback to the playlist using var_AddCallback( p_playlist, "item-current", PlaylistChangeCallback, p_intf ), then in the callback requiring the video filter module if playlist_CurrentInput( p_playlist ) returned a valid pointer, but that appears to be insufficient: when the video filter module opens, it holds an unrecognizeable input chroma code. This problem does not arise when I load the filter with a command line option (--video-filter my_video_filter). When I use the command line option, the input chroma is x30323449, whereas it is x5 when I use module_need in the callback function described above.

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

Re: Programmatically requiring module of cap "video filter2"

Postby Rémi Denis-Courmont » 28 Sep 2012 21:52

If you use module_need(), you are responsible for initializing the structure. module_need() does no magic whatsoever, the capability string is just a token.

filter_chain_AppendFilter() is probably better if you want to chain multiple filters. You will of course need to create your own filter chain first,
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Vaselinessa
Blank Cone
Blank Cone
Posts: 48
Joined: 03 Apr 2011 02:26
Location: Sacramento, CA

Re: Programmatically requiring module of cap "video filter2"

Postby Vaselinessa » 28 Sep 2012 23:20

Thanks, Remi.

Can you (or anyone) tell me what the owner (p_this) arg of filter_chain_New should be?

(If it can be just any vlc_object_t*, then is there a function which I must call to ensure that my filter chain be applied to the video output stream?)

(if the owner must be the output stream itself, can you say how I can request a pointer to it from my interface module?)

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

Re: Programmatically requiring module of cap "video filter2"

Postby Rémi Denis-Courmont » 29 Sep 2012 09:21

I don't think you can push a filter chain into the video output externally.

For that, you'd need to change the video-filter object variable on the video output object.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Vaselinessa
Blank Cone
Blank Cone
Posts: 48
Joined: 03 Apr 2011 02:26
Location: Sacramento, CA

Re: Programmatically requiring module of cap "video filter2"

Postby Vaselinessa » 30 Sep 2012 03:09

Thanks, Remi. If I have interpreted your last instruction correctly, I am to make concern myself with the filter chain pointer on a vout_thread_t:

Code: Select all

p_vout->p->filter.chain_interactive
Therefore, I am looking for a callback that will fire when the current input is ready with a vout_thread_t, but I don't see a callback that will work. I tried to use:

Code: Select all

var_AddCallback( p_playlist, "item-current", PlaylistChangeCallback, p_intf );
...but when it fired, no vout thread existed on the current input thread.
I also tried adding the following in my PlaylistChangeCallback function:

Code: Select all

var_AddCallback( p_input, "state", InputChangeCallback, p_data );
...but this callback seems not to fire when the video begins. I can only get it to fire when play/pause happens.

Do you (or does anybody) know of a callback that will work?

Vaselinessa
Blank Cone
Blank Cone
Posts: 48
Joined: 03 Apr 2011 02:26
Location: Sacramento, CA

Re: Programmatically requiring module of cap "video filter2"

Postby Vaselinessa » 01 Oct 2012 17:12

What I have tried latest is attaching a callback to the playlist's "item-change" event, using it to check for a vout, then removing that callback as soon as a vout is available. However, I may have constructed the deletion of the callback incorrectly, but the player stops painting the video, and the application won't close correctly.

Is the problem that I'm trying to delete the callback while it's firing?

Code: Select all

static int InputChangeCallback( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { // Add callback to item-change var_AddCallback( p_playlist, "item-change", ItemChangeCallback, NULL ); //needs to be added elsewhere return 0; } static int ItemChangeCallback( vlc_object_t *p_this, const char *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { if (p_input) { // p_input is a global var // Get vout threads on curren tinput size_t n_vout; vout_thread_t **pp_vout; input_Control( p_input, INPUT_GET_VOUTS, &pp_vout, &n_vout ); if (n_vout) { // Unattach this callback from playlist var_DelCallback( p_playlist, "item-change", ItemChangeCallback, NULL ); } } return 0; }


Return to “Development around libVLC”

Who is online

Users browsing this forum: Google [Bot] and 14 guests