diff options
author | wm4 <nfxjfg@googlemail.com> | 2018-01-24 08:02:25 +0100 |
---|---|---|
committer | wm4 <nfxjfg@googlemail.com> | 2018-01-27 04:10:52 +0100 |
commit | 6194d7e56454897b9c5d9d52e82376b2a6e6b85c (patch) | |
tree | aa4822b5f9431d113d4277d849e82c2a1f069439 /libavformat/hls.c | |
parent | 637dfa39421c2806616d1aa454c9182db1aac3d9 (diff) | |
download | ffmpeg-6194d7e56454897b9c5d9d52e82376b2a6e6b85c.tar.gz |
avformat, hls: add a flag to signal unavailability of seeking
The seek function can just return an error if seeking is unavailable,
but often this is too late. Add a flag that signals that the stream is
unseekable, and use it in HLS.
Diffstat (limited to 'libavformat/hls.c')
-rw-r--r-- | libavformat/hls.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c index ff7bdecc93..6e1a2e3f1e 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -930,6 +930,11 @@ fail: av_free(new_url); if (close_in) ff_format_io_close(c->ctx, &in); + c->ctx->ctx_flags = c->ctx->ctx_flags & ~(unsigned)AVFMTCTX_UNSEEKABLE; + if (!c->n_variants || !c->variants[0]->n_playlists || + !(c->variants[0]->playlists[0]->finished || + c->variants[0]->playlists[0]->type == PLS_TYPE_EVENT)) + c->ctx->ctx_flags |= AVFMTCTX_UNSEEKABLE; return ret; } @@ -2213,8 +2218,7 @@ static int hls_read_seek(AVFormatContext *s, int stream_index, int stream_subdemuxer_index; int64_t first_timestamp, seek_timestamp, duration; - if ((flags & AVSEEK_FLAG_BYTE) || - !(c->variants[0]->playlists[0]->finished || c->variants[0]->playlists[0]->type == PLS_TYPE_EVENT)) + if ((flags & AVSEEK_FLAG_BYTE) || (c->ctx->ctx_flags & AVFMTCTX_UNSEEKABLE)) return AVERROR(ENOSYS); first_timestamp = c->first_timestamp == AV_NOPTS_VALUE ? |