ADD( "vratio", STRING, VideoConfig )
ADD( "vcrop", STRING, VideoConfig )
ADD( "vzoom", STRING, VideoConfig )
+ ADD( "snapshot", VOID, VideoConfig )
/* audio commands */
ADD( "volume", STRING, Volume )
msg_rc(_("| vratio [X] . . . . . . . set/get video aspect ratio"));
msg_rc(_("| vcrop [X] . . . . . . . . . . . set/get video crop"));
msg_rc(_("| vzoom [X] . . . . . . . . . . . set/get video zoom"));
+ msg_rc(_("| snapshot . . . . . . . . . . . . take video snapshot"));
msg_rc(_("| strack [X] . . . . . . . . . set/get subtitles track"));
msg_rc(_("| key [hotkey name] . . . . . . simulate hotkey press"));
msg_rc(_("| menu . . [on|off|up|down|left|right|select] use menu"));
input_thread_t *p_input = NULL;
vout_thread_t * p_vout;
const char * psz_variable;
- vlc_value_t val_name;
int i_error;
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_ANYWHERE );
{
psz_variable = "aspect-ratio";
}
- else /* if( !strcmp( psz_cmd, "vzoom" ) ) */
+ else if( !strcmp( psz_cmd, "vzoom" ) )
{
psz_variable = "zoom";
}
-
-
- /* Get the descriptive name of the variable */
- var_Change( p_vout, psz_variable, VLC_VAR_GETTEXT,
- &val_name, NULL );
- if( !val_name.psz_string ) val_name.psz_string = strdup(psz_variable);
+ else if( !strcmp( psz_cmd, "snapshot" ) )
+ {
+ psz_variable = "video-snapshot";
+ }
if( newval.psz_string && *newval.psz_string )
{
i_error = var_Set( p_vout, psz_variable, newval );
}
}
+ else if( !strcmp( psz_cmd, "snapshot" ) )
+ {
+ i_error = var_Set( p_vout, psz_variable, newval );
+ }
else
{
/* get */
+ vlc_value_t val_name;
vlc_value_t val, text;
int i;
float f_value = 0.;
return VLC_EGENERIC;
}
+ /* Get the descriptive name of the variable */
+ var_Change( p_vout, psz_variable, VLC_VAR_GETTEXT,
+ &val_name, NULL );
+ if( !val_name.psz_string ) val_name.psz_string = strdup(psz_variable);
+
msg_rc( "+----[ %s ]", val_name.psz_string );
if( !strcmp( psz_variable, "zoom" ) )
{
#define SNAP_SEQUENTIAL_LONGTEXT N_( \
"Use sequential numbers instead of timestamps for snapshot numbering")
+#define SNAP_WIDTH_TEXT N_("Video snapshot width")
+#define SNAP_WIDTH_LONGTEXT N_( \
+ "You can enforce the width of the video snapshot. By default " \
+ "it will be 320 pixels." )
+
+#define SNAP_HEIGHT_TEXT N_("Video snapshot height")
+#define SNAP_HEIGHT_LONGTEXT N_( \
+ "You can enforce the height of the video snapshot. By default " \
+ "it will be 200 pixels." )
+
#define CROP_TEXT N_("Video cropping")
#define CROP_LONGTEXT N_( \
"This forces the cropping of the source video. " \
SNAP_PREVIEW_LONGTEXT, VLC_FALSE );
add_bool( "snapshot-sequential", VLC_FALSE, NULL, SNAP_SEQUENTIAL_TEXT,
SNAP_SEQUENTIAL_LONGTEXT, VLC_FALSE );
+ add_integer( "snapshot-width", 320, NULL, SNAP_WIDTH_TEXT,
+ SNAP_WIDTH_LONGTEXT, VLC_TRUE );
+ add_integer( "snapshot-height", 200, NULL, SNAP_HEIGHT_TEXT,
+ SNAP_HEIGHT_LONGTEXT, VLC_TRUE );
set_section( N_("Window properties" ), NULL );
add_integer( "width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_TRUE );
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, "snapshot-width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+ var_Create( p_vout, "snapshot-height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
/* FIXME: should not be hardcoded. We should be able to
specify the snapshot size (snapshot-width and snapshot-height). */
- fmt_out.i_width = 320;
- fmt_out.i_height = 200;
+ fmt_out.i_width = var_GetInteger( p_vout, "snapshot-width" );
+ fmt_out.i_height = var_GetInteger( p_vout, "snapshot-height" );
fmt_out.i_chroma = VLC_FOURCC( 'p','n','g',' ' );
+
p_block = ( block_t* ) image_Write( p_image, p_pic, &fmt_in, &fmt_out );
if( !p_block )
{
return VLC_SUCCESS;
}
-
#if defined(__APPLE__) || defined(SYS_BEOS)
if( !val.psz_string && p_vout->p_libvlc->psz_homedir )
{
* Did the user specify a directory? If not, path = NULL.
*/
path = utf8_opendir ( (const char *)val.psz_string );
-
if ( path != NULL )
{
char *psz_prefix = var_GetNonEmptyString( p_vout, "snapshot-prefix" );
p_vout->i_title_position = newval.i_int;
return VLC_SUCCESS;
}
-