X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fmosaic.c;h=faae53dd0ea2055c5177f108922738bb87e99aff;hb=f659703fb4033420e0607d34bc7cd880a5802ea7;hp=5f7d97bccc161c8b05964a3fc8e51cac1e2282a7;hpb=24cddfa0efa80557f538d6dbf08f9b0b4b4d52a4;p=vlc diff --git a/modules/video_filter/mosaic.c b/modules/video_filter/mosaic.c index 5f7d97bccc..faae53dd0e 100644 --- a/modules/video_filter/mosaic.c +++ b/modules/video_filter/mosaic.c @@ -35,8 +35,8 @@ #include #include /* INT_MAX */ -#include "vlc_filter.h" -#include "vlc_image.h" +#include +#include #include "mosaic.h" @@ -213,9 +213,9 @@ vlc_module_begin () add_integer( CFG_PREFIX "cols", 2, NULL, COLS_TEXT, COLS_LONGTEXT, false ) - add_bool( CFG_PREFIX "keep-aspect-ratio", 0, NULL, + add_bool( CFG_PREFIX "keep-aspect-ratio", false, NULL, AR_TEXT, AR_LONGTEXT, false ) - add_bool( CFG_PREFIX "keep-picture", 0, NULL, + add_bool( CFG_PREFIX "keep-picture", false, NULL, KEEP_TEXT, KEEP_LONGTEXT, false ) add_string( CFG_PREFIX "order", "", NULL, @@ -254,14 +254,14 @@ static void __mosaic_ParseSetOffsets( vlc_object_t *p_this, { i_index++; - p_sys->pi_x_offsets = - realloc( p_sys->pi_x_offsets, i_index * sizeof(int) ); + p_sys->pi_x_offsets = xrealloc( p_sys->pi_x_offsets, + i_index * sizeof(int) ); p_sys->pi_x_offsets[i_index - 1] = atoi( psz_offsets ); psz_end = strchr( psz_offsets, ',' ); psz_offsets = psz_end + 1; - p_sys->pi_y_offsets = - realloc( p_sys->pi_y_offsets, i_index * sizeof(int) ); + p_sys->pi_y_offsets = xrealloc( p_sys->pi_y_offsets, + i_index * sizeof(int) ); p_sys->pi_y_offsets[i_index - 1] = atoi( psz_offsets ); psz_end = strchr( psz_offsets, ',' ); psz_offsets = psz_end + 1; @@ -359,8 +359,8 @@ static int CreateFilter( vlc_object_t *p_this ) { psz_end = strchr( psz_order, ',' ); i_index++; - p_sys->ppsz_order = realloc( p_sys->ppsz_order, - i_index * sizeof(char *) ); + p_sys->ppsz_order = xrealloc( p_sys->ppsz_order, + i_index * sizeof(char *) ); p_sys->ppsz_order[i_index - 1] = strndup( psz_order, psz_end - psz_order ); psz_order = psz_end+1; @@ -391,9 +391,27 @@ static void DestroyFilter( vlc_object_t *p_this ) { filter_t *p_filter = (filter_t*)p_this; filter_sys_t *p_sys = p_filter->p_sys; - int i_index; - vlc_mutex_lock( &p_sys->lock ); +#define DEL_CB( name ) \ + var_DelCallback( p_filter, CFG_PREFIX #name, MosaicCallback, p_sys ) + DEL_CB( width ); + DEL_CB( height ); + DEL_CB( xoffset ); + DEL_CB( yoffset ); + + DEL_CB( align ); + + DEL_CB( borderw ); + DEL_CB( borderh ); + DEL_CB( rows ); + DEL_CB( cols ); + DEL_CB( alpha ); + DEL_CB( position ); + DEL_CB( delay ); + + DEL_CB( keep-aspect-ratio ); + DEL_CB( order ); +#undef DEL_CB if( !p_sys->b_keep ) { @@ -402,7 +420,7 @@ static void DestroyFilter( vlc_object_t *p_this ) if( p_sys->i_order_length ) { - for( i_index = 0; i_index < p_sys->i_order_length; i_index++ ) + for( int i_index = 0; i_index < p_sys->i_order_length; i_index++ ) { free( p_sys->ppsz_order[i_index] ); } @@ -415,21 +433,10 @@ static void DestroyFilter( vlc_object_t *p_this ) p_sys->i_offsets_length = 0; } - vlc_mutex_unlock( &p_sys->lock ); vlc_mutex_destroy( &p_sys->lock ); free( p_sys ); } -/***************************************************************************** - * MosaicReleasePicture : Hack to avoid picture duplication - *****************************************************************************/ -static void MosaicReleasePicture( picture_t *p_picture ) -{ - picture_t *p_original_pic = (picture_t *)p_picture->p_sys; - - picture_Release( p_original_pic ); -} - /***************************************************************************** * Filter *****************************************************************************/ @@ -653,8 +660,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) { msg_Err( p_filter, "cannot allocate SPU region" ); p_filter->pf_sub_buffer_del( p_filter, p_spu ); - vlc_mutex_unlock( &p_sys->lock ); vlc_mutex_unlock( p_sys->p_lock ); + vlc_mutex_unlock( &p_sys->lock ); return p_spu; } @@ -742,7 +749,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing alpha from %d/255 to %d/255", - p_sys->i_alpha, newval.i_int); + p_sys->i_alpha, (int)newval.i_int); p_sys->i_alpha = __MIN( __MAX( newval.i_int, 0 ), 255 ); vlc_mutex_unlock( &p_sys->lock ); } @@ -750,7 +757,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing height from %dpx to %dpx", - p_sys->i_height, newval.i_int ); + p_sys->i_height, (int)newval.i_int ); p_sys->i_height = __MAX( newval.i_int, 0 ); vlc_mutex_unlock( &p_sys->lock ); } @@ -758,7 +765,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing width from %dpx to %dpx", - p_sys->i_width, newval.i_int ); + p_sys->i_width, (int)newval.i_int ); p_sys->i_width = __MAX( newval.i_int, 0 ); vlc_mutex_unlock( &p_sys->lock ); } @@ -766,7 +773,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing x offset from %dpx to %dpx", - p_sys->i_xoffset, newval.i_int ); + p_sys->i_xoffset, (int)newval.i_int ); p_sys->i_xoffset = __MAX( newval.i_int, 0 ); vlc_mutex_unlock( &p_sys->lock ); } @@ -774,7 +781,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing y offset from %dpx to %dpx", - p_sys->i_yoffset, newval.i_int ); + p_sys->i_yoffset, (int)newval.i_int ); p_sys->i_yoffset = __MAX( newval.i_int, 0 ); vlc_mutex_unlock( &p_sys->lock ); } @@ -789,7 +796,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, while( pi_align_values[i_new] != newval.i_int ) i_new++; msg_Dbg( p_this, "changing alignment from %d (%s) to %d (%s)", p_sys->i_align, ppsz_align_descriptions[i_old], - newval.i_int, ppsz_align_descriptions[i_new] ); + (int)newval.i_int, ppsz_align_descriptions[i_new] ); p_sys->i_align = newval.i_int; vlc_mutex_unlock( &p_sys->lock ); } @@ -797,7 +804,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing border width from %dpx to %dpx", - p_sys->i_borderw, newval.i_int ); + p_sys->i_borderw, (int)newval.i_int ); p_sys->i_borderw = __MAX( newval.i_int, 0 ); vlc_mutex_unlock( &p_sys->lock ); } @@ -805,7 +812,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing border height from %dpx to %dpx", - p_sys->i_borderh, newval.i_int ); + p_sys->i_borderh, (int)newval.i_int ); p_sys->i_borderh = __MAX( newval.i_int, 0 ); vlc_mutex_unlock( &p_sys->lock ); } @@ -824,7 +831,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing position method from %d (%s) to %d (%s)", p_sys->i_position, ppsz_pos_descriptions[p_sys->i_position], - newval.i_int, ppsz_pos_descriptions[newval.i_int]); + (int)newval.i_int, ppsz_pos_descriptions[newval.i_int]); p_sys->i_position = newval.i_int; vlc_mutex_unlock( &p_sys->lock ); } @@ -833,7 +840,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing number of rows from %d to %d", - p_sys->i_rows, newval.i_int ); + p_sys->i_rows, (int)newval.i_int ); p_sys->i_rows = __MAX( newval.i_int, 1 ); vlc_mutex_unlock( &p_sys->lock ); } @@ -841,7 +848,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { vlc_mutex_lock( &p_sys->lock ); msg_Dbg( p_this, "changing number of columns from %d to %d", - p_sys->i_cols, newval.i_int ); + p_sys->i_cols, (int)newval.i_int ); p_sys->i_cols = __MAX( newval.i_int, 1 ); vlc_mutex_unlock( &p_sys->lock ); } @@ -869,8 +876,8 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var, { psz_end = strchr( psz_order, ',' ); i_index++; - p_sys->ppsz_order = realloc( p_sys->ppsz_order, - i_index * sizeof(char *) ); + p_sys->ppsz_order = xrealloc( p_sys->ppsz_order, + i_index * sizeof(char *) ); p_sys->ppsz_order[i_index - 1] = strndup( psz_order, psz_end - psz_order ); psz_order = psz_end+1;