[vlc-commits] dvdread: simplify dvdtime_to_time() with a parameter that's always 0

Steve Lhomme git at videolan.org
Tue Sep 18 16:42:48 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May  7 13:31:41 2018 +0200| [a0da4c0d8b8819717f20eb1315282ee3790cdc87] | committer: Steve Lhomme

dvdread: simplify dvdtime_to_time() with a parameter that's always 0

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

 modules/access/dvdread.c | 50 +++++++++++++++++++-----------------------------
 1 file changed, 20 insertions(+), 30 deletions(-)

diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c
index e19afbcf87..fd1c8ca7ed 100644
--- a/modules/access/dvdread.c
+++ b/modules/access/dvdread.c
@@ -290,41 +290,31 @@ static void Close( vlc_object_t *p_this )
     free( p_sys );
 }
 
-static vlc_tick_t dvdtime_to_time( dvd_time_t *dtime, uint8_t still_time )
+static vlc_tick_t dvdtime_to_time( dvd_time_t *dtime )
 {
 /* Macro to convert Binary Coded Decimal to Decimal */
 #define BCD2D(__x__) (((__x__ & 0xf0) >> 4) * 10 + (__x__ & 0x0f))
 
     double f_fps, f_ms;
-    vlc_tick_t i_micro_second;
 
-    if (still_time == 0 || still_time == 0xFF)
-    {
-        int64_t sec = (int64_t)(BCD2D(dtime->hour)) * 60 * 60;
-        sec += (int64_t)(BCD2D(dtime->minute)) * 60;
-        sec += (int64_t)(BCD2D(dtime->second));
+    int64_t sec = (int64_t)(BCD2D(dtime->hour)) * 60 * 60;
+    sec += (int64_t)(BCD2D(dtime->minute)) * 60;
+    sec += (int64_t)(BCD2D(dtime->second));
 
-        switch((dtime->frame_u & 0xc0) >> 6)
-        {
-        case 1:
-            f_fps = 25.0;
-            break;
-        case 3:
-            f_fps = 29.97;
-            break;
-        default:
-            f_fps = 2500.0;
-            break;
-        }
-        f_ms = BCD2D(dtime->frame_u&0x3f) * 1000.0 / f_fps;
-        i_micro_second = vlc_tick_from_sec(sec) + VLC_TICK_FROM_MS(f_ms);
-    }
-    else
+    switch((dtime->frame_u & 0xc0) >> 6)
     {
-        i_micro_second = vlc_tick_from_sec(still_time);
+    case 1:
+        f_fps = 25.0;
+        break;
+    case 3:
+        f_fps = 29.97;
+        break;
+    default:
+        f_fps = 2500.0;
+        break;
     }
-
-    return i_micro_second;
+    f_ms = BCD2D(dtime->frame_u&0x3f) * 1000.0 / f_fps;
+    return vlc_tick_from_sec(sec) + VLC_TICK_FROM_MS(f_ms);
 }
 
 /*****************************************************************************
@@ -365,7 +355,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             pi64 = va_arg( args, int64_t * );
             if( p_sys->cur_title >= 0 && p_sys->cur_title < p_sys->i_titles )
             {
-                *pi64 = (int64_t) dvdtime_to_time( &p_sys->p_cur_pgc->playback_time, 0 ) /
+                *pi64 = (int64_t) dvdtime_to_time( &p_sys->p_cur_pgc->playback_time ) /
                         p_sys->i_title_blocks * p_sys->i_title_offset;
                 return VLC_SUCCESS;
             }
@@ -376,7 +366,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             pi64 = va_arg( args, int64_t * );
             if( p_sys->cur_title >= 0 && p_sys->cur_title < p_sys->i_titles )
             {
-                *pi64 = (int64_t)dvdtime_to_time( &p_sys->p_cur_pgc->playback_time, 0 );
+                *pi64 = (int64_t)dvdtime_to_time( &p_sys->p_cur_pgc->playback_time );
                 return VLC_SUCCESS;
             }
             *pi64 = 0;
@@ -1265,10 +1255,10 @@ static void DvdReadHandleDSI( demux_t *p_demux, uint8_t *p_data )
              p_sys->dsi_pack.dsi_gi.vobu_ea,
              p_sys->dsi_pack.dsi_gi.vobu_vob_idn,
              p_sys->dsi_pack.dsi_gi.vobu_c_idn,
-             dvdtime_to_time( &p_sys->dsi_pack.dsi_gi.c_eltm, 0 ) );
+             dvdtime_to_time( &p_sys->dsi_pack.dsi_gi.c_eltm ) );
 
     msg_Dbg( p_demux, "cell duration: %lld",
-             dvdtime_to_time( &p_sys->p_cur_pgc->cell_playback[p_sys->i_cur_cell].playback_time, 0 ) );
+             dvdtime_to_time( &p_sys->p_cur_pgc->cell_playback[p_sys->i_cur_cell].playback_time ) );
 
     msg_Dbg( p_demux, "cat 0x%02x ilvu_ea %d ilvu_sa %d size %d",
              p_sys->dsi_pack.sml_pbi.category,



More information about the vlc-commits mailing list