Access and Update Variables & structures used in plugin from outside the plugin

This forum is about all development around libVLC.
anubhavrohatgi
New Cone
New Cone
Posts: 1
Joined: 22 Jan 2020 08:19

Access and Update Variables & structures used in plugin from outside the plugin

Postby anubhavrohatgi » 22 Jan 2020 08:23

I am building a vlc player with custom events and variables defined in VLC plugins:

Best example of this is opencv_example.cpp which takes in VIDEO_FILTER_EVENT_VARIABLE and sends it using a var_TriggerCallback().

How I am supposed to get and update the value of this variable from an external method as :

Code: Select all

void doThreading(libvlc_media_player_t *mp) { int c =0; while (mp!=nullptr) { // printf("\nNot Nulll...............%i\n",mp->state); printf("\nCurrent State opencv_process : %d\n",var_InheritBool(mp,"opencv-activate-process")); if(c % 40 == 0){ //This is where I want to update the value of this opencv-activate-process //variable. This is a simple variable which usually is accessible in advanced //settings of opencv plugin, settings page var_ToggleBool(mp,"opencv-activate-process"); } //--------------------------------------------------------------- //I want to access the VIDEO_FILTER_EVENT_VARIABLE here //-------------------------------------------------------------- ++c; } } int main(int argc, char* argv[]) { libvlc_instance_t * inst; libvlc_media_player_t *mp; libvlc_media_t *m; char const *vlc_argv[] = { // Apply a video filter. "--reset-plugins-cache", "--video-filter", "ocv_main", "--opencv-chroma=RGB32", "--opencv-activation-password=anubhav", "--opencv-activate-process", "--opencv-output=processed" }; int vlc_argc = sizeof(vlc_argv) / sizeof(*vlc_argv); /* Load the VLC engine */ inst = libvlc_new(vlc_argc,vlc_argv); /* Create a new item */ m = libvlc_media_new_path (inst, "/home/anubhav/Videos/obamaFace.mp4"); /* Create a media player playing environement */ mp = libvlc_media_player_new_from_media (m); libvlc_video_set_key_input(mp, false); libvlc_video_set_mouse_input(mp, true); /* No need to keep the media now */ libvlc_media_release (m); /* play the media_player */ libvlc_media_player_play (mp); std::thread t1(doThreading, std::ref(mp)); sleep (10); /* Let it play a bit */ /* Stop playing */ libvlc_media_player_stop (mp); /* Free the media_player */ libvlc_media_player_release (mp); // libvlc_module_description_list_release(ls); libvlc_release (inst); return 0; }
I have commented where I would like to use and access the variables. All the variables from plugins need to be available for update in doThreading().

Also note :

Variable --opencv-activate-process is declared at plugin side as :

Code: Select all

add_bool("opencv-activate-process", false, N_("Activate OpenCV4 Process"), N_("Enables the frame processing through OpenCV4"),true);
I am able to access its value from another thread but how do I modify this value. What is the correct method to do this?
e.g. how I am accessing a variable:

Code: Select all

qDebug()<<"***********Current State of opencv_process : "<<var_InheritBool(p_mp,"opencv-activate-process");

Any idea?

I can provide more details if required.

Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 20 guests