]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/motionblur.c
FourCC fiesta.
[vlc] / modules / video_filter / motionblur.c
index dade402d89df13cb1a0165e9c875e491dc3afea3..6bf0401c6159c8a59bd68f579d65fff59175f308 100644 (file)
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
 #include <vlc_vout.h>
 #include <vlc_filter.h>
+#include "filter_picture.h"
 
 /*****************************************************************************
  * Local protypes
@@ -55,22 +56,22 @@ static int MotionBlurCallback( vlc_object_t *, char const *,
 
 #define FILTER_PREFIX "blur-"
 
-vlc_module_begin();
-    set_shortname( _("Motion blur") );
-    set_description( _("Motion blur filter") );
-    set_capability( "video filter2", 0 );
-    set_category( CAT_VIDEO );
-    set_subcategory( SUBCAT_VIDEO_VFILTER );
+vlc_module_begin ()
+    set_shortname( N_("Motion blur") )
+    set_description( N_("Motion blur filter") )
+    set_capability( "video filter2", 0 )
+    set_category( CAT_VIDEO )
+    set_subcategory( SUBCAT_VIDEO_VFILTER )
 
     add_integer_with_range( FILTER_PREFIX "factor", 80, 1, 127, NULL,
                             FACTOR_TEXT, FACTOR_LONGTEXT, false );
 
-    add_shortcut( "blur" );
+    add_shortcut( "blur" )
 
-    set_callbacks( Create, Destroy );
-vlc_module_end();
+    set_callbacks( Create, Destroy )
+vlc_module_end ()
 
-static const char *ppsz_filter_options[] = {
+static const char *const ppsz_filter_options[] = {
     "factor", NULL
 };
 
@@ -95,10 +96,7 @@ static int Create( vlc_object_t *p_this )
     /* 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;
 
@@ -129,17 +127,6 @@ static void Destroy( vlc_object_t *p_this )
     free( p_filter->p_sys );
 }
 
-#define RELEASE( pic ) \
-        if( pic ->pf_release ) \
-            pic ->pf_release( pic );
-
-#define INITPIC( dst, src ) \
-    dst ->date = src ->date; \
-    dst ->b_force = src ->b_force; \
-    dst ->i_nb_fields = src ->i_nb_fields; \
-    dst ->b_progressive = src->b_progressive; \
-    dst ->b_top_field_first = src ->b_top_field_first;
-
 /*****************************************************************************
  * Filter
  *****************************************************************************/
@@ -150,14 +137,12 @@ 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" );
-        RELEASE( p_pic );
+        picture_Release( p_pic );
         return NULL;
     }
-    INITPIC( p_outpic, p_pic );
 
     if( !p_sys->pp_planes )
     {
@@ -178,8 +163,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     RenderBlur( p_sys, p_pic, p_outpic );
     Copy( p_filter, p_outpic );
 
-    RELEASE( p_pic );
-    return p_outpic;
+    return CopyInfoAndRelease( p_outpic, p_pic );
 }
 
 /*****************************************************************************