Commit 6ebb7049 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

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

parent 29744275
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -1328,6 +1328,7 @@ static VLCMain *_o_sharedMainInstance = nil;
- (void)updatePlaybackPosition
{
[o_mainwindow updateTimeSlider];
[[VLCCoreInteraction sharedInstance] updateAtoB];
}
- (void)updateVolume
......
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