]> git.sesse.net Git - vlc/blobdiff - modules/video_filter/mosaic.c
new (failing) test for media list player (ticket #1524)
[vlc] / modules / video_filter / mosaic.c
index babe36f278b31f8add5cdb8e5b5e61e734c7382e..68a77371f4efefe89f8400ec8665f2a62ed8f1ac 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#define _GNU_SOURCE
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-#include <math.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include <vlc/vlc.h>
 #include <vlc_vout.h>
 
-#ifdef HAVE_LIMITS_H
-#   include <limits.h> /* INT_MAX */
-#endif
+#include <math.h>
+#include <limits.h> /* INT_MAX */
 
 #include "vlc_filter.h"
 #include "vlc_image.h"
@@ -202,10 +200,10 @@ vlc_module_begin();
 
     add_integer( CFG_PREFIX "borderw", 0, NULL,
                  BORDERW_TEXT, BORDERW_LONGTEXT, VLC_TRUE );
-        add_deprecated( CFG_PREFIX "vborder", VLC_FALSE );
+        add_deprecated_alias( CFG_PREFIX "vborder" );
     add_integer( CFG_PREFIX "borderh", 0, NULL,
                  BORDERH_TEXT, BORDERH_LONGTEXT, VLC_TRUE );
-        add_deprecated( CFG_PREFIX "hborder", VLC_FALSE );
+        add_deprecated_alias( CFG_PREFIX "hborder" );
 
     add_integer( CFG_PREFIX "position", 0, NULL,
                  POS_TEXT, POS_LONGTEXT, VLC_FALSE );
@@ -228,8 +226,6 @@ vlc_module_begin();
 
     add_integer( CFG_PREFIX "delay", 0, NULL, DELAY_TEXT, DELAY_LONGTEXT,
                  VLC_FALSE );
-
-    var_Create( p_module->p_libvlc_global, "mosaic-lock", VLC_VAR_MUTEX );
 vlc_module_end();
 
 static const char *ppsz_filter_options[] = {
@@ -286,7 +282,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_global = p_filter->p_libvlc_global;
+    vlc_object_t *p_libvlc = VLC_OBJECT( p_filter->p_libvlc );
     char *psz_order;
     char *psz_offsets;
     int i_index;
@@ -308,7 +304,8 @@ static int CreateFilter( vlc_object_t *p_this )
     vlc_mutex_init( p_filter, &p_sys->lock );
     vlc_mutex_lock( &p_sys->lock );
 
-    var_Get( p_libvlc_global, "mosaic-lock", &val );
+    var_Create( p_libvlc, "mosaic-lock", VLC_VAR_MUTEX );
+    var_Get( p_libvlc, "mosaic-lock", &val );
     p_sys->p_lock = val.p_address;
 
     config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,
@@ -693,7 +690,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
         {
             p_region->i_y = p_sys->pi_y_offsets[i_real_index];
         }
-        else if( fmt_out.i_height < row_inner_height
+        else if( fmt_out.i_height > row_inner_height
             || p_sys->b_ar || p_sys->b_keep )
         {
             /* we don't have to center the video since it takes the
@@ -737,6 +734,7 @@ static int MosaicCallback( 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;
 
 #define VAR_IS( a ) !strcmp( psz_var, CFG_PREFIX a )
@@ -889,10 +887,12 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
 
         if( p_sys->i_offsets_length != 0 )
         {
+            p_sys->i_offsets_length = 0;
             free( p_sys->pi_x_offsets );
             free( p_sys->pi_y_offsets );
+            p_sys->pi_x_offsets = NULL;
+            p_sys->pi_y_offsets = NULL;
         }
-        p_sys->i_offsets_length = 0;
 
         mosaic_ParseSetOffsets( p_this, p_sys, newval.psz_string );