[vlc-commits] avformat: use vlc_tick_from_frac() to convert avformat timestamps
Steve Lhomme
git at videolan.org
Tue Sep 25 12:19:55 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 25 09:48:34 2018 +0200| [ea8ace33a3f85be69050e7b8363c5d6ba007bc7d] | committer: Steve Lhomme
avformat: use vlc_tick_from_frac() to convert avformat timestamps
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ea8ace33a3f85be69050e7b8363c5d6ba007bc7d
---
modules/demux/avformat/demux.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index f7d9355526..56f7c3843e 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -814,8 +814,7 @@ static int Demux( demux_t *p_demux )
lldiv_t q;
if( p_sys->ic->start_time != (int64_t)AV_NOPTS_VALUE )
{
- q = lldiv( p_sys->ic->start_time, AV_TIME_BASE);
- i_start_time = q.quot * CLOCK_FREQ + FROM_AV_TS(q.rem);
+ i_start_time = vlc_tick_from_frac(p_sys->ic->start_time, AV_TIME_BASE);
}
else
i_start_time = 0;
@@ -824,22 +823,16 @@ static int Demux( demux_t *p_demux )
p_frame->i_dts = VLC_TICK_INVALID;
else
{
- q = lldiv( pkt.dts, p_stream->time_base.den );
- p_frame->i_dts = q.quot * CLOCK_FREQ *
- p_stream->time_base.num + q.rem * CLOCK_FREQ *
- p_stream->time_base.num /
- p_stream->time_base.den - i_start_time + VLC_TICK_0;
+ p_frame->i_dts = vlc_tick_from_frac( pkt.dts * p_stream->time_base.num, p_stream->time_base.den )
+ - i_start_time;
}
if( pkt.pts == (int64_t)AV_NOPTS_VALUE )
p_frame->i_pts = VLC_TICK_INVALID;
else
{
- q = lldiv( pkt.pts, p_stream->time_base.den );
- p_frame->i_pts = q.quot * CLOCK_FREQ *
- p_stream->time_base.num + q.rem * CLOCK_FREQ *
- p_stream->time_base.num /
- p_stream->time_base.den - i_start_time + VLC_TICK_0;
+ p_frame->i_pts = vlc_tick_from_frac( pkt.dts * p_stream->time_base.num, p_stream->time_base.den )
+ - i_start_time;
}
if( pkt.duration > 0 && p_frame->i_length <= 0 )
p_frame->i_length = vlc_tick_from_samples(pkt.duration *
More information about the vlc-commits
mailing list