]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/mosaic.c
Add m2ts and mts to the interface dialog selectors.
[vlc] / modules / video_filter / mosaic.c
index dd1ac06c074a413dba7e1d39430fa3649b9b32df..379b25ed12f7d62391cf539873068b649e677673 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 <math.h>
@@ -162,20 +163,20 @@ enum
 {
     position_auto = 0, position_fixed = 1, position_offsets = 2
 };
-static int pi_pos_values[] = { 0, 1, 2 };
-static const char *ppsz_pos_descriptions[] =
+static const int pi_pos_values[] = { 0, 1, 2 };
+static const char *const ppsz_pos_descriptions[] =
     { N_("auto"), N_("fixed"), N_("offsets") };
 
-static int pi_align_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
-static const char *ppsz_align_descriptions[] =
+static const int pi_align_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
+static const char *const ppsz_align_descriptions[] =
      { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
      N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
 
 #define CFG_PREFIX "mosaic-"
 
 vlc_module_begin();
-    set_description( _("Mosaic video sub filter") );
-    set_shortname( _("Mosaic") );
+    set_description( N_("Mosaic video sub filter") );
+    set_shortname( N_("Mosaic") );
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_SUBPIC);
     set_capability( "sub filter", 0 );
@@ -228,7 +229,7 @@ vlc_module_begin();
                  false );
 vlc_module_end();
 
-static const char *ppsz_filter_options[] = {
+static const char *const ppsz_filter_options[] = {
     "alpha", "height", "width", "align", "xoffset", "yoffset",
     "borderw", "borderh", "position", "rows", "cols",
     "keep-aspect-ratio", "keep-picture", "order", "offsets",
@@ -283,7 +284,7 @@ static int CreateFilter( vlc_object_t *p_this )
     filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
     vlc_object_t *p_libvlc = VLC_OBJECT( p_filter->p_libvlc );
-    char *psz_order;
+    char *psz_order, *_psz_order;
     char *psz_offsets;
     int i_index;
     vlc_value_t val;
@@ -294,14 +295,11 @@ static int CreateFilter( vlc_object_t *p_this )
     /* Allocate structure */
     p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
     if( p_sys == NULL )
-    {
-        msg_Err( p_filter, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     p_filter->pf_sub_filter = Filter;
 
-    vlc_mutex_init( p_filter, &p_sys->lock );
+    vlc_mutex_init( &p_sys->lock );
     vlc_mutex_lock( &p_sys->lock );
 
     var_Create( p_libvlc, "mosaic-lock", VLC_VAR_MUTEX );
@@ -349,6 +347,7 @@ static int CreateFilter( vlc_object_t *p_this )
     p_sys->i_order_length = 0;
     p_sys->ppsz_order = NULL;
     psz_order = var_CreateGetStringCommand( p_filter, CFG_PREFIX "order" );
+    _psz_order = psz_order;
     var_AddCallback( p_filter, CFG_PREFIX "order", MosaicCallback, p_sys );
 
     if( *psz_order )
@@ -368,12 +367,15 @@ static int CreateFilter( vlc_object_t *p_this )
         p_sys->i_order_length = i_index;
     }
 
+    free( _psz_order );
+
     /* Manage specific offsets for substreams */
     psz_offsets = var_CreateGetStringCommand( p_filter, CFG_PREFIX "offsets" );
     p_sys->i_offsets_length = 0;
     p_sys->pi_x_offsets = NULL;
     p_sys->pi_y_offsets = NULL;
     mosaic_ParseSetOffsets( p_filter, p_sys, psz_offsets );
+    free( psz_offsets );
     var_AddCallback( p_filter, CFG_PREFIX "offsets", MosaicCallback, p_sys );
 
     vlc_mutex_unlock( &p_sys->lock );
@@ -424,7 +426,7 @@ static void MosaicReleasePicture( picture_t *p_picture )
 {
     picture_t *p_original_pic = (picture_t *)p_picture->p_sys;
 
-    p_original_pic->pf_release( p_original_pic );
+    picture_Release( p_original_pic );
 }
 
 /*****************************************************************************
@@ -446,11 +448,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
     subpicture_region_t *p_region_prev = NULL;
 
     /* Allocate the subpicture internal data. */
-    p_spu = p_filter->pf_sub_buffer_new( p_filter );
+    p_spu = filter_NewSubpicture( p_filter );
     if( !p_spu )
-    {
         return NULL;
-    }
 
     /* Initialize subpicture */
     p_spu->i_channel = 0;
@@ -544,14 +544,14 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
             if ( p_es->p_picture->p_next != NULL )
             {
                 picture_t *p_next = p_es->p_picture->p_next;
-                p_es->p_picture->pf_release( p_es->p_picture );
+                picture_Release( p_es->p_picture );
                 p_es->p_picture = p_next;
             }
             else if ( p_es->p_picture->date + p_sys->i_delay + BLANK_DELAY <
                         date )
             {
                 /* Display blank */
-                p_es->p_picture->pf_release( p_es->p_picture );
+                picture_Release( p_es->p_picture );
                 p_es->p_picture = NULL;
                 p_es->pp_last = &p_es->p_picture;
                 break;
@@ -631,7 +631,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         else
         {
             p_converted = p_es->p_picture;
-            p_converted->i_refcount++;
+            picture_Yield( p_converted );
             fmt_in.i_width = fmt_out.i_width = p_converted->format.i_width;
             fmt_in.i_height = fmt_out.i_height = p_converted->format.i_height;
             fmt_in.i_chroma = fmt_out.i_chroma = p_converted->format.i_chroma;