diff options
author | wm4 <wm4@nowhere> | 2015-08-18 00:10:54 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-18 00:10:54 +0200 |
commit | cf2fa9d3e5bd6b8ca3e1637080b665e896ea60a0 (patch) | |
tree | 1de6ea60ee9f38ad5b7b66d7d15ee7a806a1520b /demux/demux_lavf.c | |
parent | bf5eac8dd3f142acd0d506407f1ae853ada3c5bc (diff) | |
download | mpv-cf2fa9d3e5bd6b8ca3e1637080b665e896ea60a0.tar.bz2 mpv-cf2fa9d3e5bd6b8ca3e1637080b665e896ea60a0.tar.xz |
stream: provide a stream_get_size() convenience function
And use it everywhere, instead of retrieving the size manually. Slight
simplification.
Diffstat (limited to 'demux/demux_lavf.c')
-rw-r--r-- | demux/demux_lavf.c | 7 |
1 files changed, 3 insertions, 4 deletions
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)) { |