X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Fosdmenu.c;h=3e8e583530ccba94eafa488aeb4d8fa0e29778f0;hb=d46ea102817e0146d74fc4789c57ef71b5bf9d33;hp=2367e5ac715e1ab7623d7d51fbda84aa6dde094e;hpb=449fd28aaf007c6411251dae9d0dbfdc65b135d1;p=vlc diff --git a/modules/video_filter/osdmenu.c b/modules/video_filter/osdmenu.c index 2367e5ac71..3e8e583530 100644 --- a/modules/video_filter/osdmenu.c +++ b/modules/video_filter/osdmenu.c @@ -28,7 +28,8 @@ # include "config.h" #endif -#include +#include +#include #include #include @@ -79,8 +80,8 @@ "means less transparency. The default is being not transparent " \ "(value 255) the minimum is fully transparent (value 0)." ) -static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 }; -static const char *ppsz_pos_descriptions[] = +static const int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 }; +static const char *const ppsz_pos_descriptions[] = { N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"), N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") }; @@ -116,7 +117,7 @@ vlc_module_begin(); add_integer( OSD_CFG "y", -1, NULL, POSY_TEXT, POSY_LONGTEXT, false ); add_integer( OSD_CFG "position", 8, NULL, POS_TEXT, POS_LONGTEXT, false ); - change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 ); + change_integer_list( pi_pos_values, ppsz_pos_descriptions, NULL ); add_string( OSD_CFG "file", OSD_DEFAULT_CFG, NULL, OSD_FILE_TEXT, OSD_FILE_LONGTEXT, false ); add_string( OSD_CFG "file-path", NULL, NULL, OSD_PATH_TEXT, @@ -130,8 +131,8 @@ vlc_module_begin(); OSD_ALPHA_TEXT, OSD_ALPHA_LONGTEXT, true ); set_capability( "sub filter", 100 ); - set_description( _("On Screen Display menu") ); - set_shortname( _("OSD menu") ); + set_description( N_("On Screen Display menu") ); + set_shortname( N_("OSD menu") ); add_shortcut( "osdmenu" ); set_category( CAT_VIDEO ); @@ -183,10 +184,7 @@ static int CreateFilter ( vlc_object_t *p_this ) p_filter->p_sys = p_sys = (filter_sys_t *) malloc( sizeof(filter_sys_t) ); if( !p_filter->p_sys ) - { - msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; - } memset( p_sys, 0, sizeof(filter_sys_t) ); /* Populating struct */ @@ -230,18 +228,11 @@ static int CreateFilter ( vlc_object_t *p_this ) p_sys->p_menu->i_x = 0; p_sys->p_menu->i_y = 0; } - else if( (p_sys->i_x >= 0) || (p_sys->i_y >= 0) ) + else { p_sys->p_menu->i_x = p_sys->i_x; p_sys->p_menu->i_y = p_sys->i_y; } - else if( (p_sys->p_menu->i_x < 0) || - (p_sys->p_menu->i_y < 0) ) - { - p_sys->b_absolute = false; - p_sys->p_menu->i_x = 0; - p_sys->p_menu->i_y = 0; - } /* Set up p_filter */ p_sys->i_last_date = mdate(); @@ -279,8 +270,7 @@ static int CreateFilter ( vlc_object_t *p_this ) error: msg_Err( p_filter, "osdmenu filter discarded" ); - osd_MenuDelete( p_this, p_sys->p_menu ); - p_sys->p_menu = NULL; + free( p_sys->psz_path ); free( p_sys->psz_file ); free( p_sys ); return VLC_EGENERIC; @@ -299,12 +289,15 @@ static void DestroyFilter( vlc_object_t *p_this ) var_DelCallback( p_filter, OSD_CFG "update", OSDMenuCallback, p_sys ); var_DelCallback( p_filter, OSD_CFG "alpha", OSDMenuCallback, p_sys ); - var_DelCallback( p_sys->p_menu, "osd-menu-update", - OSDMenuUpdateEvent, p_filter ); - var_DelCallback( p_sys->p_menu, "osd-menu-visible", - OSDMenuVisibleEvent, p_filter ); + if( p_sys ) + { + var_DelCallback( p_sys->p_menu, "osd-menu-update", + OSDMenuUpdateEvent, p_filter ); + var_DelCallback( p_sys->p_menu, "osd-menu-visible", + OSDMenuVisibleEvent, p_filter ); + } - if( p_sys->p_vout ) + if( p_sys && p_sys->p_vout ) { var_DelCallback( p_sys->p_vout, "mouse-x", MouseEvent, p_sys ); @@ -326,10 +319,14 @@ static void DestroyFilter( vlc_object_t *p_this ) var_Destroy( p_this, OSD_CFG "update" ); var_Destroy( p_this, OSD_CFG "alpha" ); - osd_MenuDelete( p_filter, p_sys->p_menu ); + if( p_sys ) + { + osd_MenuDelete( p_filter, p_sys->p_menu ); - free( p_sys->psz_file ); - free( p_sys ); + free( p_sys->psz_path ); + free( p_sys->psz_file ); + free( p_sys ); + } } /***************************************************************************** @@ -465,8 +462,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date ) return NULL; /* we are too early, so wait */ /* Allocate the subpicture internal data. */ - p_spu = p_filter->pf_sub_buffer_new( p_filter ); - if( !p_spu ) return NULL; + p_spu = filter_NewSubpicture( p_filter ); + if( !p_spu ) + return NULL; p_spu->b_ephemer = true; p_spu->b_fade = true;