[vlc-commits] Support changing 'audio desync' via AppleScript on OSX

Boy van Amstel git at videolan.org
Wed Jul 23 22:12:21 CEST 2014


vlc | branch: master | Boy van Amstel <boy at boyvanamstel.nl> | Mon Jul 21 17:45:11 2014 +0200| [c941d176d775ee9cb98a661eeb9b83efecc9fd0e] | committer: 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: Boy van Amstel <boy at boyvanamstel.nl>
Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c941d176d775ee9cb98a661eeb9b83efecc9fd0e
---

 extras/package/macosx/Resources/vlc.scriptSuite    |  Bin 2051 -> 2111 bytes
 .../package/macosx/Resources/vlc.scriptTerminology |  Bin 2136 -> 2268 bytes
 modules/gui/macosx/applescript.h                   |    1 +
 modules/gui/macosx/applescript.m                   |   22 ++++++++++++++++++++
 4 files changed, 23 insertions(+)

diff --git a/extras/package/macosx/Resources/vlc.scriptSuite b/extras/package/macosx/Resources/vlc.scriptSuite
index 15ef91d..8ade5ba 100644
Binary files a/extras/package/macosx/Resources/vlc.scriptSuite and b/extras/package/macosx/Resources/vlc.scriptSuite differ
diff --git a/extras/package/macosx/Resources/vlc.scriptTerminology b/extras/package/macosx/Resources/vlc.scriptTerminology
index 22644e7..3617dbd 100644
Binary files a/extras/package/macosx/Resources/vlc.scriptTerminology and b/extras/package/macosx/Resources/vlc.scriptTerminology differ
diff --git a/modules/gui/macosx/applescript.h b/modules/gui/macosx/applescript.h
index 1021687..71dff0c 100644
--- a/modules/gui/macosx/applescript.h
+++ b/modules/gui/macosx/applescript.h
@@ -42,6 +42,7 @@
 
 @property (readwrite) BOOL scriptFullscreenMode;
 @property (readwrite) int audioVolume;
+ at property (readwrite) int audioDesync;
 @property (readwrite) int currentTime;
 @property (readonly) int durationOfCurrentItem;
 @property (readonly) NSString *pathOfCurrentItem;
diff --git a/modules/gui/macosx/applescript.m b/modules/gui/macosx/applescript.m
index c97951a..2d9273b 100644
--- a/modules/gui/macosx/applescript.m
+++ b/modules/gui/macosx/applescript.m
@@ -212,6 +212,28 @@
     [[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;



More information about the vlc-commits mailing list