X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fopencv_example.cpp;h=4f1f08751484f8b6af9ad7d19c90ba9e0dc64773;hb=0648b216b13e2dd3ac985ffb737f887a0cc3f446;hp=3d899e55d3e315ef063acc5e413b6e211be1d71e;hpb=14f37b2101842fa6e427f962f689db74eff6faba;p=vlc diff --git a/modules/video_filter/opencv_example.cpp b/modules/video_filter/opencv_example.cpp index 3d899e55d3..4f1f087514 100644 --- a/modules/video_filter/opencv_example.cpp +++ b/modules/video_filter/opencv_example.cpp @@ -111,7 +111,7 @@ static int OpenFilter( vlc_object_t *p_this ) msg_Err( p_filter, "Could not set %s", VIDEO_FILTER_EVENT_VARIABLE); //OpenCV init specific to this example - char* filename = config_GetPsz( p_filter, "opencv-haarcascade-file" ); + char* filename = var_InheritString( 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 ); @@ -133,9 +133,7 @@ static void CloseFilter( vlc_object_t *p_this ) if( p_filter->p_sys->p_storage ) cvReleaseMemStorage( &p_filter->p_sys->p_storage ); - if (NULL != p_filter->p_sys->event_info.p_region) - free(p_filter->p_sys->event_info.p_region); - + free( p_filter->p_sys->event_info.p_region ); free( p_sys ); var_Destroy( p_filter->p_libvlc, VIDEO_FILTER_EVENT_VARIABLE); @@ -199,11 +197,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) if (faces && (faces->total > 0)) { //msg_Dbg( p_filter, "Found %d face(s)", faces->total ); - if (NULL != p_filter->p_sys->event_info.p_region) - { - free(p_filter->p_sys->event_info.p_region); - p_filter->p_sys->event_info.p_region = NULL; - } + free( p_filter->p_sys->event_info.p_region ); + p_filter->p_sys->event_info.p_region = NULL; if( NULL == ( p_filter->p_sys->event_info.p_region = (video_filter_region_info_t *)malloc(faces->total*sizeof(video_filter_region_info_t)))) {