]> git.sesse.net Git - vlc/commitdiff
Support changing 'audio desync' via AppleScript on OSX
authorBoy van Amstel <boy@boyvanamstel.nl>
Mon, 21 Jul 2014 15:45:11 +0000 (17:45 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Wed, 23 Jul 2014 20:12:13 +0000 (22:12 +0200)
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: Boy van Amstel <boy@boyvanamstel.nl>
Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
extras/package/macosx/Resources/vlc.scriptSuite
extras/package/macosx/Resources/vlc.scriptTerminology
modules/gui/macosx/applescript.h
modules/gui/macosx/applescript.m

index 15ef91d02ae6694f6be27dd8ac839cae4e61c3c4..8ade5baf30156f66ddfc0348a262914601b3acc5 100644 (file)
Binary files a/extras/package/macosx/Resources/vlc.scriptSuite and b/extras/package/macosx/Resources/vlc.scriptSuite differ
index 22644e7fbd2167a060cc9ed7a35d688aecc91293..3617dbd7a1e4e97fc637c2aaf4f53612e3e27bb8 100644 (file)
Binary files a/extras/package/macosx/Resources/vlc.scriptTerminology and b/extras/package/macosx/Resources/vlc.scriptTerminology differ
index 1021687bf93e8b29a1df15cac62cfcd930d817a7..71dff0c399d7a7330fac6de2b5ecc9ae872a0229 100644 (file)
@@ -42,6 +42,7 @@
 
 @property (readwrite) BOOL scriptFullscreenMode;
 @property (readwrite) int audioVolume;
+@property (readwrite) int audioDesync;
 @property (readwrite) int currentTime;
 @property (readonly) int durationOfCurrentItem;
 @property (readonly) NSString *pathOfCurrentItem;
index c97951ab70937edd28c338aaa3a4c278ead3ab68..2d9273be73cda86aa7929bf72ceb888326586e72 100644 (file)
     [[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 {
     input_thread_t * p_input = pl_CurrentInput(VLCIntf);
     int64_t i_currentTime = -1;