]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/colorthres.c
1.0.0-pre2: RC1 shouldn't be far away, is it?
[vlc] / modules / video_filter / colorthres.c
index 67ddf2429b83aca4c26a0c88c25ec6588218c448..ed3da46ca5a19f52643a250d9352361b49deb793 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <errno.h>
-#include <math.h>
 
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#include <errno.h>
+#include <math.h>
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
@@ -63,21 +64,21 @@ static const char *const ppsz_color_descriptions[] = {
 
 #define CFG_PREFIX "colorthres-"
 
-vlc_module_begin();
-    set_description( N_("Color threshold filter") );
-    set_shortname( N_("Color threshold" ));
-    set_category( CAT_VIDEO );
-    set_subcategory( SUBCAT_VIDEO_VFILTER );
-    set_capability( "video filter2", 0 );
+vlc_module_begin ()
+    set_description( N_("Color threshold filter") )
+    set_shortname( N_("Color threshold" ))
+    set_category( CAT_VIDEO )
+    set_subcategory( SUBCAT_VIDEO_VFILTER )
+    set_capability( "video filter2", 0 )
     add_integer( CFG_PREFIX "color", 0x00FF0000, NULL, COLOR_TEXT,
-                 COLOR_LONGTEXT, false );
-        change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
+                 COLOR_LONGTEXT, false )
+        change_integer_list( pi_color_values, ppsz_color_descriptions, NULL )
     add_integer( CFG_PREFIX "saturationthres", 20, NULL,
-                 _("Saturaton threshold"), "", false );
+                 N_("Saturaton threshold"), "", false )
     add_integer( CFG_PREFIX "similaritythres", 15, NULL,
-                 _("Similarity threshold"), "", false );
-    set_callbacks( Create, Destroy );
-vlc_module_end();
+                 N_("Similarity threshold"), "", false )
+    set_callbacks( Create, Destroy )
+vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
     "color", "saturationthes", "similaritythres", NULL
@@ -118,17 +119,14 @@ static int Create( vlc_object_t *p_this )
 
     config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
-    var_CreateGetIntegerCommand( p_filter, CFG_PREFIX "color" );
-    var_CreateGetIntegerCommand( p_filter, CFG_PREFIX "similaritythres" );
-    var_CreateGetIntegerCommand( p_filter, CFG_PREFIX "saturationthres" );
+    var_Create( p_filter, CFG_PREFIX "color", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
+    var_Create( p_filter, CFG_PREFIX "similaritythres", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
+    var_Create( p_filter, CFG_PREFIX "saturationthes", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
 
     /* Allocate structure */
     p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
     if( p_filter->p_sys == NULL )
-    {
-        msg_Err( p_filter, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     p_filter->pf_video_filter = Filter;
 
@@ -164,12 +162,10 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     if( !p_pic ) return NULL;
 
-    p_outpic = p_filter->pf_vout_buffer_new( p_filter );
+    p_outpic = filter_NewPicture( p_filter );
     if( !p_outpic )
     {
-        msg_Warn( p_filter, "can't get output picture" );
-        if( p_pic->pf_release )
-            p_pic->pf_release( p_pic );
+        picture_Release( p_pic );
         return NULL;
     }