From fa13095a5db7c1eb9b04e3adaf95423819fa62b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Axelsson?= Date: Mon, 17 Dec 2007 09:28:46 +0000 Subject: [PATCH] =?UTF-8?q?Enable=20av=5Fread=5Fpause(),=20av=5Fread=5Fpla?= =?UTF-8?q?y()=20and=20the=20ASF=20demuxer's=20av=5Fread=5Fseek()=20to=20u?= =?UTF-8?q?se=20the=20protocol-native=20functionality=20if=20available.=20?= =?UTF-8?q?Patch=20by=20Bj=C3=B6rn=20Axelsson:=20bjorn=20point=20axelsson?= =?UTF-8?q?=20at=20intinor=20dot=20se=20Original=20thread:=20[FFmpeg-devel?= =?UTF-8?q?]=20[PATCH][4/4]=20Enable=20use=20of=20the=20extended=20API=20D?= =?UTF-8?q?ate:=20Thu=20Nov=2022=2016:01:06=20CET=202007?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Originally committed as revision 11248 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/asf.c | 8 ++++++++ libavformat/utils.c | 16 ++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/libavformat/asf.c b/libavformat/asf.c index b2f54d9639..2316ed570f 100644 --- a/libavformat/asf.c +++ b/libavformat/asf.c @@ -1049,6 +1049,14 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int if (asf->packet_size <= 0) return -1; + /* Try using the protocol's read_seek if available */ + if(s->pb && s->pb->read_seek) { + int ret = av_url_read_fseek(s->pb, stream_index, pts, flags); + if(ret >= 0) + asf_reset_header(s); + return ret; + } + if (!asf->index_read) asf_build_simple_index(s, stream_index); diff --git a/libavformat/utils.c b/libavformat/utils.c index 3cd07552c5..7ab8d7e1e6 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2030,16 +2030,20 @@ int av_find_stream_info(AVFormatContext *ic) int av_read_play(AVFormatContext *s) { - if (!s->iformat->read_play) - return AVERROR(ENOSYS); - return s->iformat->read_play(s); + if (s->iformat->read_play) + return s->iformat->read_play(s); + if (s->pb && s->pb->read_play) + return av_url_read_fplay(s->pb); + return AVERROR(ENOSYS); } int av_read_pause(AVFormatContext *s) { - if (!s->iformat->read_pause) - return AVERROR(ENOSYS); - return s->iformat->read_pause(s); + if (s->iformat->read_pause) + return s->iformat->read_pause(s); + if (s->pb && s->pb->read_pause) + return av_url_read_fpause(s->pb); + return AVERROR(ENOSYS); } void av_close_input_file(AVFormatContext *s)