From ff1ec0c3f8fce10e92010f82f7e859e08f9c742a Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 12 Apr 2011 09:37:10 +0200 Subject: avio: undeprecate av_url_read_fseek/fpause under nicer names It seems their replacements won't be ready anytime soon. --- libavformat/asfdec.c | 2 +- libavformat/avio.h | 27 +++++++++++++++++++++++++++ libavformat/avio_internal.h | 26 -------------------------- libavformat/aviobuf.c | 8 ++++---- libavformat/flvdec.c | 4 ++-- libavformat/utils.c | 4 ++-- 6 files changed, 36 insertions(+), 35 deletions(-) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 20b498758e..57e8fb6df4 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -1242,7 +1242,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int /* Try using the protocol's read_seek if available */ if(s->pb) { - int ret = ffio_read_seek(s->pb, stream_index, pts, flags); + int ret = avio_seek_time(s->pb, stream_index, pts, flags); if(ret >= 0) asf_reset_header(s); if (ret != AVERROR(ENOSYS)) diff --git a/libavformat/avio.h b/libavformat/avio.h index 7e7e429117..b980d491ae 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -617,4 +617,31 @@ int udp_get_file_handle(URLContext *h); */ const char *avio_enum_protocols(void **opaque, int output); +/** + * Pause and resume playing - only meaningful if using a network streaming + * protocol (e.g. MMS). + * @param pause 1 for pause, 0 for resume + */ +int avio_pause(AVIOContext *h, int pause); + +/** + * Seek to a given timestamp relative to some component stream. + * Only meaningful if using a network streaming protocol (e.g. MMS.). + * @param stream_index The stream index that the timestamp is relative to. + * If stream_index is (-1) the timestamp should be in AV_TIME_BASE + * units from the beginning of the presentation. + * If a stream_index >= 0 is used and the protocol does not support + * seeking based on component streams, the call will fail with ENOTSUP. + * @param timestamp timestamp in AVStream.time_base units + * or if there is no stream specified then in AV_TIME_BASE units. + * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE + * and AVSEEK_FLAG_ANY. The protocol may silently ignore + * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will + * fail with ENOTSUP if used and not supported. + * @return >= 0 on success + * @see AVInputFormat::read_seek + */ +int64_t avio_seek_time(AVIOContext *h, int stream_index, + int64_t timestamp, int flags); + #endif /* AVFORMAT_AVIO_H */ diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h index 721a3c4602..6630aaf61d 100644 --- a/libavformat/avio_internal.h +++ b/libavformat/avio_internal.h @@ -67,32 +67,6 @@ uint64_t ffio_read_varlen(AVIOContext *bc); /** @warning must be called before any I/O */ int ffio_set_buf_size(AVIOContext *s, int buf_size); -/** - * Pause and resume playing - only meaningful if using a network streaming - * protocol (e.g. MMS). - * @param pause 1 for pause, 0 for resume - */ -int ffio_read_pause(AVIOContext *h, int pause); -/** - * Seek to a given timestamp relative to some component stream. - * Only meaningful if using a network streaming protocol (e.g. MMS.). - * @param stream_index The stream index that the timestamp is relative to. - * If stream_index is (-1) the timestamp should be in AV_TIME_BASE - * units from the beginning of the presentation. - * If a stream_index >= 0 is used and the protocol does not support - * seeking based on component streams, the call will fail with ENOTSUP. - * @param timestamp timestamp in AVStream.time_base units - * or if there is no stream specified then in AV_TIME_BASE units. - * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE - * and AVSEEK_FLAG_ANY. The protocol may silently ignore - * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will - * fail with ENOTSUP if used and not supported. - * @return >= 0 on success - * @see AVInputFormat::read_seek - */ -int64_t ffio_read_seek (AVIOContext *h, int stream_index, - int64_t timestamp, int flags); - void ffio_init_checksum(AVIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum); diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 3814db6dfc..cde5f269b5 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -403,12 +403,12 @@ void put_flush_packet(AVIOContext *s) } int av_url_read_fpause(AVIOContext *s, int pause) { - return ffio_read_pause(s, pause); + return avio_pause(s, pause); } int64_t av_url_read_fseek(AVIOContext *s, int stream_index, int64_t timestamp, int flags) { - return ffio_read_seek(s, stream_index, timestamp, flags); + return avio_seek_time(s, stream_index, timestamp, flags); } void init_checksum(AVIOContext *s, unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), @@ -1013,14 +1013,14 @@ int url_fget_max_packet_size(AVIOContext *s) } #endif -int ffio_read_pause(AVIOContext *s, int pause) +int avio_pause(AVIOContext *s, int pause) { if (!s->read_pause) return AVERROR(ENOSYS); return s->read_pause(s->opaque, pause); } -int64_t ffio_read_seek(AVIOContext *s, int stream_index, +int64_t avio_seek_time(AVIOContext *s, int stream_index, int64_t timestamp, int flags) { URLContext *h = s->opaque; diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 62d25c8802..94159be3c4 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -529,7 +529,7 @@ leave: static int flv_read_seek(AVFormatContext *s, int stream_index, int64_t ts, int flags) { - return ffio_read_seek(s->pb, stream_index, ts, flags); + return avio_seek_time(s->pb, stream_index, ts, flags); } #if 0 /* don't know enough to implement this */ @@ -550,7 +550,7 @@ static int flv_read_seek2(AVFormatContext *s, int stream_index, ts = av_rescale_rnd(ts, 1000, AV_TIME_BASE, flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); } - ret = ffio_read_seek(s->pb, stream_index, ts, flags); + ret = avio_seek_time(s->pb, stream_index, ts, flags); } if (ret == AVERROR(ENOSYS)) diff --git a/libavformat/utils.c b/libavformat/utils.c index 1d58682a66..f93b83f5da 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2579,7 +2579,7 @@ int av_read_play(AVFormatContext *s) if (s->iformat->read_play) return s->iformat->read_play(s); if (s->pb) - return ffio_read_pause(s->pb, 0); + return avio_pause(s->pb, 0); return AVERROR(ENOSYS); } @@ -2588,7 +2588,7 @@ int av_read_pause(AVFormatContext *s) if (s->iformat->read_pause) return s->iformat->read_pause(s); if (s->pb) - return ffio_read_pause(s->pb, 1); + return avio_pause(s->pb, 1); return AVERROR(ENOSYS); } -- cgit v1.2.3