X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fopencv_example.cpp;h=76b86659fd69e661a94c9a1e0321859f5f2a2a07;hb=80aa55bbf7dcd15af07aadb374f9e867f74fdf5e;hp=66ff608164f756351aa09569e2180c0d2234824a;hpb=6ee1e193fd896ab9a4729fde14f009d9ce629815;p=vlc diff --git a/modules/video_filter/opencv_example.cpp b/modules/video_filter/opencv_example.cpp index 66ff608164..76b86659fd 100644 --- a/modules/video_filter/opencv_example.cpp +++ b/modules/video_filter/opencv_example.cpp @@ -30,8 +30,12 @@ #include -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include #include #include "filter_common.h" #include @@ -60,8 +64,8 @@ static picture_t *Filter( filter_t *, picture_t * ); * Module descriptor *****************************************************************************/ vlc_module_begin(); - set_description( _("OpenCV face detection example filter") ); - set_shortname( _( "OpenCV example" )); + set_description( N_("OpenCV face detection example filter") ); + set_shortname( N_( "OpenCV example" )); set_capability( "opencv example", 1 ); add_shortcut( "opencv_example" ); @@ -71,7 +75,7 @@ vlc_module_begin(); add_string( "opencv-haarcascade-file", "c:\\haarcascade_frontalface_alt.xml", NULL, N_("Haar cascade filename"), - N_("Name of XML file containing Haar cascade description"), VLC_FALSE); + N_("Name of XML file containing Haar cascade description"), false); vlc_module_end(); /***************************************************************************** @@ -86,8 +90,7 @@ static int OpenFilter( vlc_object_t *p_this ) if( ( p_filter->p_sys = p_sys = (filter_sys_t *)malloc(sizeof(filter_sys_t)) ) == NULL ) { - msg_Err( p_filter, "out of memory" ); - return VLC_EGENERIC; + return VLC_ENOMEM; } //init the video_filter_event_info_t struct @@ -110,6 +113,7 @@ static int OpenFilter( vlc_object_t *p_this ) char* filename = config_GetPsz( p_filter, "opencv-haarcascade-file" ); p_filter->p_sys->p_cascade = (CvHaarClassifierCascade*)cvLoad( filename, 0, 0, 0 ); p_filter->p_sys->p_storage = cvCreateMemStorage(0); + free( filename ); return VLC_SUCCESS; } @@ -202,7 +206,6 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) if( NULL == ( p_filter->p_sys->event_info.p_region = (video_filter_region_info_t *)malloc(faces->total*sizeof(video_filter_region_info_t)))) { - msg_Err( p_filter, "out of memory" ); return NULL; } memset(p_filter->p_sys->event_info.p_region, 0, faces->total*sizeof(video_filter_region_info_t));