"picture quality, for instance deinterlacing, or distort" \
"the video.")
-#define SNAP_PATH_TEXT N_("Video snapshot directory")
+#define SNAP_PATH_TEXT N_("Video snapshot directory (or filename)")
#define SNAP_PATH_LONGTEXT N_( \
"Directory where the video snapshots will be stored.")
+#define SNAP_PREFIX_TEXT N_("Video snapshot file prefix")
+#define SNAP_PREFIX_LONGTEXT N_( \
+ "Video snapshot file prefix" )
+
#define SNAP_FORMAT_TEXT N_("Video snapshot format")
#define SNAP_FORMAT_LONGTEXT N_( \
"Image format which will be used to store the video snapshots" )
#define SNAP_PREVIEW_LONGTEXT N_( \
"Display the snapshot preview in the screen's top-left corner.")
+#define SNAP_SEQUENTIAL_TEXT N_("Use sequential numbers instead of timestamps")
+#define SNAP_SEQUENTIAL_LONGTEXT N_( \
+ "Use sequential numbers instead of timestamps for snapshot numbering")
+
#define CROP_TEXT N_("Video cropping")
#define CROP_LONGTEXT N_( \
"This forces the cropping of the source video. " \
set_section( N_("Snapshot") , NULL );
add_directory( "snapshot-path", NULL, NULL, SNAP_PATH_TEXT,
SNAP_PATH_LONGTEXT, VLC_FALSE );
+ add_directory( "snapshot-prefix", "vlcsnap-", NULL, SNAP_PATH_TEXT,
+ SNAP_PATH_LONGTEXT, VLC_FALSE );
add_string( "snapshot-format", "png", NULL, SNAP_FORMAT_TEXT,
SNAP_FORMAT_LONGTEXT, VLC_FALSE );
change_string_list( ppsz_snap_formats, NULL, 0 );
add_bool( "snapshot-preview", VLC_TRUE, NULL, SNAP_PREVIEW_TEXT,
SNAP_PREVIEW_LONGTEXT, VLC_FALSE );
+ add_bool( "snapshot-sequential", VLC_FALSE, NULL, SNAP_SEQUENTIAL_TEXT,
+ SNAP_SEQUENTIAL_LONGTEXT, VLC_FALSE );
set_section( N_("Window properties" ), NULL );
add_integer( "width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_TRUE );
/* Create a few object variables we'll need later on */
var_Create( p_vout, "snapshot-path", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
+ var_Create( p_vout, "snapshot-prefix", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "snapshot-format", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "snapshot-preview", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
+ var_Create( p_vout, "snapshot-sequential",
+ VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
+ var_Create( p_vout, "snapshot-num", VLC_VAR_INTEGER );
+ var_SetInteger( p_vout, "snapshot-num", 1 );
+
var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "align", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
{
image_handler_t *p_image = image_HandlerCreate( p_vout );
video_format_t fmt_in = {0}, fmt_out = {0};
- char *psz_filename;
+ char *psz_filename = NULL;
subpicture_t *p_subpic;
picture_t *p_pif;
vlc_value_t val, format;
* Did the user specify a directory? If not, path = NULL.
*/
path = opendir ( (const char *)val.psz_string );
-
+
if ( path != NULL )
{
-
- asprintf( &psz_filename, "%s/vlcsnap-%u.%s", val.psz_string,
- (unsigned int)(p_pic->date / 100000) & 0xFFFFFF,
- format.psz_string );
+ char *psz_prefix = var_GetString( p_vout, "snapshot-prefix" );
+ if( !psz_prefix ) psz_prefix = strdup( "vlcsnap-" );
+
closedir( path );
+ if( var_GetBool( p_vout, "snapshot-sequential" ) == VLC_TRUE )
+ {
+ int i_num = var_GetInteger( p_vout, "snapshot-num" );
+ FILE *p_file;
+ do
+ {
+ asprintf( &psz_filename, "%s/%s%d.%s", val.psz_string,
+ psz_prefix, i_num++, format.psz_string );
+ }
+ while( ( p_file = fopen( psz_filename, "r" ) ) && !fclose( p_file ) );
+ var_SetInteger( p_vout, "snapshot-num", i_num );
+ }
+ else
+ {
+ asprintf( &psz_filename, "%s/%s%u.%s", val.psz_string,
+ psz_prefix,
+ (unsigned int)(p_pic->date / 100000) & 0xFFFFFF,
+ format.psz_string );
+ }
+
+ free( psz_prefix );
}
else // The user specified a full path name (including file name)
{
asprintf ( &psz_filename, "%s", val.psz_string );
}
-
+
free( val.psz_string );
free( format.psz_string );