[vlc-commits] demux: ty: use MPEG timestamp macros
Steve Lhomme
git at videolan.org
Tue Sep 18 14:30:47 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Jun 4 09:14:20 2018 +0200| [1619fb2d021299001d428fef32adcb76521642cb] | committer: Steve Lhomme
demux: ty: use MPEG timestamp macros
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1619fb2d021299001d428fef32adcb76521642cb
---
modules/demux/Makefile.am | 3 ++-
modules/demux/ty.c | 13 ++++---------
2 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/modules/demux/Makefile.am b/modules/demux/Makefile.am
index 5d79c9f823..fbc23229b3 100644
--- a/modules/demux/Makefile.am
+++ b/modules/demux/Makefile.am
@@ -64,7 +64,8 @@ libsubtitle_plugin_la_SOURCES = demux/subtitle.c
libsubtitle_plugin_la_LIBADD = $(LIBM)
demux_LTLIBRARIES += libsubtitle_plugin.la
-libty_plugin_la_SOURCES = demux/ty.c codec/cc.h
+libty_plugin_la_SOURCES = demux/ty.c codec/cc.h \
+ demux/mpeg/pes.h demux/mpeg/timestamps.h
demux_LTLIBRARIES += libty_plugin.la
libvobsub_plugin_la_SOURCES = demux/vobsub.c demux/vobsub.h \
diff --git a/modules/demux/ty.c b/modules/demux/ty.c
index 4bff6d548e..ea546ec2f0 100644
--- a/modules/demux/ty.c
+++ b/modules/demux/ty.c
@@ -47,6 +47,8 @@
#include <vlc_input.h>
#include "../codec/cc.h"
+#include "mpeg/pes.h"
+
#include <assert.h>
/*****************************************************************************
@@ -563,15 +565,8 @@ static void Close( vlc_object_t *p_this )
* Assume buf points to beginning of PTS */
static vlc_tick_t get_pts( const uint8_t *buf )
{
- vlc_tick_t i_pts;
-
- i_pts = ((vlc_tick_t)(buf[0]&0x0e ) << 29)|
- (vlc_tick_t)(buf[1] << 22)|
- ((vlc_tick_t)(buf[2]&0xfe) << 14)|
- (vlc_tick_t)(buf[3] << 7)|
- (vlc_tick_t)(buf[4] >> 1);
- i_pts *= 100 / 9; /* convert PTS (90Khz clock) to microseconds */
- return i_pts;
+ stime_t i_pts = GetPESTimestamp( buf );
+ return FROM_SCALE_NZ(i_pts); /* convert PTS (90Khz clock) to microseconds */
}
More information about the vlc-commits
mailing list