From cf2fa9d3e5bd6b8ca3e1637080b665e896ea60a0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 18 Aug 2015 00:10:54 +0200 Subject: stream: provide a stream_get_size() convenience function And use it everywhere, instead of retrieving the size manually. Slight simplification. --- demux/demux_lavf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'demux/demux_lavf.c') diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index a765ce8a44..8978ebf69e 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -204,8 +204,8 @@ static int64_t mp_seek(void *opaque, int64_t pos, int whence) int64_t current_pos; MP_TRACE(demuxer, "mp_seek(%p, %"PRId64", %d)\n", stream, pos, whence); if (whence == SEEK_END || whence == AVSEEK_SIZE) { - int64_t end; - if (stream_control(stream, STREAM_CTRL_GET_SIZE, &end) != STREAM_OK) + int64_t end = stream_get_size(stream); + if (end < 0) return -1; if (whence == AVSEEK_SIZE) return end; @@ -917,8 +917,7 @@ static void demux_seek_lavf(demuxer_t *demuxer, double rel_seek_secs, int flags) if (flags & SEEK_FACTOR) { struct stream *s = demuxer->stream; - int64_t end = 0; - stream_control(s, STREAM_CTRL_GET_SIZE, &end); + int64_t end = stream_get_size(s); if (end > 0 && demuxer->ts_resets_possible && !(priv->avif_flags & AVFMT_NO_BYTE_SEEK)) { -- cgit v1.2.3