/*****************************************************************************
* image.c : image video output
*****************************************************************************
- * Copyright (C) 2004-2005 the VideoLAN team
+ * Copyright (C) 2004-2006 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
#define PREFIX_LONGTEXT N_( "Set the prefix of the filename. Output filename "\
"will have the form prefixNUMBER.format" )
-static char *psz_format_list[] = { "png" };
-static char *psz_format_list_text[] = { "PNG" };
+static char *psz_format_list[] = { "png", "jpeg" };
+static char *psz_format_list_text[] = { "PNG", "JPEG" };
vlc_module_begin( );
set_shortname( _( "Image file" ) );
add_string( "image-out-format", "png", NULL, FORMAT_TEXT, FORMAT_LONGTEXT,
VLC_FALSE );
+ add_string( "image-out-format", "jpeg", NULL, FORMAT_TEXT, FORMAT_LONGTEXT,
+ VLC_FALSE );
change_string_list( psz_format_list, psz_format_list_text, 0 );
add_integer( "image-out-ratio", 3 , NULL, RATIO_TEXT, RATIO_LONGTEXT,
VLC_FALSE );
*****************************************************************************/
struct vout_sys_t
{
- char *psz_prefix; /* Prefix */
- int i_ratio; /* Image ratio */
+ char *psz_prefix; /* Prefix */
+ char *psz_format; /* Format */
+ int i_ratio; /* Image ratio */
- int i_current; /* Current image */
- int i_frames; /* Number of frames */
+ int i_current; /* Current image */
+ int i_frames; /* Number of frames */
image_handler_t *p_image;
};
p_vout->p_sys->psz_prefix =
var_CreateGetString( p_this, "image-out-prefix" );
+ p_vout->p_sys->psz_format =
+ var_CreateGetString( p_this, "image-out-format" );
p_vout->p_sys->i_ratio =
var_CreateGetInteger( p_this, "image-out-ratio" );
p_vout->p_sys->i_current = 0;
/* Destroy structure */
image_HandlerDelete( p_vout->p_sys->p_image );
FREE( p_vout->p_sys->psz_prefix );
+ FREE( p_vout->p_sys->psz_format );
FREE( p_vout->p_sys );
}
return;
}
p_vout->p_sys->i_frames++;
- psz_filename = (char *)malloc( strlen( p_vout->p_sys->psz_prefix ) +
- 10 );
+ psz_filename = (char *)malloc( 10 + strlen( p_vout->p_sys->psz_prefix )
+ + strlen( p_vout->p_sys->psz_format ) );
fmt_in.i_chroma = p_vout->render.i_chroma;
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;
- p_vout->p_sys->i_current++;
-
sprintf( psz_filename, "%s%.6i.%s", p_vout->p_sys->psz_prefix,
- p_vout->p_sys->i_current,
- "png" );
-
+ 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 );
+
+ p_vout->p_sys->i_current++;
+
return;
}