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

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jul  3 16:07:22 2018 +0200| [026e60e3428583ad2ab898553d1130afe95fd265] | committer: Steve Lhomme

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

Convert the read/writes accordingly

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

 include/vlc_input.h                                          | 4 ++--
 lib/video.c                                                  | 4 ++--
 modules/control/hotkeys.c                                    | 6 +++---
 modules/gui/macosx/VLCTrackSynchronizationWindowController.m | 4 ++--
 modules/gui/qt/components/extended_panels.cpp                | 2 +-
 src/input/control.c                                          | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 8349975a15..f22a3716ec 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -415,8 +415,8 @@ enum input_query_e
     /* input variable "audio-delay" and "sub-delay" */
     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 */
+    INPUT_GET_SPU_DELAY,        /* arg1 = vlc_tick_t* res=can fail */
+    INPUT_SET_SPU_DELAY,        /* arg1 = vlc_tick_t  res=can fail */
 
     /* Menu (VCD/DVD/BD) Navigation */
     /** Activate the navigation item selected. res=can fail */
diff --git a/lib/video.c b/lib/video.c
index 1aa3a0a3d8..8a3657cc18 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -386,7 +386,7 @@ int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi )
 
     if( p_input_thread )
     {
-        val = var_GetInteger( p_input_thread, "spu-delay" );
+        val = US_FROM_VLC_TICK( var_GetInteger( p_input_thread, "spu-delay" ) );
         vlc_object_release( p_input_thread );
     }
     else
@@ -405,7 +405,7 @@ int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi,
 
     if( p_input_thread )
     {
-        var_SetInteger( p_input_thread, "spu-delay", i_delay );
+        var_SetInteger( p_input_thread, "spu-delay", VLC_TICK_FROM_US( i_delay ) );
         vlc_object_release( p_input_thread );
         ret = 0;
     }
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 818e41237f..a5f0f7e001 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -685,14 +685,14 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
                 }
                 else
                 {
-                    int64_t i_current_subdelay = var_GetInteger( p_input, "spu-delay" );
+                    vlc_tick_t i_current_subdelay = var_GetInteger( p_input, "spu-delay" );
                     int64_t i_additional_subdelay = p_sys->subtitle_delaybookmarks.i_time_audio - p_sys->subtitle_delaybookmarks.i_time_subtitle;
-                    int64_t i_total_subdelay = i_current_subdelay + i_additional_subdelay;
+                    vlc_tick_t i_total_subdelay = i_current_subdelay + i_additional_subdelay;
                     var_SetInteger( p_input, "spu-delay", i_total_subdelay);
                     ClearChannels( p_vout, slider_chan );
                     DisplayMessage( p_vout, _( "Sub sync: corrected %i ms (total delay = %i ms)" ),
                                             (int)(i_additional_subdelay / 1000),
-                                            (int)(i_total_subdelay / 1000) );
+                                            MS_FROM_VLC_TICK( i_total_subdelay ) );
                     p_sys->subtitle_delaybookmarks.i_time_audio = 0;
                     p_sys->subtitle_delaybookmarks.i_time_subtitle = 0;
                 }
diff --git a/modules/gui/macosx/VLCTrackSynchronizationWindowController.m b/modules/gui/macosx/VLCTrackSynchronizationWindowController.m
index 4eb44fd47d..2c6686756a 100644
--- a/modules/gui/macosx/VLCTrackSynchronizationWindowController.m
+++ b/modules/gui/macosx/VLCTrackSynchronizationWindowController.m
@@ -132,7 +132,7 @@
 
     if (p_input) {
         [_av_advanceTextField setDoubleValue: secf_from_vlc_tick(var_GetInteger(p_input, "audio-delay"))];
-        [_sv_advanceTextField setDoubleValue: var_GetInteger(p_input, "spu-delay") / 1000000.];
+        [_sv_advanceTextField setDoubleValue: secf_from_vlc_tick(var_GetInteger(p_input, "spu-delay"))];
         [_sv_speedTextField setFloatValue: var_GetFloat(p_input, "sub-fps")];
         vlc_object_release(p_input);
     }
@@ -166,7 +166,7 @@
     input_thread_t * p_input = pl_CurrentInput(getIntf());
 
     if (p_input) {
-        var_SetInteger(p_input, "spu-delay", [_sv_advanceTextField doubleValue] * 1000000.);
+        var_SetInteger(p_input, "spu-delay", vlc_tick_from_sec([_sv_advanceTextField doubleValue]));
         vlc_object_release(p_input);
     }
 }
diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index 3a32e5b57e..bf9f3a1ea4 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -1498,7 +1498,7 @@ void SyncControls::update()
         i_delay = var_GetInteger( THEMIM->getInput(), "audio-delay" );
         AVSpin->setValue( secf_from_vlc_tick( i_delay ) );
         i_delay = var_GetInteger( THEMIM->getInput(), "spu-delay" );
-        subsSpin->setValue( ( (double)i_delay ) / CLOCK_FREQ );
+        subsSpin->setValue( secf_from_vlc_tick( i_delay ) );
         subSpeedSpin->setValue( var_GetFloat( THEMIM->getInput(), "sub-fps" ) );
         subDurationSpin->setValue( var_InheritFloat( p_intf, SUBSDELAY_CFG_FACTOR ) );
     }
diff --git a/src/input/control.c b/src/input/control.c
index 3ebb7d8d93..133f76ebed 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -127,7 +127,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             return VLC_SUCCESS;
 
         case INPUT_GET_SPU_DELAY:
-            pi_64 = va_arg( args, int64_t * );
+            pi_64 = va_arg( args, vlc_tick_t * );
             *pi_64 = var_GetInteger( p_input, "spu-delay" );
             return VLC_SUCCESS;
 
@@ -136,7 +136,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
             return var_SetInteger( p_input, "audio-delay", i_64 );
 
         case INPUT_SET_SPU_DELAY:
-            i_64 = va_arg( args, int64_t );
+            i_64 = va_arg( args, vlc_tick_t );
             return var_SetInteger( p_input, "spu-delay", i_64 );
 
         case INPUT_NAV_ACTIVATE:



More information about the vlc-commits mailing list