]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/extract.c
Add m2ts and mts to the interface dialog selectors.
[vlc] / modules / video_filter / extract.c
index b3d21fe808f2f5673fc89197e94dbd228fd3ae7a..23716f018307be673ef1697208fab86675144001 100644 (file)
@@ -29,7 +29,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_vout.h>
 
 #include "vlc_filter.h"
@@ -63,28 +64,29 @@ static void get_custom_from_packedyuv422( picture_t *, picture_t *, int * );
 #define COMPONENT_LONGTEXT N_("RGB component to extract. 0 for Red, 1 for Green and 2 for Blue.")
 #define FILTER_PREFIX "extract-"
 
-static int pi_component_values[] = { 0xFF0000, 0x00FF00, 0x0000FF };
-static const char *ppsz_component_descriptions[] = { "Red", "Green", "Blue" };
+static const int pi_component_values[] = { 0xFF0000, 0x00FF00, 0x0000FF };
+static const char *const ppsz_component_descriptions[] = {
+    "Red", "Green", "Blue" };
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
-    set_description( _("Extract RGB component video filter") );
-    set_shortname( _("Extract" ));
+    set_description( N_("Extract RGB component video filter") );
+    set_shortname( N_("Extract" ));
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VFILTER );
     set_capability( "video filter2", 0 );
     add_shortcut( "extract" );
 
     add_integer_with_range( FILTER_PREFIX "component", 0xFF0000, 1, 0xFFFFFF,
-                 NULL, COMPONENT_TEXT, COMPONENT_LONGTEXT, VLC_FALSE );
+                 NULL, COMPONENT_TEXT, COMPONENT_LONGTEXT, false );
         change_integer_list( pi_component_values, ppsz_component_descriptions, 0 );
 
     set_callbacks( Create, Destroy );
 vlc_module_end();
 
-static const char *ppsz_filter_options[] = {
+static const char *const ppsz_filter_options[] = {
     "component", NULL
 };
 
@@ -125,15 +127,11 @@ 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->p_sys->projection_matrix = malloc( 9 * sizeof( int ) );
     if( !p_filter->p_sys->projection_matrix )
     {
         free( p_filter->p_sys );
-        msg_Err( p_filter, "out of memory" );
         return VLC_ENOMEM;
     }
 
@@ -174,12 +172,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;
     }
 
@@ -243,21 +239,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         default:
             msg_Warn( p_filter, "Unsupported input chroma (%4s)",
                       (char*)&(p_pic->format.i_chroma) );
-            if( p_pic->pf_release )
-                p_pic->pf_release( p_pic );
+            picture_Release( p_pic );
             return NULL;
     }
 
-    p_outpic->date = p_pic->date;
-    p_outpic->b_force = p_pic->b_force;
-    p_outpic->i_nb_fields = p_pic->i_nb_fields;
-    p_outpic->b_progressive = p_pic->b_progressive;
-    p_outpic->b_top_field_first = p_pic->b_top_field_first;
-
-    if( p_pic->pf_release )
-        p_pic->pf_release( p_pic );
-
-    return p_outpic;
+    return CopyInfoAndRelease( p_outpic, p_pic );
 }
 
 static inline uint8_t crop( int a )
@@ -771,6 +757,7 @@ static int ExtractCallback( vlc_object_t *p_this, char const *psz_var,
                             vlc_value_t oldval, vlc_value_t newval,
                             void *p_data )
 {
+    VLC_UNUSED(oldval);
     filter_sys_t *p_sys = (filter_sys_t *)p_data;
 
     if( !strcmp( psz_var, FILTER_PREFIX "component" ) )