[vlc-commits] macosx: fix resume playback feature
David Fuhrmann
git at videolan.org
Tue May 13 21:15:46 CEST 2014
vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat May 10 17:38:34 2014 +0200| [ecbbbe20466bd54da0125f29b49a2634aea4540e] | committer: David Fuhrmann
macosx: fix resume playback feature
close #11471
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ecbbbe20466bd54da0125f29b49a2634aea4540e
---
modules/gui/macosx/playlist.m | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/modules/gui/macosx/playlist.m b/modules/gui/macosx/playlist.m
index d464763..9c5e26b 100644
--- a/modules/gui/macosx/playlist.m
+++ b/modules/gui/macosx/playlist.m
@@ -1486,11 +1486,11 @@
free(psz_url);
NSNumber *lastPosition = [recentlyPlayedFiles objectForKey:url];
- if (lastPosition.intValue > 0) {
+ if (lastPosition && lastPosition.intValue > 0) {
msg_Dbg(VLCIntf, "last playback position for %s was %i", [url UTF8String], lastPosition.intValue);
int settingValue = config_GetInt(VLCIntf, "macosx-continue-playback");
- NSInteger returnValue = 0;
+ NSInteger returnValue = NSAlertErrorReturn;
if (settingValue == 0) {
NSAlert *theAlert = [NSAlert alertWithMessageText:_NS("Continue playback?") defaultButton:_NS("Continue") alternateButton:_NS("Restart playback") otherButton:_NS("Always continue") informativeTextWithFormat:_NS("Playback of \"%@\" will continue at %@"), [NSString stringWithUTF8String:input_item_GetTitleFbName(p_input)], [[VLCStringUtility sharedInstance] stringForTime:lastPosition.intValue]];
@@ -1501,10 +1501,11 @@
PL_LOCK;
}
- if (returnValue !=0 || settingValue == 1)
- input_item_AddOption(p_input, [[NSString stringWithFormat:@"start-time=%i", lastPosition.intValue] UTF8String], VLC_INPUT_OPTION_TRUSTED);
+ if (returnValue == NSAlertAlternateReturn || settingValue == 2)
+ lastPosition = [NSNumber numberWithInt:0];
+ input_item_AddOption(p_input, [[NSString stringWithFormat:@"start-time=%i", lastPosition.intValue] UTF8String], VLC_INPUT_OPTION_TRUSTED | VLC_INPUT_OPTION_REPLACE);
- if (returnValue == -1)
+ if (returnValue == NSAlertOtherReturn)
config_PutInt(VLCIntf, "macosx-continue-playback", 1);
}
}
More information about the vlc-commits
mailing list