]> git.sesse.net Git - vlc/blobdiff - modules/video_chroma/chain.c
Chroma modules now exactly implement the "video filter2" capability.
[vlc] / modules / video_chroma / chain.c
index aa72b96d5c9474d043d20349143e08e359b65308..acbda70e68f465e51fdc4d5ad4587f17470c0306 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * chain.c : chain multiple chroma modules as a last resort solution
  *****************************************************************************
- * Copyright (C) 2007 the VideoLAN team
+ * Copyright (C) 2007-2008 the VideoLAN team
  * $Id$
  *
  * Authors: Antoine Cellerier <dionoea at videolan dot org>
  * Preamble
  *****************************************************************************/
 
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_filter.h>
 #include <vlc_vout.h>
 
 /*****************************************************************************
  *****************************************************************************/
 static int  Activate ( vlc_object_t * );
 static void Destroy  ( vlc_object_t * );
-static void Chain    ( vout_thread_t *, picture_t *, picture_t * );
+static void Chain    ( filter_t *, picture_t *, picture_t * );
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
-    set_description( _("Chroma conversions using a chain of chroma conversion modules") );
-    set_capability( "chroma", 1 );
+    set_description( N_("Chroma conversions using a chain of chroma conversion modules") );
+    set_capability( "video filter2", 1 );
     set_callbacks( Activate, Destroy );
 vlc_module_end();
 
 #define MAX_CHROMAS 2
 
-struct chroma_sys_t
+struct filter_sys_t
 {
     vlc_fourcc_t i_chroma;
 
-    vout_chroma_t chroma1;
-    vout_chroma_t chroma2;
+    filter_t    *p_chroma1;
+    filter_t    *p_chroma2;
 
-    picture_t *p_tmp;
+    picture_t   *p_tmp;
 };
 
 static const vlc_fourcc_t pi_allowed_chromas[] = {
     VLC_FOURCC('I','4','2','0'),
     VLC_FOURCC('I','4','2','2'),
+    VLC_FOURCC('R','V','3','2'),
+    VLC_FOURCC('R','V','2','4'),
     0
 };
 
@@ -69,8 +77,9 @@ static const vlc_fourcc_t pi_allowed_chromas[] = {
  *****************************************************************************/
 static int Activate( vlc_object_t *p_this )
 {
+#if 0
     static int hack = 1;
-    vout_thread_t *p_vout = (vout_thread_t *)p_this;
+    filter_t *p_filter = (filter_t *)p_this;
 
     hack++;
     if( hack > MAX_CHROMAS )
@@ -81,25 +90,25 @@ static int Activate( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    chroma_sys_t *p_sys = (chroma_sys_t *)malloc( sizeof( chroma_sys_t ) );
+    filter_sys_t *p_sys = (filter_sys_t *)malloc( sizeof( filter_sys_t ) );
     if( !p_sys )
     {
         hack--;
         return VLC_ENOMEM;
     }
-    memset( p_sys, 0, sizeof( chroma_sys_t ) );
+    memset( p_sys, 0, sizeof( filter_sys_t ) );
 
     int i;
-    vlc_fourcc_t i_output_chroma = p_vout->output.i_chroma;
-    vlc_fourcc_t i_render_chroma = p_vout->render.i_chroma;
+    vlc_fourcc_t i_output_chroma = p_filter->fmt_in.video.i_chroma;
+    vlc_fourcc_t i_render_chroma = p_filter->fmt_out.video.i_chroma;
 
     for( i = 0; pi_allowed_chromas[i]; i++ )
     {
-        msg_Warn( p_vout, "Trying %4s as a chroma chain",
+        msg_Warn( p_filter, "Trying %4s as a chroma chain",
                   (const char *)&pi_allowed_chromas[i] );
-        p_vout->output.i_chroma = pi_allowed_chromas[i];
-        p_vout->chroma.p_module = module_Need( p_vout, "chroma", NULL, 0 );
-        p_vout->output.i_chroma = i_output_chroma;
+        p_filter->output.i_chroma = pi_allowed_chromas[i];
+        p_filter->p_chroma1.p_module = module_Need( p_vout, "chroma", NULL, 0 );
+        p_filter->output.i_chroma = i_output_chroma;
 
         if( !p_vout->chroma.p_module )
             continue;
@@ -131,15 +140,16 @@ static int Activate( vlc_object_t *p_this )
 
     free( p_sys );
     hack--;
+#endif
     return VLC_EGENERIC;
 }
 
 static void Destroy( vlc_object_t *p_this )
 {
-    vout_thread_t *p_vout = (vout_thread_t *)p_this;
+#if 0
+    filter_t *p_filter = (filter_t *)p_this;
     vout_chroma_t chroma = p_vout->chroma;
 
-
     p_vout->chroma = chroma.p_sys->chroma1;
     module_Unneed( p_vout, p_vout->chroma.p_module );
     p_vout->chroma = chroma.p_sys->chroma2;
@@ -153,14 +163,16 @@ static void Destroy( vlc_object_t *p_this )
     }
     free( chroma.p_sys );
     chroma.p_sys = NULL;
+#endif
 }
 
 /*****************************************************************************
  * Chain
  *****************************************************************************/
-static void Chain( vout_thread_t *p_vout, picture_t *p_source,
+static void Chain( filter_t *p_filter, picture_t *p_source,
                    picture_t *p_dest )
 {
+#if 0
     chroma_sys_t *p_sys = p_vout->chroma.p_sys;
 
     if( !p_sys->p_tmp )
@@ -185,4 +197,5 @@ static void Chain( vout_thread_t *p_vout, picture_t *p_source,
     p_vout->chroma = p_sys->chroma2;
     p_sys->chroma2.pf_convert( p_vout, p_sys->p_tmp, p_dest );
     p_vout->chroma = chroma;
+#endif
 }