diff options
author | wm4 <wm4@nowhere> | 2013-11-25 23:13:01 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-25 23:13:01 +0100 |
commit | 9f72a9753e68c4064796f2361fb12492a85a8e0b (patch) | |
tree | 438a52f708e95ff08be4a686fa7beec937f2fdbf /demux/demux.c | |
parent | d8b59aa17fda6aff7bf3031abbd716adc1268422 (diff) | |
download | mpv-9f72a9753e68c4064796f2361fb12492a85a8e0b.tar.bz2 mpv-9f72a9753e68c4064796f2361fb12492a85a8e0b.tar.xz |
demux: export dts from demux_lavf, use it for avi
Having the DTS directly can be useful for restoring PTS values.
The avi file format doesn't actually store PTS values, just DTS. An
older hack explicitly exported the DTS as PTS (ignoring the [I assume]
genpts generated non-sense PTS), which is not necessary anymore due to
this change.
Diffstat (limited to 'demux/demux.c')
-rw-r--r-- | demux/demux.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c index 00d59af09d..467b016699 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -131,6 +131,7 @@ static struct demux_packet *create_packet(size_t len) *dp = (struct demux_packet) { .len = len, .pts = MP_NOPTS_VALUE, + .dts = MP_NOPTS_VALUE, .duration = -1, .stream_pts = MP_NOPTS_VALUE, .pos = -1, @@ -217,6 +218,7 @@ struct demux_packet *demux_copy_packet(struct demux_packet *dp) memcpy(new->buffer, dp->buffer, new->len); } new->pts = dp->pts; + new->dts = dp->dts; new->duration = dp->duration; new->stream_pts = dp->stream_pts; return new; @@ -340,6 +342,11 @@ int demuxer_add_packet(demuxer_t *demuxer, struct sh_stream *stream, if (dp->pos >= 0) demuxer->filepos = dp->pos; + // For video, PTS determination is not trivial, but for other media types + // distinguishing PTS and DTS is not useful. + if (stream->type != STREAM_VIDEO && dp->pts == MP_NOPTS_VALUE) + dp->pts = dp->dts; + mp_dbg(MSGT_DEMUXER, MSGL_DBG2, "DEMUX: Append packet to %s, len=%d pts=%5.3f pos=%"PRIu64" " "[packs: A=%d V=%d S=%d]\n", stream_type_name(stream->type), |