[vlc-commits] qt: convert vlc_tick_t to seconds explicitly using SEC_FROM_VLC_TICK()

Steve Lhomme git at videolan.org
Thu Jul 5 16:57:27 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jun 12 12:20:25 2018 +0200| [4d3d478545af7b9dfa88b9298c92d0fd0fcffb2e] | committer: Steve Lhomme

qt: convert vlc_tick_t to seconds explicitly using SEC_FROM_VLC_TICK()

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

 modules/gui/qt/components/interface_widgets.cpp | 2 +-
 modules/gui/qt/components/playlist/selector.cpp | 2 +-
 modules/gui/qt/components/playlist/sorting.h    | 2 +-
 modules/gui/qt/dialogs/gototime.cpp             | 2 +-
 modules/gui/qt/input_manager.cpp                | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp
index dc4f45188a..6eebd0ba8c 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -996,7 +996,7 @@ void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
         return;
     }
 
-    int time = t / 1000000;
+    int time = SEC_FROM_VLC_TICK(t);
 
     secstotimestr( psz_length, length );
     secstotimestr( psz_time, ( b_remainingTime && length ) ? length - time
diff --git a/modules/gui/qt/components/playlist/selector.cpp b/modules/gui/qt/components/playlist/selector.cpp
index c77acdc2cf..a2f81995ac 100644
--- a/modules/gui/qt/components/playlist/selector.cpp
+++ b/modules/gui/qt/components/playlist/selector.cpp
@@ -206,7 +206,7 @@ void PLSelector::updateTotalDuration( PLSelItem* item, const char* prefix )
     /* Formatting time */
     QString qs_timeLabel( prefix );
 
-    int i_seconds = mt_duration / CLOCK_FREQ;
+    int i_seconds = SEC_FROM_VLC_TICK(mt_duration);
     int i_minutes = i_seconds / 60;
     i_seconds = i_seconds % 60;
     if( i_minutes >= 60 )
diff --git a/modules/gui/qt/components/playlist/sorting.h b/modules/gui/qt/components/playlist/sorting.h
index 3b81ea32ad..f870e218b2 100644
--- a/modules/gui/qt/components/playlist/sorting.h
+++ b/modules/gui/qt/components/playlist/sorting.h
@@ -86,7 +86,7 @@ static inline char * psz_column_meta( input_item_t *p_item, uint32_t i_column )
     case COLUMN_TITLE:
         return input_item_GetTitleFbName( p_item );
     case COLUMN_DURATION:
-        i_duration = input_item_GetDuration( p_item ) / CLOCK_FREQ;
+        i_duration = SEC_FROM_VLC_TICK( input_item_GetDuration( p_item ) );
         if( i_duration == 0 ) return NULL;
         secstotimestr( psz_duration, i_duration );
         return strdup( psz_duration );
diff --git a/modules/gui/qt/dialogs/gototime.cpp b/modules/gui/qt/dialogs/gototime.cpp
index 727a8a3c31..3da01cc412 100644
--- a/modules/gui/qt/dialogs/gototime.cpp
+++ b/modules/gui/qt/dialogs/gototime.cpp
@@ -89,7 +89,7 @@ void GotoTimeDialog::toggleVisible()
     if ( !isVisible() && THEMIM->getIM()->hasInput() )
     {
         int64_t i_time = var_GetInteger( THEMIM->getInput(), "time" );
-        timeEdit->setTime( timeEdit->time().addSecs( i_time / CLOCK_FREQ ) );
+        timeEdit->setTime( timeEdit->time().addSecs( SEC_FROM_VLC_TICK(i_time) ) );
     }
     QVLCDialog::toggleVisible();
     if(isVisible())
diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index 1a06d41f97..97892ee877 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -432,7 +432,7 @@ void InputManager::UpdatePosition()
     int64_t i_length = var_GetInteger(  p_input , "length" );
     int64_t i_time = var_GetInteger(  p_input , "time");
     float f_pos = var_GetFloat(  p_input , "position" );
-    emit positionUpdated( f_pos, i_time, i_length / CLOCK_FREQ );
+    emit positionUpdated( f_pos, i_time, SEC_FROM_VLC_TICK(i_length) );
 }
 
 void InputManager::UpdateNavigation()



More information about the vlc-commits mailing list