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

Boy van Amstel boy at boyvanamstel.nl
Mon Jul 21 17:45:11 CEST 2014


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>
---
 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 15ef91d02ae6694f6be27dd8ac839cae4e61c3c4..8ade5baf30156f66ddfc0348a262914601b3acc5 100644
GIT binary patch
delta 581
zcmZn`*e at WMRFIQdTw-8wg^`Jwg*AEZyp4kDjFYRFWG3q|iLr+GhX(mf&SI3E+`|}e
z7U5q|l9`{Em=h9GS&$m%SWu9Y>ROhXSK^$Xk{TT88XVyl>{ptblv)%L9O4#y+1SL?
z%-jNIm~4nU(6D#`(J&wP)Dj>wIJqdZ0H`-NH!&||a{<#0Mw<lPM16xKxIJiA08MoY
zzL=647v|#(vOF_65#*lBY3Ui6v*%21VNn&nnU$TBo0nfuSX5kI)7aY8KY9A(T`b9L
zE~&+pdC8N-Sru7IbW6)7+pwyzRaEL$RU1qeWRsX&$I8i8Tc at jE-vH!FPhP<)#MacT
ztKR~WmF9E_z1-HWtKZQHmi*7k!`9uStKZuP<m$3bn5bJd38K!?<?@uNx>eJlys*nN
zX6owC0_l>O+`^V&?9Ld%n8ldS*v{C)IGJ$)<9f!OjF%X%Gu~o+!uXo;3*%2F4kjKZ
zQ6?!SMJ59#Tc%*9h{^Ko!S&%RX)M_+c`UUoEiC;k^H^50>|wdga-ZcX%U at POR!LS>
zRzp at -Rxj2_);QK&))LlQ)*jY=)+wyBS(mVGX5GPhob?>*b=GIBuUS8_{$}H1<7bm#
zlV{UlGiS45^JWWTi)PDW%V#TNt7q$Do6I(gZ86&>w(V?t*lw`hWdH&h1_mZZ5CaJ2
KLns)@_7DI%xUanc

delta 551
zcmdll&@3RBRFIQdTw-8wg^`Jwg*AD`%#DKTjFSzRl=<Tv3kq^lUCUDQN}TgkQYYs#
z%Cd&|hX(mf?qQ5K3kj(#NJUc;;a^aanV*-K6X6%^SDKrYS`-o-;uahn=^A|5*u>P#
z+yaNek}U2(b2k?--C(rQNl4UBGQ?#v&_Ji)iz%sbVLr|v_hlw0f~>rpmY$J0ZTjRE
z7FEF;S=l+cdHDr}MP=0uEuDRnChuWMo~+F(%~GsWQaag-RfVm*LZ`Ayf3iHA#N-}U
zPPUp_9mBeMAXj?wHdZ0F#wH!ZW{|8jr%UMN);1l(_71QlFB=bASGSH~PcM+G%ho?Z
zr*a}honzSL$y0O;r-IbUOy0(pVeHBn&6vg5#MsW*!#J670pohcos5?luQT3ae8Tve
z at dM+3CJrV+CNU-{CPgMaCKsk)rtHaq?7{W1ENLv+EO{)oEG;bkEb~}avg~5H$a0tE
zG0SgOepYc-Wma=m8&+ at D0M>ZcG}e69I at U(kHr8I&X{<|GSF!G7J-~XB^#<!*)+elQ
zS^uyxvT?BqvPrRNvgxtevbnJNvc<3^vSqLpvNf=^vURa7V_VGt226|)T8Lp5gaISj
G)&l^KVWe~b

diff --git a/extras/package/macosx/Resources/vlc.scriptTerminology b/extras/package/macosx/Resources/vlc.scriptTerminology
index 22644e7fbd2167a060cc9ed7a35d688aecc91293..3617dbd7a1e4e97fc637c2aaf4f53612e3e27bb8 100644
GIT binary patch
delta 379
zcmca1a7R!usURn_xWvHV3L_IU3#*xV%0|Hy7M;YT<S56IlA_F{(vsBTsDPZ(qQo4(
z#N5=Iws!Uoj!w=lu5O+_{z0J;(Q%XKvm~>*q!w4^B~SjtqRiy(F<Ft-mC4I{at5mp
zlds?8ZLG>n0fCcmvxYGRhfFqRvu6qmpIpMGS|1q|lUSOPnXixn)*UYp8IqBzfGm_z
zl%JPbl~|IQpQlhzl$w at Wl$w{Es*qNcpR1s2WN2b;Vqt7%VxdryuK?$n>nN0G02L}2
zC}b7`jZRA}%_+IW!W0t=wXG~ar!+S;USRSnHV>xwgvnpn{^l=a*}-yz<rK>!mTxTo
zSh-lmShZO7SshsmS<6_PS@*LZVLiqAg!LsG3!4p_BU=PpEn5>?7uyoHm2BJCh1kW}
hRoJuH3)tJ)*RY>wzs>%F0SuTJAv8lOl!j95p8&gyaTx#r

delta 237
zcmca3ctb!isURn_xWvHV3L_IU3#*xV!bZUq7OmL0_$bGclA_F{(vsBTsDPZ(qQo4(
z#N5;yws!Uoj!w=lt{&cgfg#~hlNYiiPZnU6WpZ<$tk3Go<molJjMaz9$9M7(R%Ist
zfXOde!<d4CCp)s)GlhmtZemkqiin&n&K}Mb9W%Lr{crkwmTfGDSWd7!VEMxGhn0g>
zhE<W(m^GO-gSC`(BkMNSJ*?MQZ?k at 5(_=Gc^J2?qD`Bf)o5nVqZ3WwVwlD15>;~+?
W?D6b53}C>-2%#Agp){0YF9QJ97(WpJ

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;
-- 
1.9.3




More information about the vlc-devel mailing list