]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/opencv_example.cpp
Fixed RSS text positionning (close #3115).
[vlc] / modules / video_filter / opencv_example.cpp
index 3d899e55d3e315ef063acc5e413b6e211be1d71e..4f1f08751484f8b6af9ad7d19c90ba9e0dc64773 100644 (file)
@@ -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))))
             {