[vlc-commits] core: the "audio-delay" is stored in vlc_tick_t

Steve Lhomme git at videolan.org
Tue Jul 3 16:13:57 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jul  3 15:57:48 2018 +0200| [f648e3d5b5a2b205225b2c74e47bf0cfe176c909] | committer: Steve Lhomme

core: the "audio-delay" is stored in vlc_tick_t

Convert the read/writes accordingly

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

 include/vlc_input.h                                          |  4 ++--
 lib/audio.c                                                  |  4 ++--
 modules/gui/macosx/VLCTrackSynchronizationWindowController.m |  4 ++--
 modules/gui/macosx/applescript.m                             | 10 +++++-----
 modules/gui/qt/components/extended_panels.cpp                |  4 ++--
 src/input/control.c                                          |  4 ++--
 src/input/var.c                                              |  2 +-
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 7c758eb00f..8349975a15 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -413,8 +413,8 @@ enum input_query_e
     INPUT_SET_STATE,            /* arg1= int            res=can fail    */
 
     /* input variable "audio-delay" and "sub-delay" */
-    INPUT_GET_AUDIO_DELAY,      /* arg1 = int* res=can fail */
-    INPUT_SET_AUDIO_DELAY,      /* arg1 = int  res=can fail */
+    INPUT_GET_AUDIO_DELAY,      /* arg1 = vlc_tick_t* res=can fail */
+    INPUT_SET_AUDIO_DELAY,      /* arg1 = vlc_tick_t  res=can fail */
     INPUT_GET_SPU_DELAY,        /* arg1 = int* res=can fail */
     INPUT_SET_SPU_DELAY,        /* arg1 = int  res=can fail */
 
diff --git a/lib/audio.c b/lib/audio.c
index 4d35723023..a77a8b7002 100644
--- a/lib/audio.c
+++ b/lib/audio.c
@@ -450,7 +450,7 @@ int64_t libvlc_audio_get_delay( libvlc_media_player_t *p_mi )
     int64_t val = 0;
     if( p_input_thread != NULL )
     {
-      val = var_GetInteger( p_input_thread, "audio-delay" );
+      val = US_FROM_VLC_TICK( var_GetInteger( p_input_thread, "audio-delay" ) );
       vlc_object_release( p_input_thread );
     }
     return val;
@@ -465,7 +465,7 @@ int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay )
     int ret = 0;
     if( p_input_thread != NULL )
     {
-      var_SetInteger( p_input_thread, "audio-delay", i_delay );
+      var_SetInteger( p_input_thread, "audio-delay", VLC_TICK_FROM_US( i_delay ) );
       vlc_object_release( p_input_thread );
     }
     else
diff --git a/modules/gui/macosx/VLCTrackSynchronizationWindowController.m b/modules/gui/macosx/VLCTrackSynchronizationWindowController.m
index bf822fd64a..4eb44fd47d 100644
--- a/modules/gui/macosx/VLCTrackSynchronizationWindowController.m
+++ b/modules/gui/macosx/VLCTrackSynchronizationWindowController.m
@@ -131,7 +131,7 @@
     input_thread_t * p_input = pl_CurrentInput(getIntf());
 
     if (p_input) {
-        [_av_advanceTextField setDoubleValue: var_GetInteger(p_input, "audio-delay") / 1000000.];
+        [_av_advanceTextField setDoubleValue: secf_from_vlc_tick(var_GetInteger(p_input, "audio-delay"))];
         [_sv_advanceTextField setDoubleValue: var_GetInteger(p_input, "spu-delay") / 1000000.];
         [_sv_speedTextField setFloatValue: var_GetFloat(p_input, "sub-fps")];
         vlc_object_release(p_input);
@@ -151,7 +151,7 @@
     input_thread_t * p_input = pl_CurrentInput(getIntf());
 
     if (p_input) {
-        var_SetInteger(p_input, "audio-delay", [_av_advanceTextField doubleValue] * 1000000.);
+        var_SetInteger(p_input, "audio-delay", vlc_tick_from_sec([_av_advanceTextField doubleValue]));
         vlc_object_release(p_input);
     }
 }
diff --git a/modules/gui/macosx/applescript.m b/modules/gui/macosx/applescript.m
index a74d901e33..a0f6ec1697 100644
--- a/modules/gui/macosx/applescript.m
+++ b/modules/gui/macosx/applescript.m
@@ -202,15 +202,15 @@
 
 - (int) audioDesync {
     input_thread_t * p_input = pl_CurrentInput(getIntf());
-    int i_delay = -1;
+    vlc_tick_t i_delay;
 
     if(!p_input)
-        return i_delay;
+        return -1;
 
-    i_delay = (int)var_GetInteger(p_input, "audio-delay");
+    i_delay = var_GetInteger(p_input, "audio-delay");
     vlc_object_release(p_input);
 
-    return (i_delay / 1000);
+    return MS_FROM_VLC_TICK( i_delay );
 }
 
 - (void) setAudioDesync:(int)i_audioDesync {
@@ -218,7 +218,7 @@
     if(!p_input)
         return;
 
-    var_SetInteger(p_input, "audio-delay", i_audioDesync * 1000);
+    var_SetInteger(p_input, "audio-delay", VLC_TICK_FROM_MS( i_audioDesync ));
     vlc_object_release(p_input);
 }
 
diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index 041dff4308..3a32e5b57e 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -1492,11 +1492,11 @@ void SyncControls::update()
 {
     b_userAction = false;
 
-    int64_t i_delay;
+    vlc_tick_t i_delay;
     if( THEMIM->getInput() )
     {
         i_delay = var_GetInteger( THEMIM->getInput(), "audio-delay" );
-        AVSpin->setValue( ( (double)i_delay ) / CLOCK_FREQ );
+        AVSpin->setValue( secf_from_vlc_tick( i_delay ) );
         i_delay = var_GetInteger( THEMIM->getInput(), "spu-delay" );
         subsSpin->setValue( ( (double)i_delay ) / CLOCK_FREQ );
         subSpeedSpin->setValue( var_GetFloat( THEMIM->getInput(), "sub-fps" ) );
diff --git a/src/input/control.c b/src/input/control.c
index d7505116fb..3ebb7d8d93 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -122,7 +122,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             return var_SetInteger( p_input, "state", i_int );
 
         case INPUT_GET_AUDIO_DELAY:
-            pi_64 = va_arg( args, int64_t * );
+            pi_64 = va_arg( args, vlc_tick_t * );
             *pi_64 = var_GetInteger( p_input, "audio-delay" );
             return VLC_SUCCESS;
 
@@ -132,7 +132,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             return VLC_SUCCESS;
 
         case INPUT_SET_AUDIO_DELAY:
-            i_64 = va_arg( args, int64_t );
+            i_64 = va_arg( args, vlc_tick_t );
             return var_SetInteger( p_input, "audio-delay", i_64 );
 
         case INPUT_SET_SPU_DELAY:
diff --git a/src/input/var.c b/src/input/var.c
index 3013b5f40d..a7ba25db79 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -173,7 +173,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
     /* Delay */
     var_Create( p_input, "audio-delay", VLC_VAR_INTEGER );
     var_SetInteger( p_input, "audio-delay",
-                    1000 * var_GetInteger( p_input, "audio-desync" ) );
+                    VLC_TICK_FROM_MS( var_GetInteger( p_input, "audio-desync" ) ) );
     var_Create( p_input, "spu-delay", VLC_VAR_INTEGER );
 
     val.i_int = -1;



More information about the vlc-commits mailing list