X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fvideo_output%2Fimage.c;h=3bcecbcbe8272bda2b86b1af99548373b5f878e5;hb=b751665aa8f78719eb3e4fe30545fffd5c423948;hp=d79a5bfea0b6dc43b305937f557bc0fc17b74e07;hpb=5183b07c7c04e302af409fca4804e66777a6a040;p=vlc diff --git a/modules/video_output/image.c b/modules/video_output/image.c index d79a5bfea0..3bcecbcbe8 100644 --- a/modules/video_output/image.c +++ b/modules/video_output/image.c @@ -25,7 +25,12 @@ * Preamble *****************************************************************************/ -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include #include #include @@ -72,37 +77,37 @@ static void Display ( vout_thread_t *, picture_t * ); "creating one file per image. In this case, " \ "the number is not appended to the filename." ) -static const char *psz_format_list[] = { "png", "jpeg" }; -static const char *psz_format_list_text[] = { "PNG", "JPEG" }; +static const char *const psz_format_list[] = { "png", "jpeg" }; +static const char *const psz_format_list_text[] = { "PNG", "JPEG" }; #define CFG_PREFIX "image-out-" vlc_module_begin( ); - set_shortname( _( "Image file" ) ); - set_description( _( "Image video output" ) ); + set_shortname( N_( "Image file" ) ); + set_description( N_( "Image video output" ) ); set_category( CAT_VIDEO ); set_subcategory( SUBCAT_VIDEO_VOUT ); set_capability( "video output", 0 ); add_string( CFG_PREFIX "format", "png", NULL, - FORMAT_TEXT, FORMAT_LONGTEXT, VLC_FALSE ); + FORMAT_TEXT, FORMAT_LONGTEXT, false ); change_string_list( psz_format_list, psz_format_list_text, 0 ); add_integer( CFG_PREFIX "width", 0, NULL, - WIDTH_TEXT, WIDTH_LONGTEXT, VLC_TRUE ); + WIDTH_TEXT, WIDTH_LONGTEXT, true ); add_deprecated_alias( "image-width" ); /* since 0.9.0 */ add_integer( CFG_PREFIX "height", 0, NULL, - HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_TRUE ); + HEIGHT_TEXT, HEIGHT_LONGTEXT, true ); add_deprecated_alias( "image-height" ); /* since 0.9.0 */ add_integer( CFG_PREFIX "ratio", 3, NULL, - RATIO_TEXT, RATIO_LONGTEXT, VLC_FALSE ); + RATIO_TEXT, RATIO_LONGTEXT, false ); add_string( CFG_PREFIX "prefix", "img", NULL, - PREFIX_TEXT, PREFIX_LONGTEXT, VLC_FALSE ); + PREFIX_TEXT, PREFIX_LONGTEXT, false ); add_bool( CFG_PREFIX "replace", 0, NULL, - REPLACE_TEXT, REPLACE_LONGTEXT, VLC_FALSE ); + REPLACE_TEXT, REPLACE_LONGTEXT, false ); set_callbacks( Create, Destroy ); vlc_module_end(); -static const char *ppsz_vout_options[] = { +static const char *const ppsz_vout_options[] = { "format", "width", "height", "ratio", "prefix", "replace", NULL }; @@ -121,10 +126,10 @@ struct vout_sys_t int i_current; /* Current image */ int i_frames; /* Number of frames */ - vlc_bool_t b_replace; + bool b_replace; - vlc_bool_t b_time; - vlc_bool_t b_meta; + bool b_time; + bool b_meta; image_handler_t *p_image; }; @@ -149,9 +154,9 @@ static int Create( vlc_object_t *p_this ) p_vout->p_sys->psz_prefix = var_CreateGetString( p_this, CFG_PREFIX "prefix" ); p_vout->p_sys->b_time = strchr( p_vout->p_sys->psz_prefix, '%' ) - ? VLC_TRUE : VLC_FALSE; + ? true : false; p_vout->p_sys->b_meta = strchr( p_vout->p_sys->psz_prefix, '$' ) - ? VLC_TRUE : VLC_FALSE; + ? true : false; p_vout->p_sys->psz_format = var_CreateGetString( p_this, CFG_PREFIX "format" ); p_vout->p_sys->i_width = @@ -169,6 +174,7 @@ static int Create( vlc_object_t *p_this ) { msg_Err( p_this, "unable to create image handler") ; FREENULL( p_vout->p_sys->psz_prefix ); + FREENULL( p_vout->p_sys->psz_format ); FREENULL( p_vout->p_sys ); return VLC_EGENERIC; } @@ -310,6 +316,9 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic ) psz_prefix = psz_tmp; psz_filename = (char *)malloc( 10 + strlen( psz_prefix ) + strlen( p_vout->p_sys->psz_format ) ); + if( !psz_filename ) + return; + if( p_vout->p_sys->b_replace ) { sprintf( psz_filename, "%s.%s", psz_prefix, @@ -335,4 +344,5 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic ) static void End( vout_thread_t *p_vout ) { + VLC_UNUSED(p_vout); }