Commit c941d176 authored by Boy van Amstel's avatar Boy van Amstel Committed by Felix Paul Kühne

Support changing 'audio desync' via AppleScript on OSX

Like being able to change the volume, seek position etc. via
AppleScript, this commit allows you to change the audio desync in ms.

Example:
tell application "VLC"
  -- set audio desync to 0
  set audio desync to -2250
  get audio desync
end tell
Signed-off-by: default avatarBoy van Amstel <boy@boyvanamstel.nl>
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 8dcec799
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
@property (readwrite) BOOL scriptFullscreenMode; @property (readwrite) BOOL scriptFullscreenMode;
@property (readwrite) int audioVolume; @property (readwrite) int audioVolume;
@property (readwrite) int audioDesync;
@property (readwrite) int currentTime; @property (readwrite) int currentTime;
@property (readonly) int durationOfCurrentItem; @property (readonly) int durationOfCurrentItem;
@property (readonly) NSString *pathOfCurrentItem; @property (readonly) NSString *pathOfCurrentItem;
......
...@@ -212,6 +212,28 @@ ...@@ -212,6 +212,28 @@
[[VLCCoreInteraction sharedInstance] setVolume:(int)i_audioVolume]; [[VLCCoreInteraction sharedInstance] setVolume:(int)i_audioVolume];
} }
- (int) audioDesync {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
int i_delay = -1;
if(!p_input)
return i_delay;
i_delay = var_GetTime(p_input, "audio-delay");
vlc_object_release(p_input);
return (i_delay / 1000);
}
- (void) setAudioDesync:(int)i_audioDesync {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if(!p_input)
return;
var_SetTime(p_input, "audio-delay", i_audioDesync * 1000);
vlc_object_release(p_input);
}
- (int) currentTime { - (int) currentTime {
input_thread_t * p_input = pl_CurrentInput(VLCIntf); input_thread_t * p_input = pl_CurrentInput(VLCIntf);
int64_t i_currentTime = -1; int64_t i_currentTime = -1;
......
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