]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/croppadd.c
macosx: delay start in fullscreen animation to allow to finish resize animation befor...
[vlc] / modules / video_filter / croppadd.c
index 3f17320787f6f64e9268a9ae87119c2844a68fc3..b4f2f2d5cebc9261b74e7a32beae42787ae53033 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
  * croppadd.c: Crop/Padd image filter
  *****************************************************************************
- * Copyright (C) 2008 the VideoLAN team
+ * Copyright (C) 2008 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Antoine Cellerier <dionoea @t videolan dot org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -32,8 +32,7 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_vout.h>
-#include "vlc_filter.h"
+#include <vlc_filter.h>
 #include "filter_picture.h"
 
 /****************************************************************************
@@ -75,31 +74,35 @@ static picture_t *Filter( filter_t *, picture_t * );
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-vlc_module_begin();
-    set_description( N_("Video scaling filter") );
-    set_capability( "video filter2", 0 );
-    set_callbacks( OpenFilter, CloseFilter );
-
-    set_section( N_("Crop"), NULL );
-        add_integer_with_range( CFG_PREFIX "croptop", 0, 0, INT_MAX, NULL,
-                                CROPTOP_TEXT, CROPTOP_LONGTEXT, false );
-        add_integer_with_range( CFG_PREFIX "cropbottom", 0, 0, INT_MAX, NULL,
-                                CROPBOTTOM_TEXT, CROPBOTTOM_LONGTEXT, false );
-        add_integer_with_range( CFG_PREFIX "cropleft", 0, 0, INT_MAX, NULL,
-                                CROPLEFT_TEXT, CROPLEFT_LONGTEXT, false );
-        add_integer_with_range( CFG_PREFIX "cropright", 0, 0, INT_MAX, NULL,
-                                CROPRIGHT_TEXT, CROPRIGHT_LONGTEXT, false );
-
-    set_section( N_("Padd"), NULL );
-        add_integer_with_range( CFG_PREFIX "paddtop", 0, 0, INT_MAX, NULL,
-                                PADDTOP_TEXT, PADDTOP_LONGTEXT, false );
-        add_integer_with_range( CFG_PREFIX "paddbottom", 0, 0, INT_MAX, NULL,
-                                PADDBOTTOM_TEXT, PADDBOTTOM_LONGTEXT, false );
-        add_integer_with_range( CFG_PREFIX "paddleft", 0, 0, INT_MAX, NULL,
-                                PADDLEFT_TEXT, PADDLEFT_LONGTEXT, false );
-        add_integer_with_range( CFG_PREFIX "paddright", 0, 0, INT_MAX, NULL,
-                                PADDRIGHT_TEXT, PADDRIGHT_LONGTEXT, false );
-vlc_module_end();
+vlc_module_begin ()
+    set_shortname( N_("Cropadd") )
+    set_description( N_("Video scaling filter") )
+    set_capability( "video filter2", 0 )
+    set_callbacks( OpenFilter, CloseFilter )
+
+    set_category( CAT_VIDEO )
+    set_subcategory( SUBCAT_VIDEO_VFILTER );
+
+    set_section( N_("Crop"), NULL )
+        add_integer_with_range( CFG_PREFIX "croptop", 0, 0, INT_MAX,
+                                CROPTOP_TEXT, CROPTOP_LONGTEXT, false )
+        add_integer_with_range( CFG_PREFIX "cropbottom", 0, 0, INT_MAX,
+                                CROPBOTTOM_TEXT, CROPBOTTOM_LONGTEXT, false )
+        add_integer_with_range( CFG_PREFIX "cropleft", 0, 0, INT_MAX,
+                                CROPLEFT_TEXT, CROPLEFT_LONGTEXT, false )
+        add_integer_with_range( CFG_PREFIX "cropright", 0, 0, INT_MAX,
+                                CROPRIGHT_TEXT, CROPRIGHT_LONGTEXT, false )
+
+    set_section( N_("Padd"), NULL )
+        add_integer_with_range( CFG_PREFIX "paddtop", 0, 0, INT_MAX,
+                                PADDTOP_TEXT, PADDTOP_LONGTEXT, false )
+        add_integer_with_range( CFG_PREFIX "paddbottom", 0, 0, INT_MAX,
+                                PADDBOTTOM_TEXT, PADDBOTTOM_LONGTEXT, false )
+        add_integer_with_range( CFG_PREFIX "paddleft", 0, 0, INT_MAX,
+                                PADDLEFT_TEXT, PADDLEFT_LONGTEXT, false )
+        add_integer_with_range( CFG_PREFIX "paddright", 0, 0, INT_MAX,
+                                PADDRIGHT_TEXT, PADDRIGHT_LONGTEXT, false )
+vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
     "croptop", "cropbottom", "cropleft", "cropright",
@@ -215,10 +218,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     if( !p_pic ) return NULL;
 
     /* Request output picture */
-    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" );
         picture_Release( p_pic );
         return NULL;
     }
@@ -264,7 +266,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         p_in += i_ycrop * p_plane->i_pitch;
 
         /* Padd on the top */
-        vlc_memset( p_out, i_padd_color, i_ypadd * p_outplane->i_pitch );
+        memset( p_out, i_padd_color, i_ypadd * p_outplane->i_pitch );
         p_out += i_ypadd * p_outplane->i_pitch;
 
         int i_line;
@@ -277,17 +279,17 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
             p_in += i_xcrop * i_pixel_pitch;
 
             /* Padd on the left */
-            vlc_memset( p_out, i_padd_color, i_xpadd * i_pixel_pitch );
+            memset( p_out, i_padd_color, i_xpadd * i_pixel_pitch );
             p_out += i_xpadd * i_pixel_pitch;
 
             /* Copy the image and crop on the right */
-            vlc_memcpy( p_out, p_in, i_width * i_pixel_pitch );
+            memcpy( p_out, p_in, i_width * i_pixel_pitch );
             p_out += i_width * i_pixel_pitch;
             p_in += i_width * i_pixel_pitch;
 
             /* Padd on the right */
-            vlc_memset( p_out, i_padd_color,
-                        ( i_outwidth - i_width ) * i_pixel_pitch );
+            memset( p_out, i_padd_color,
+                        ( i_outwidth - i_xpadd - i_width ) * i_pixel_pitch );
 
             /* Got to begining of the next line */
             p_in = p_in_next;
@@ -295,7 +297,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         }
 
         /* Padd on the bottom */
-        vlc_memset( p_out, i_padd_color,
+        memset( p_out, i_padd_color,
                  ( i_outheight - i_ypadd - i_height ) * p_outplane->i_pitch );
     }