summaryrefslogtreecommitdiffstats
path: root/demux/demux.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-16 21:04:28 +0100
committerwm4 <wm4@nowhere>2013-11-16 21:46:17 +0100
commita2a24b957ec7dae8b9d312af8292b5e5e82d77be (patch)
treec4d9ad9cd7196a5f3ea5f8d83b570e55fb27b3a9 /demux/demux.c
parent0cdbc6db6ea1ee6cdeedec6c8bd84e692d5f82d3 (diff)
downloadmpv-a2a24b957ec7dae8b9d312af8292b5e5e82d77be.tar.bz2
mpv-a2a24b957ec7dae8b9d312af8292b5e5e82d77be.tar.xz
demux: simplify handling of filepos field
demuxer->filepos contains the byte offset of the last read packet. This is so that the player can estimate the current playback position, if no proper timestamps are available. Simplify it to use demux_packet->pos in the generic demuxer code, instead of bothering every demuxer implementation about it. (Note that this is still a bit incorrect: it relfects the position of the last packet read by the demuxer, not that returned to the user. But that was already broken, and is not that trivial to fix.)
Diffstat (limited to 'demux/demux.c')
-rw-r--r--demux/demux.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c
index d9cf3b37dd..983a96c90a 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -133,6 +133,7 @@ static struct demux_packet *create_packet(size_t len)
.pts = MP_NOPTS_VALUE,
.duration = -1,
.stream_pts = MP_NOPTS_VALUE,
+ .pos = -1,
};
return dp;
}
@@ -339,6 +340,9 @@ int demuxer_add_packet(demuxer_t *demuxer, struct sh_stream *stream,
* appear. */
ds->eof = 0;
+ if (dp->pos >= 0)
+ demuxer->filepos = dp->pos;
+
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),