[vlc-commits] demux: avi: PTSToByte remove useless casts and change type

Francois Cartegnie git at videolan.org
Wed Dec 20 15:37:11 CET 2017


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Dec  8 12:04:17 2017 +0100| [41ca065f5ab4658f5fc98964c8c91a5ecd33cb62] | committer: Francois Cartegnie

demux: avi: PTSToByte remove useless casts and change type

(cherry picked from commit e679264e70e5ab225d26be90505911360b07d739)

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

 modules/demux/avi/avi.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 8cd11dacd8..8e6e37a1e0 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -204,7 +204,7 @@ static inline off_t __EVEN( off_t i )
 }
 
 static mtime_t AVI_PTSToChunk( avi_track_t *, mtime_t i_pts );
-static mtime_t AVI_PTSToByte ( avi_track_t *, mtime_t i_pts );
+static int64_t AVI_PTSToByte ( avi_track_t *, mtime_t i_pts );
 static mtime_t AVI_GetDPTS   ( avi_track_t *, int64_t i_count );
 static mtime_t AVI_GetPTS    ( avi_track_t * );
 
@@ -1001,7 +1001,7 @@ typedef struct
 {
     bool b_ok;
 
-    int i_toread;
+    int64_t i_toread;
 
     int64_t i_posf; /* where we will read :
                    if i_idxposb == 0 : begining of chunk (+8 to acces data)
@@ -1241,7 +1241,7 @@ static int Demux_Seekable( demux_t *p_demux )
         /* read thoses data */
         if( tk->i_samplesize )
         {
-            unsigned int i_toread;
+            int64_t i_toread;
 
             if( ( i_toread = toread[i_track].i_toread ) <= 0 )
             {
@@ -1257,7 +1257,7 @@ static int Demux_Seekable( demux_t *p_demux )
             }
             i_size = __MIN( tk->idx.p_entry[tk->i_idxposc].i_length -
                                 tk->i_idxposb,
-                            i_toread );
+                            (size_t) i_toread );
         }
         else
         {
@@ -1806,16 +1806,16 @@ static mtime_t AVI_PTSToChunk( avi_track_t *tk, mtime_t i_pts )
                      (int64_t)tk->i_scale /
                      (int64_t)CLOCK_FREQ );
 }
-static mtime_t AVI_PTSToByte( avi_track_t *tk, mtime_t i_pts )
+static int64_t AVI_PTSToByte( avi_track_t *tk, mtime_t i_pts )
 {
     if( !tk->i_scale || !tk->i_samplesize )
-        return (mtime_t)0;
+        return 0;
 
-    return (mtime_t)((int64_t)i_pts *
-                     (int64_t)tk->i_rate /
-                     (int64_t)tk->i_scale /
-                     (int64_t)1000000 *
-                     (int64_t)tk->i_samplesize );
+    return i_pts *
+           tk->i_rate /
+           tk->i_scale /
+           CLOCK_FREQ *
+           tk->i_samplesize;
 }
 
 static mtime_t AVI_GetDPTS( avi_track_t *tk, int64_t i_count )



More information about the vlc-commits mailing list