[vlc-commits] pva: use MPEG timestamp macros

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jun  1 11:32:21 2018 +0200| [65838ea0fee8d7634cb00baf1310478b56bbd8b1] | committer: Steve Lhomme

pva: use MPEG timestamp macros

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

 modules/demux/Makefile.am |  2 +-
 modules/demux/pva.c       | 24 +++++++++---------------
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/modules/demux/Makefile.am b/modules/demux/Makefile.am
index 39fc137191..5d79c9f823 100644
--- a/modules/demux/Makefile.am
+++ b/modules/demux/Makefile.am
@@ -51,7 +51,7 @@ libmod_plugin_la_LIBADD = $(LIBS_mod)
 EXTRA_LTLIBRARIES += libmod_plugin.la
 demux_LTLIBRARIES += $(LTLIBmod)
 
-libpva_plugin_la_SOURCES = demux/pva.c
+libpva_plugin_la_SOURCES = demux/pva.c demux/mpeg/pes.h demux/mpeg/timestamps.h
 demux_LTLIBRARIES += libpva_plugin.la
 
 libaiff_plugin_la_SOURCES = demux/aiff.c
diff --git a/modules/demux/pva.c b/modules/demux/pva.c
index cec3189914..4312a06450 100644
--- a/modules/demux/pva.c
+++ b/modules/demux/pva.c
@@ -33,6 +33,8 @@
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
 
+#include "mpeg/pes.h"
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -233,7 +235,7 @@ static int Demux( demux_t *p_demux )
                 p_frame->p_buffer += i_skip;
                 p_frame->i_buffer -= i_skip;
                 if( i_pts >= 0 )
-                    p_frame->i_pts = VLC_TICK_0 + i_pts * 100 / 9;
+                    p_frame->i_pts = FROM_SCALE(i_pts);
                 block_ChainAppend( &p_sys->p_es, p_frame );
             }
             break;
@@ -398,8 +400,8 @@ static void ParsePES( demux_t *p_demux )
     uint8_t     hdr[30];
 
     unsigned    i_skip;
-    vlc_tick_t  i_dts = -1;
-    vlc_tick_t  i_pts = -1;
+    stime_t     i_dts = -1;
+    stime_t     i_pts = -1;
 
     p_sys->p_pes = NULL;
 
@@ -421,19 +423,11 @@ static void ParsePES( demux_t *p_demux )
     i_skip = hdr[8] + 9;
     if( hdr[7]&0x80 )    /* has pts */
     {
-        i_pts = ((vlc_tick_t)(hdr[ 9]&0x0e ) << 29)|
-                 (vlc_tick_t)(hdr[10] << 22)|
-                ((vlc_tick_t)(hdr[11]&0xfe) << 14)|
-                 (vlc_tick_t)(hdr[12] << 7)|
-                 (vlc_tick_t)(hdr[12] >> 1);
+        i_pts = GetPESTimestamp( &hdr[9] );
 
         if( hdr[7]&0x40 )    /* has dts */
         {
-             i_dts = ((vlc_tick_t)(hdr[14]&0x0e ) << 29)|
-                     (vlc_tick_t)(hdr[15] << 22)|
-                    ((vlc_tick_t)(hdr[16]&0xfe) << 14)|
-                     (vlc_tick_t)(hdr[17] << 7)|
-                     (vlc_tick_t)(hdr[18] >> 1);
+             i_dts = GetPESTimestamp( &hdr[14] );
         }
     }
 
@@ -450,9 +444,9 @@ static void ParsePES( demux_t *p_demux )
     p_pes->p_buffer += i_skip;
 
     if( i_dts >= 0 )
-        p_pes->i_dts = VLC_TICK_0 + i_dts * 100 / 9;
+        p_pes->i_dts = FROM_SCALE(i_dts);
     if( i_pts >= 0 )
-        p_pes->i_pts = VLC_TICK_0 + i_pts * 100 / 9;
+        p_pes->i_pts = FROM_SCALE(i_pts);
 
     /* Set PCR */
     if( p_pes->i_pts > 0 )



More information about the vlc-commits mailing list