macosx: implemented A->B Loop (close #5187)

This commit is contained in:
Felix Paul Kühne 2012-11-15 20:17:28 +01:00
parent 2974427561
commit 6ebb704940
6 changed files with 1403 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,7 @@
@interface VLCCoreInteraction : NSObject {
int i_currentPlaybackRate;
mtime_t timeA, timeB;
}
+ (VLCCoreInteraction *)sharedInstance;
@property (readwrite) int volume;
@ -61,6 +62,8 @@
- (void)repeatAll;
- (void)repeatOff;
- (void)shuffle;
- (void)setAtoB;
- (void)updateAtoB;
- (void)volumeUp;
- (void)volumeDown;

View File

@ -417,6 +417,39 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
}
}
- (void)setAtoB
{
if (!timeA) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
timeA = var_GetTime(p_input, "time");
vlc_object_release(p_input);
}
} else if (!timeB) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
timeB = var_GetTime(p_input, "time");
vlc_object_release(p_input);
}
} else {
timeA = 0;
timeB = 0;
}
}
- (void)updateAtoB
{
if (timeB) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
mtime_t currentTime = var_GetTime(p_input, "time");
if ( currentTime >= timeB || currentTime < timeA)
var_SetTime(p_input, "time", timeA);
vlc_object_release(p_input);
}
}
}
- (void)volumeUp
{
intf_thread_t *p_intf = VLCIntf;

View File

@ -102,6 +102,7 @@
IBOutlet NSMenuItem * o_mi_random;
IBOutlet NSMenuItem * o_mi_repeat;
IBOutlet NSMenuItem * o_mi_loop;
IBOutlet NSMenuItem * o_mi_AtoBloop;
IBOutlet NSMenuItem * o_mi_quitAfterPB;
IBOutlet NSMenuItem * o_mi_fwd;
IBOutlet NSMenuItem * o_mi_bwd;
@ -231,6 +232,7 @@
- (void)updateRecordState:(BOOL)b_value;
- (IBAction)setPlaybackRate:(id)sender;
- (void)updatePlaybackRate;
- (IBAction)toggleAtoBloop:(id)sender;
- (IBAction)toggleFullscreen:(id)sender;
- (IBAction)resizeVideoWindow:(id)sender;

View File

@ -320,6 +320,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_random setTitle: _NS("Random")];
[o_mi_repeat setTitle: _NS("Repeat One")];
[o_mi_loop setTitle: _NS("Repeat All")];
[o_mi_AtoBloop setTitle: _NS("A→B Loop")];
[o_mi_quitAfterPB setTitle: _NS("Quit after Playback")];
[o_mi_fwd setTitle: _NS("Step Forward")];
[o_mi_bwd setTitle: _NS("Step Backward")];
@ -693,6 +694,11 @@ static VLCMainMenu *_o_sharedInstance = nil;
[o_mi_rate_sld setIntValue: i];
}
- (IBAction)toggleAtoBloop:(id)sender
{
[[VLCCoreInteraction sharedInstance] setAtoB];
}
#pragma mark -
#pragma mark video menu

View File

@ -1328,6 +1328,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (void)updatePlaybackPosition
{
[o_mainwindow updateTimeSlider];
[[VLCCoreInteraction sharedInstance] updateAtoB];
}
- (void)updateVolume