]> git.sesse.net Git - vlc/blobdiff - modules/video_chroma/grey_yuv.c
macosx: Update progress dialog on the main thread, make check thread safe
[vlc] / modules / video_chroma / grey_yuv.c
index 4cfd11ac890105a7c6fae3be2d57d41c8a52a90b..d76eb880030b03a337592d6b5b4cbbe48b0208ac 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
  * grey_yuv.c : grayscale to others conversion module for vlc
  *****************************************************************************
- * Copyright (C) 2007, 2008 the VideoLAN team
+ * Copyright (C) 2007, 2008 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Sam Hocevar <sam@zoy.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,7 +32,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_filter.h>
-#include <vlc_vout.h>
 
 #define SRC_FOURCC  "GREY"
 #define DEST_FOURCC "I420,YUY2"
@@ -45,14 +44,17 @@ static int  Activate ( vlc_object_t * );
 static void GREY_I420( filter_t *, picture_t *, picture_t * );
 static void GREY_YUY2( filter_t *, picture_t *, picture_t * );
 
+static picture_t *GREY_I420_Filter( filter_t *, picture_t * );
+static picture_t *GREY_YUY2_Filter( filter_t *, picture_t * );
+
 /*****************************************************************************
  * Module descriptor.
  *****************************************************************************/
-vlc_module_begin();
-    set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) );
-    set_capability( "chroma", 80 );
-    set_callbacks( Activate, NULL );
-vlc_module_end();
+vlc_module_begin ()
+    set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) )
+    set_capability( "video filter2", 80 )
+    set_callbacks( Activate, NULL )
+vlc_module_end ()
 
 /*****************************************************************************
  * Activate: allocate a chroma function
@@ -69,18 +71,21 @@ static int Activate( vlc_object_t *p_this )
         return -1;
     }
 
+    if( p_filter->fmt_in.video.i_width != p_filter->fmt_out.video.i_width
+       || p_filter->fmt_in.video.i_height != p_filter->fmt_out.video.i_height
+       || p_filter->fmt_in.video.orientation != p_filter->fmt_out.video.orientation )
+        return -1;
+
     switch( p_filter->fmt_in.video.i_chroma )
     {
-        case VLC_FOURCC('Y','8','0','0'):
-            p_filter->fmt_in.video.i_chroma = VLC_FOURCC('G','R','E','Y');
-        case VLC_FOURCC('G','R','E','Y'):
+        case VLC_CODEC_GREY:
             switch( p_filter->fmt_out.video.i_chroma )
             {
-                case VLC_FOURCC('I','4','2','0'):
-                    p_filter->pf_video_filter_io = GREY_I420;
+                case VLC_CODEC_I420:
+                    p_filter->pf_video_filter = GREY_I420_Filter;
                     break;
-                case VLC_FOURCC('Y','U','Y','2'):
-                    p_filter->pf_video_filter_io = GREY_YUY2;
+                case VLC_CODEC_YUYV:
+                    p_filter->pf_video_filter = GREY_YUY2_Filter;
                     break;
                 default:
                     return -1;
@@ -94,6 +99,9 @@ static int Activate( vlc_object_t *p_this )
     return 0;
 }
 
+VIDEO_FILTER_WRAPPER( GREY_I420 )
+VIDEO_FILTER_WRAPPER( GREY_YUY2 )
+
 /* Following functions are local */
 
 /*****************************************************************************