From e2727ec797e19fb6d4d2d3338ce17dce976e0b28 Mon Sep 17 00:00:00 2001 From: uau Date: Thu, 6 Jul 2006 06:58:17 +0000 Subject: Add a new video pts tracking mode, enabled by option -correct-pts. This mode has the following differences: - Video timing is correct for streams with B frames, at least with some demuxers. - Video filters can modify frame timestamps and insert new frames, and removing frames is handled better than before. - Some things are known to break, it's not usable as the default yet. Things should work as before when the -correct-pts option is not used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18922 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demuxer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libmpdemux/demuxer.c') diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index cf474a789c..d648ac7363 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -355,7 +355,7 @@ int ds_fill_buffer(demux_stream_t *ds){ ds->pos=p->pos; ds->dpos+=p->len; // !!! ++ds->pack_no; - if(p->pts){ + if (p->pts != (correct_pts ? MP_NOPTS_VALUE : 0)) { ds->pts=p->pts; ds->pts_bytes=0; } @@ -511,10 +511,11 @@ int ds_get_packet_pts(demux_stream_t *ds,unsigned char **start, double *pts) *start = NULL; return -1; } - // Should use MP_NOPTS_VALUE for "unknown pts" in the packets too - if (ds->current->pts) - *pts = ds->current->pts; } + // Should use MP_NOPTS_VALUE for "unknown pts" in the packets too + // Return pts unless this read starts from the middle of a packet + if (!ds->buffer_pos && (correct_pts || ds->current->pts)) + *pts = ds->current->pts; len=ds->buffer_size-ds->buffer_pos; *start = &ds->buffer[ds->buffer_pos]; ds->buffer_pos+=len; @@ -624,6 +625,8 @@ int get_demuxer_type_from_name(char *demuxer_name, int *force) int extension_parsing=1; // 0=off 1=mixed (used only for unstable formats) +int correct_pts=0; + /* NOTE : Several demuxers may be opened at the same time so demuxers should NEVER rely on an external var to enable them -- cgit v1.2.3