[vlc-commits] demux: pes: split the timestamp extraction into check & conversion functions

Steve Lhomme git at videolan.org
Tue Sep 18 14:30:45 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jun  4 09:12:11 2018 +0200| [bdaffa2d64edc68a9d3e8086a9c6e140ccd78afa] | committer: Steve Lhomme

demux: pes: split the timestamp extraction into check & conversion functions

So the conversion can be used without the checks (for other formats with the
checking bits).

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

 modules/demux/mpeg/pes.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mpeg/pes.h b/modules/demux/mpeg/pes.h
index fa2c8ffe0c..cc2d60512d 100644
--- a/modules/demux/mpeg/pes.h
+++ b/modules/demux/mpeg/pes.h
@@ -22,6 +22,15 @@
 
 #include "timestamps.h"
 
+static inline stime_t GetPESTimestamp( const uint8_t *p_data )
+{
+    return  ((int64_t)(p_data[ 0]&0x0e ) << 29)|
+             (int64_t)(p_data[1] << 22)|
+            ((int64_t)(p_data[2]&0xfe) << 14)|
+             (int64_t)(p_data[3] << 7)|
+             (int64_t)(p_data[4] >> 1);
+}
+
 static inline bool ExtractPESTimestamp( const uint8_t *p_data, uint8_t i_flags, stime_t *ret )
 {
     /* !warn broken muxers set incorrect flags. see #17773 and #19140 */
@@ -34,11 +43,7 @@ static inline bool ExtractPESTimestamp( const uint8_t *p_data, uint8_t i_flags,
         return false;
 
 
-    *ret =  ((int64_t)(p_data[ 0]&0x0e ) << 29)|
-             (int64_t)(p_data[1] << 22)|
-            ((int64_t)(p_data[2]&0xfe) << 14)|
-             (int64_t)(p_data[3] << 7)|
-             (int64_t)(p_data[4] >> 1);
+    *ret =  GetPESTimestamp( p_data );
     return true;
 }
 



More information about the vlc-commits mailing list