X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_filter%2Frss.c;h=70bbdf1ee3f5009fe39c9c628c70f30a5f0f7908;hb=75a1834d394b6a89a6ead139d57c097704d3943a;hp=01c5dfa67c7a938308853dbdd908d59ba4e4ee74;hpb=df61d33b06e2b3cbbe746b2f5a9bea5b370c24ff;p=vlc diff --git a/modules/video_filter/rss.c b/modules/video_filter/rss.c index 01c5dfa67c..70bbdf1ee3 100644 --- a/modules/video_filter/rss.c +++ b/modules/video_filter/rss.c @@ -34,7 +34,8 @@ # include "config.h" #endif -#include +#include +#include #include #include "vlc_filter.h" @@ -60,11 +61,13 @@ static subpicture_t *Filter( filter_t *, mtime_t ); static int FetchRSS( filter_t * ); static void FreeRSS( filter_t * ); -static int pi_color_values[] = { 0xf0000000, 0x00000000, 0x00808080, 0x00C0C0C0, +static const int pi_color_values[] = { + 0xf0000000, 0x00000000, 0x00808080, 0x00C0C0C0, 0x00FFFFFF, 0x00800000, 0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00808000, 0x00008000, 0x00008080, 0x0000FF00, 0x00800080, 0x00000080, 0x000000FF, 0x0000FFFF}; -static const char *ppsz_color_descriptions[] = { N_("Default"), N_("Black"), +static const char *const ppsz_color_descriptions[] = { + N_("Default"), N_("Black"), N_("Gray"), N_("Silver"), N_("White"), N_("Maroon"), N_("Red"), N_("Fuchsia"), N_("Yellow"), N_("Olive"), N_("Green"), N_("Teal"), N_("Lime"), N_("Purple"), N_("Navy"), N_("Blue"), @@ -163,8 +166,8 @@ struct filter_sys_t #define TITLE_TEXT N_("Title display mode") #define TITLE_LONGTEXT N_("Title display mode. Default is 0 (hidden) if the feed has an image and feed images are enabled, 1 otherwise.") -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") }; @@ -174,8 +177,8 @@ enum title_modes { prepend_title, scroll_title }; -static int pi_title_modes[] = { default_title, hide_title, prepend_title, scroll_title }; -static const char *ppsz_title_modes[] = +static const int pi_title_modes[] = { default_title, hide_title, prepend_title, scroll_title }; +static const char *const ppsz_title_modes[] = { N_("Default"), N_("Don't show"), N_("Always visible"), N_("Scroll with feed") }; #define CFG_PREFIX "rss-" @@ -216,12 +219,12 @@ vlc_module_begin(); add_integer( CFG_PREFIX "title", default_title, NULL, TITLE_TEXT, TITLE_LONGTEXT, false ); change_integer_list( pi_title_modes, ppsz_title_modes, 0 ); - set_description( _("RSS and Atom feed display") ); + set_description( N_("RSS and Atom feed display") ); add_shortcut( "rss" ); add_shortcut( "atom" ); vlc_module_end(); -static const char *ppsz_filter_options[] = { +static const char *const ppsz_filter_options[] = { "urls", "x", "y", "position", "color", "size", "speed", "length", "ttl", "images", "title", NULL }; @@ -238,12 +241,9 @@ 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; - } - vlc_mutex_init( p_filter, &p_sys->lock ); + vlc_mutex_init( &p_sys->lock ); vlc_mutex_lock( &p_sys->lock ); config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options, @@ -264,9 +264,9 @@ static int CreateFilter( vlc_object_t *p_this ) p_sys->psz_marquee = (char *)malloc( p_sys->i_length + 1 ); if( p_sys->psz_marquee == NULL ) { - msg_Err( p_filter, "out of memory" ); vlc_mutex_unlock( &p_sys->lock ); vlc_mutex_destroy( &p_sys->lock ); + free( p_sys->psz_urls ); free( p_sys ); return VLC_ENOMEM; } @@ -275,10 +275,10 @@ static int CreateFilter( vlc_object_t *p_this ) p_sys->p_style = malloc( sizeof( text_style_t )); if( p_sys->p_style == NULL ) { - msg_Err( p_filter, "out of memory" ); free( p_sys->psz_marquee ); vlc_mutex_unlock( &p_sys->lock ); vlc_mutex_destroy( &p_sys->lock ); + free( p_sys->psz_urls ); free( p_sys ); return VLC_ENOMEM; } @@ -293,7 +293,7 @@ static int CreateFilter( vlc_object_t *p_this ) if( p_sys->b_images == true && p_sys->p_style->i_font_size == -1 ) { - msg_Warn( p_filter, "rrs-size wasn't specified. Feed images will thus be displayed without being resized" ); + msg_Warn( p_filter, "rss-size wasn't specified. Feed images will thus be displayed without being resized" ); } if( FetchRSS( p_filter ) ) @@ -303,6 +303,7 @@ static int CreateFilter( vlc_object_t *p_this ) free( p_sys->psz_marquee ); vlc_mutex_unlock( &p_sys->lock ); vlc_mutex_destroy( &p_sys->lock ); + free( p_sys->psz_urls ); free( p_sys ); return VLC_EGENERIC; } @@ -314,6 +315,7 @@ static int CreateFilter( vlc_object_t *p_this ) free( p_sys->psz_marquee ); vlc_mutex_unlock( &p_sys->lock ); vlc_mutex_destroy( &p_sys->lock ); + free( p_sys->psz_urls ); free( p_sys ); return VLC_EGENERIC; } @@ -326,6 +328,7 @@ static int CreateFilter( vlc_object_t *p_this ) FreeRSS( p_filter ); vlc_mutex_unlock( &p_sys->lock ); vlc_mutex_destroy( &p_sys->lock ); + free( p_sys->psz_urls ); free( p_sys ); return VLC_EGENERIC; } @@ -431,7 +434,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) } } - p_spu = p_filter->pf_sub_buffer_new( p_filter ); + p_spu = filter_NewSubpicture( p_filter ); if( !p_spu ) { vlc_mutex_unlock( &p_sys->lock ); @@ -610,7 +613,7 @@ static picture_t *LoadImage( filter_t *p_filter, const char *psz_url ) fmt_out.i_height = p_sys->p_style->i_font_size; p_pic = image_Convert( p_handler, p_orig, &fmt_in, &fmt_out ); - p_orig->pf_release( p_orig ); + picture_Release( p_orig ); if( !p_pic ) { msg_Warn( p_filter, "Error while converting %s", psz_url ); @@ -978,7 +981,7 @@ static void FreeRSS( filter_t *p_filter) free( p_feed->psz_description ); free( p_feed->psz_image ); if( p_feed->p_pic != NULL ) - p_feed->p_pic->pf_release( p_feed->p_pic ); + picture_Release( p_feed->p_pic ); } free( p_sys->p_feeds ); p_sys->i_feeds = 0;