* Copyright (C) 2004-2006 the VideoLAN team
* $Id$
*
- * Authors: Clément Stenac <zorglub@videolan.org>
+ * Authors: Clément Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Module descriptor
*****************************************************************************/
#define FORMAT_TEXT N_( "Image format" )
-#define FORMAT_LONGTEXT N_( "Set the format of the output image." )
+#define FORMAT_LONGTEXT N_( "Format of the output images (png or jpg)." )
#define RATIO_TEXT N_( "Recording ratio" )
-#define RATIO_LONGTEXT N_( "Set the ratio of images that are recorded. "\
+#define RATIO_LONGTEXT N_( "Ratio of images to record. "\
"3 means that one image out of three is recorded." )
#define PREFIX_TEXT N_( "Filename prefix" )
-#define PREFIX_LONGTEXT N_( "Set the prefix of the filename. Output filename "\
- "will have the form prefixNUMBER.format" )
+#define PREFIX_LONGTEXT N_( "Prefix of the output images filenames. Output " \
+ "filenames will have the \"prefixNUMBER.format\" "\
+ "form." )
+
+#define REPLACE_TEXT N_( "Always write to the same file" )
+#define REPLACE_LONGTEXT N_( "Always write to the same file instead of " \
+ "creating one file per image. In this case, " \
+ "the number is not appended to the filename." )
static char *psz_format_list[] = { "png", "jpeg" };
static char *psz_format_list_text[] = { "PNG", "JPEG" };
add_integer( "image-out-ratio", 3 , NULL, RATIO_TEXT, RATIO_LONGTEXT,
VLC_FALSE );
add_string( "image-out-prefix", "img", NULL, PREFIX_TEXT, PREFIX_LONGTEXT,
- VLC_FALSE );
+ VLC_FALSE );
+ add_bool( "image-out-replace", 0, NULL, REPLACE_TEXT, REPLACE_LONGTEXT,
+ VLC_FALSE );
set_callbacks( Create, Destroy );
vlc_module_end();
int i_current; /* Current image */
int i_frames; /* Number of frames */
+ vlc_bool_t b_replace;
+
image_handler_t *p_image;
};
var_CreateGetString( p_this, "image-out-format" );
p_vout->p_sys->i_ratio =
var_CreateGetInteger( p_this, "image-out-ratio" );
+ p_vout->p_sys->b_replace =
+ var_CreateGetBool( p_this, "image-out-replace" );
p_vout->p_sys->i_current = 0;
p_vout->p_sys->p_image = image_HandlerCreate( p_vout );
fmt_out.i_width = fmt_in.i_width = p_vout->render.i_width;
fmt_out.i_height = fmt_in.i_height = p_vout->render.i_height;
- sprintf( psz_filename, "%s%.6i.%s", p_vout->p_sys->psz_prefix,
- p_vout->p_sys->i_current,
- p_vout->p_sys->psz_format );
+ if( p_vout->p_sys->b_replace )
+ {
+ sprintf( psz_filename, "%s.%s", p_vout->p_sys->psz_prefix,
+ p_vout->p_sys->psz_format );
+ }
+ else
+ {
+ sprintf( psz_filename, "%s%.6i.%s", p_vout->p_sys->psz_prefix,
+ p_vout->p_sys->i_current,
+ p_vout->p_sys->psz_format );
+ }
image_WriteUrl( p_vout->p_sys->p_image, p_pic,
&fmt_in, &fmt_out, psz_filename ) ;
free( psz_filename );