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;
}
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);
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.