Commit 89885149 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* src/libvlc.h: Added a "snapshot-format" option to be able to select png or jpg (png default)

* src/video_output/vout_intf.c: use above option and set the default destination for snapshots
   on OS X to the Desktop.
* REST: Add the Snapshot command to the menu's etc.
parent 0895cfab
......@@ -197,6 +197,7 @@
"o_mi_services" = id;
"o_mi_show_all" = id;
"o_mi_slower" = id;
"o_mi_snapshot" = id;
"o_mi_stop" = id;
"o_mi_subtitle" = id;
"o_mi_title" = id;
......
......@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>47 61 505 517 0 0 800 578 </string>
<string>25 92 505 517 0 0 1280 938 </string>
<key>IBEditorPositions</key>
<dict>
<key>1617</key>
......@@ -11,7 +11,7 @@
<key>2197</key>
<string>237 313 596 367 0 0 1024 746 </string>
<key>29</key>
<string>421 486 419 44 0 0 800 578 </string>
<string>326 879 419 44 0 0 1280 938 </string>
<key>915</key>
<string>731 416 165 180 0 0 1024 746 </string>
</dict>
......@@ -27,6 +27,7 @@
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
<integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>7S215</string>
......
......@@ -292,6 +292,10 @@
if( ![o_window isZoomed] )
[o_window performZoom:self];
}
else if( [o_title isEqualToString: _NS("Snapshot") ] )
{
[o_window snapshot];
}
else
{
vlc_value_t val;
......@@ -634,6 +638,7 @@
[[o_mi title] isEqualToString: _NS("Normal Size")] ||
[[o_mi title] isEqualToString: _NS("Double Size")] ||
[[o_mi title] isEqualToString: _NS("Fit to Screen")] ||
[[o_mi title] isEqualToString: _NS("Snapshot")] ||
[[o_mi title] isEqualToString: _NS("Float on Top")] )
{
id o_window;
......
......@@ -195,6 +195,7 @@ struct intf_sys_t
IBOutlet id o_mi_fittoscreen;
IBOutlet id o_mi_fullscreen;
IBOutlet id o_mi_floatontop;
IBOutlet id o_mi_snapshot;
IBOutlet id o_mi_videotrack;
IBOutlet id o_mu_videotrack;
IBOutlet id o_mi_screen;
......
......@@ -366,6 +366,9 @@ static VLCMain *_o_sharedMainInstance = nil;
i_key = config_GetInt( p_intf, "key-fullscreen" );
[o_mi_fullscreen setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_fullscreen setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
i_key = config_GetInt( p_intf, "key-snapshot" );
[o_mi_snapshot setKeyEquivalent: [NSString stringWithFormat:@"%C", VLCKeyToCocoa( i_key )]];
[o_mi_snapshot setKeyEquivalentModifierMask: VLCModifiersToCocoa(i_key)];
var_Create( p_intf, "intf-change", VLC_VAR_BOOL );
......@@ -477,6 +480,7 @@ static VLCMain *_o_sharedMainInstance = nil;
[o_mi_fittoscreen setTitle: _NS("Fit to Screen")];
[o_mi_fullscreen setTitle: _NS("Fullscreen")];
[o_mi_floatontop setTitle: _NS("Float on Top")];
[o_mi_snapshot setTitle: _NS("Snapshot")];
[o_mi_videotrack setTitle: _NS("Video Track")];
[o_mu_videotrack setTitle: _NS("Video Track")];
[o_mi_screen setTitle: _NS("Video Device")];
......
......@@ -48,6 +48,7 @@
- (void)toggleFloatOnTop;
- (void)toggleFullscreen;
- (BOOL)isFullscreen;
- (void)snapshot;
- (void)updateTitle;
- (BOOL)windowShouldClose:(id)sender;
......
......@@ -333,6 +333,11 @@
return( p_vout->b_fullscreen );
}
- (void)snapshot
{
vout_Control( p_vout, VOUT_SNAPSHOT );
}
- (BOOL)canBecomeKeyWindow
{
return YES;
......
......@@ -36,6 +36,9 @@ static char *ppsz_language_text[] =
N_("Norwegian"), N_("Polish"), N_("Brazilian"), N_("Russian"),
N_("Swedish") };
static char *ppsz_snap_formats[] =
{ "png", "jpg" };
/*****************************************************************************
* Configuration options for the main program. Each module will also separatly
* define its own configuration options.
......@@ -257,6 +260,11 @@ static char *ppsz_align_descriptions[] =
"Allows you to specify the directory where the video snapshots will " \
"be stored.")
#define SNAP_FORMAT_TEXT N_("Video snapshot format")
#define SNAP_FORMAT_LONGTEXT N_( \
"Allows you to specify the image format in which the video snapshots will " \
"be stored.")
#define ASPECT_RATIO_TEXT N_("Source aspect ratio")
#define ASPECT_RATIO_LONGTEXT N_( \
"This will force the source aspect ratio. For instance, some DVDs claim " \
......@@ -898,6 +906,9 @@ vlc_module_begin();
ASPECT_RATIO_TEXT, ASPECT_RATIO_LONGTEXT, VLC_TRUE );
add_directory( "snapshot-path", NULL, 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 );
set_subcategory( SUBCAT_VIDEO_VOUT );
add_module( "vout", "video output", NULL, NULL, VOUT_TEXT, VOUT_LONGTEXT,
......@@ -1195,14 +1206,14 @@ vlc_module_begin();
# define KEY_VOL_UP KEY_MODIFIER_COMMAND|KEY_UP
# define KEY_VOL_DOWN KEY_MODIFIER_COMMAND|KEY_DOWN
# define KEY_VOL_MUTE KEY_MODIFIER_COMMAND|KEY_MODIFIER_SHIFT|'m'
# define KEY_SUBDELAY_UP KEY_MODIFIER_COMMAND|'k'
# define KEY_SUBDELAY_DOWN KEY_MODIFIER_COMMAND|'j'
# define KEY_AUDIODELAY_UP KEY_MODIFIER_COMMAND|'h'
# define KEY_AUDIODELAY_DOWN KEY_MODIFIER_COMMAND|'g'
# define KEY_SUBDELAY_UP KEY_MODIFIER_COMMAND|'j'
# define KEY_SUBDELAY_DOWN KEY_MODIFIER_COMMAND|'h'
# define KEY_AUDIODELAY_UP KEY_MODIFIER_COMMAND|'l'
# define KEY_AUDIODELAY_DOWN KEY_MODIFIER_COMMAND|'k'
# define KEY_AUDIO_TRACK 'l'
# define KEY_SUBTITLE_TRACK 's'
# define KEY_INTF_SHOW 'i'
# define KEY_SNAPSHOT KEY_MODIFIER_CTRL|'s'
# define KEY_SNAPSHOT KEY_MODIFIER_COMMAND|KEY_MODIFIER_ALT|'s'
# define KEY_SET_BOOKMARK1 KEY_MODIFIER_COMMAND|KEY_F1
# define KEY_SET_BOOKMARK2 KEY_MODIFIER_COMMAND|KEY_F2
......
......@@ -175,6 +175,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
/* 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-format", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | 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 );
......@@ -259,7 +260,7 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
char *psz_filename;
subpicture_t *p_subpic;
picture_t *p_pif;
vlc_value_t val;
vlc_value_t val, format;
int i_ret;
var_Get( p_vout, "snapshot-path", &val );
......@@ -268,20 +269,35 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
free( val.psz_string );
val.psz_string = 0;
}
#ifdef SYS_DARWIN
if( !val.psz_string && p_vout->p_vlc->psz_homedir )
{
asprintf( &val.psz_string, "%s/Desktop",
p_vout->p_vlc->psz_homedir );
}
#else
if( !val.psz_string && p_vout->p_vlc->psz_homedir )
{
asprintf( &val.psz_string, "%s/" CONFIG_DIR,
p_vout->p_vlc->psz_homedir );
}
#endif
if( !val.psz_string )
{
msg_Err( p_vout, "no directory specified for snapshots" );
return VLC_EGENERIC;
}
var_Get( p_vout, "snapshot-format", &format );
if( format.psz_string && !*format.psz_string )
{
free( format.psz_string );
format.psz_string = strdup( "png" );
}
asprintf( &psz_filename, "%s/vlcsnap-%u.png", val.psz_string,
(unsigned int)(p_pic->date / 100000) & 0xFFFFFF );
asprintf( &psz_filename, "%s/vlcsnap-%u.%s", val.psz_string,
(unsigned int)(p_pic->date / 100000) & 0xFFFFFF, format.psz_string );
free( val.psz_string );
free( format.psz_string );
/* Save the snapshot */
fmt_in.i_chroma = p_vout->render.i_chroma;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment