Mercurial > mplayer.hg
diff libmpdemux/demuxer.c @ 18917:d9a75b26da6c
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.
author | uau |
---|---|
date | Thu, 06 Jul 2006 06:58:17 +0000 |
parents | 0b53e6d1b27f |
children | 75327b24e06f |
line wrap: on
line diff
--- a/libmpdemux/demuxer.c Thu Jul 06 05:05:00 2006 +0000 +++ b/libmpdemux/demuxer.c Thu Jul 06 06:58:17 2006 +0000 @@ -355,7 +355,7 @@ 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 @@ *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 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