X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Flogo.c;h=7a9a58dba20456a7883c878d07cb37f80770f9b0;hb=aaf50f16cfb838418703d90ee3e62bd0e649b978;hp=e17168a78474ea7adc6481fe02e95d218b59e30d;hpb=f7d32756d25ff0db03a73b7f76875bbe76d36d18;p=vlc diff --git a/modules/video_filter/logo.c b/modules/video_filter/logo.c index e17168a784..7a9a58dba2 100644 --- a/modules/video_filter/logo.c +++ b/modules/video_filter/logo.c @@ -25,8 +25,6 @@ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ -#include #include #include @@ -107,14 +105,14 @@ vlc_module_begin(); set_callbacks( Create, Destroy ); add_file( CFG_PREFIX "file", NULL, NULL, FILE_TEXT, FILE_LONGTEXT, VLC_FALSE ); - add_integer( CFG_PREFIX "x", -1, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_TRUE ); + add_integer( CFG_PREFIX "x", 0, NULL, POSX_TEXT, POSX_LONGTEXT, VLC_TRUE ); add_integer( CFG_PREFIX "y", 0, NULL, POSY_TEXT, POSY_LONGTEXT, VLC_TRUE ); /* default to 1000 ms per image, continuously cycle through them */ add_integer( CFG_PREFIX "delay", 1000, NULL, DELAY_TEXT, DELAY_LONGTEXT, VLC_TRUE ); add_integer( CFG_PREFIX "repeat", -1, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_TRUE ); add_integer_with_range( CFG_PREFIX "transparency", 255, 0, 255, NULL, TRANS_TEXT, TRANS_LONGTEXT, VLC_FALSE ); - add_integer( CFG_PREFIX "position", 6, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE ); + add_integer( CFG_PREFIX "position", -1, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE ); change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 ); /* subpicture filter submodule */ @@ -122,7 +120,6 @@ vlc_module_begin(); set_capability( "sub filter", 0 ); set_callbacks( CreateFilter, DestroyFilter ); set_description( _("Logo sub filter") ); - add_shortcut( "logo" ); vlc_module_end(); static const char *ppsz_filter_options[] = { @@ -171,7 +168,11 @@ static picture_t *LoadImage( vlc_object_t *p_this, char *psz_filename ) { picture_t *p_pic; image_handler_t *p_image; - video_format_t fmt_in = {0}, fmt_out = {0}; + video_format_t fmt_in; + video_format_t fmt_out; + + memset( &fmt_in, 0, sizeof(video_format_t) ); + memset( &fmt_out, 0, sizeof(video_format_t) ); fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A'); p_image = image_HandlerCreate( p_this ); @@ -321,13 +322,6 @@ static int Create( vlc_object_t *p_this ) return VLC_ENOMEM; } - p_vout->pf_init = Init; - p_vout->pf_end = End; - p_vout->pf_manage = NULL; - p_vout->pf_render = Render; - p_vout->pf_display = NULL; - p_vout->pf_control = Control; - config_ChainParse( p_vout, CFG_PREFIX, ppsz_filter_options, p_vout->p_cfg ); @@ -336,9 +330,16 @@ static int Create( vlc_object_t *p_this ) if( !p_logo_list->psz_filename || !*p_logo_list->psz_filename ) { msg_Err( p_vout, "logo file not specified" ); - return 0; + return VLC_EGENERIC; } + p_vout->pf_init = Init; + p_vout->pf_end = End; + p_vout->pf_manage = NULL; + p_vout->pf_render = Render; + p_vout->pf_display = NULL; + p_vout->pf_control = Control; + p_sys->pos = var_CreateGetIntegerCommand( p_vout, "logo-position" ); p_sys->posx = var_CreateGetIntegerCommand( p_vout, "logo-x" ); p_sys->posy = var_CreateGetIntegerCommand( p_vout, "logo-y" ); @@ -361,11 +362,11 @@ static int Init( vout_thread_t *p_vout ) vout_sys_t *p_sys = p_vout->p_sys; picture_t *p_pic; int i_index; - video_format_t fmt = {0}; - + video_format_t fmt; logo_list_t *p_logo_list = p_sys->p_logo_list; I_OUTPUTPICTURES = 0; + memset( &fmt, 0, sizeof(video_format_t) ); /* adjust index to the next logo */ p_logo_list->i_counter = @@ -775,13 +776,13 @@ static void DestroyFilter( vlc_object_t *p_this ) free( p_sys ); /* Delete the logo variables from INPUT */ - var_Destroy( p_filter->p_libvlc_global , "logo-file" ); - var_Destroy( p_filter->p_libvlc_global , "logo-x" ); - var_Destroy( p_filter->p_libvlc_global , "logo-y" ); - var_Destroy( p_filter->p_libvlc_global , "logo-delay" ); - var_Destroy( p_filter->p_libvlc_global , "logo-repeat" ); - var_Destroy( p_filter->p_libvlc_global , "logo-position" ); - var_Destroy( p_filter->p_libvlc_global , "logo-transparency" ); + var_Destroy( p_filter->p_libvlc, "logo-file" ); + var_Destroy( p_filter->p_libvlc, "logo-x" ); + var_Destroy( p_filter->p_libvlc, "logo-y" ); + var_Destroy( p_filter->p_libvlc, "logo-delay" ); + var_Destroy( p_filter->p_libvlc, "logo-repeat" ); + var_Destroy( p_filter->p_libvlc, "logo-position" ); + var_Destroy( p_filter->p_libvlc, "logo-transparency" ); } /***************************************************************************** @@ -876,21 +877,20 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) vlc_mutex_unlock( &p_logo_list->lock ); /* where to locate the logo: */ - if( p_sys->posx < 0 || p_sys->posy < 0 ) - { /* set to one of the 9 relative locations */ - p_spu->i_flags = p_sys->pos; - p_spu->i_x = 0; - p_spu->i_y = 0; - p_spu->b_absolute = VLC_FALSE; + if( p_sys->pos < 0 ) + { /* set to an absolute xy */ + p_spu->p_region->i_align = OSD_ALIGN_RIGHT | OSD_ALIGN_TOP; + p_spu->b_absolute = VLC_TRUE; } else - { /* set to an absolute xy, referenced to upper left corner */ - p_spu->i_flags = OSD_ALIGN_LEFT | OSD_ALIGN_TOP; - p_spu->i_x = p_sys->posx; - p_spu->i_y = p_sys->posy; - p_spu->b_absolute = VLC_TRUE; + { /* set to one of the 9 relative locations */ + p_spu->p_region->i_align = p_sys->pos; + p_spu->b_absolute = VLC_FALSE; } + p_spu->i_x = p_sys->posx; + p_spu->i_y = p_sys->posy; + p_spu->p_region = p_region; p_spu->i_alpha = ( p_logo->i_alpha != -1 ?