[FFmpeg-devel] [PATCH 1/3] libavformat/avio: Utility function to return URLContext
Aman Gupta
ffmpeg at tmm1.net
Tue Nov 14 18:46:35 EET 2017
On Tue, Nov 7, 2017 at 2:34 AM Karthick J <kjeyapal at akamai.com> wrote:
> ---
> libavformat/avio_internal.h | 8 ++++++++
> libavformat/aviobuf.c | 8 ++++++++
> 2 files changed, 16 insertions(+)
>
> diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
> index c01835d..04c1ad5 100644
> --- a/libavformat/avio_internal.h
> +++ b/libavformat/avio_internal.h
> @@ -133,6 +133,14 @@ int ffio_open_dyn_packet_buf(AVIOContext **s, int
> max_packet_size);
> int ffio_fdopen(AVIOContext **s, URLContext *h);
>
> /**
> + * Return the URLContext associated with the AVIOContext
> + *
> + * @param s IO context
> + * @return pointer to URLContext or NULL.
> + */
> +URLContext *ffio_geturlcontext(AVIOContext *s);
> +
> +/**
> * Open a write-only fake memory stream. The written data is not stored
> * anywhere - this is only used for measuring the amount of data
> * written.
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index 3b4c843..1353c80 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -980,6 +980,14 @@ fail:
> return AVERROR(ENOMEM);
> }
>
> +URLContext* ffio_geturlcontext(AVIOContext *s) {
> + AVIOInternal *internal = s->opaque;
> + if (internal)
> + return internal->h;
> + else
> + return NULL;
> +}
> +
> int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
> {
> uint8_t *buffer;
LGTM. This would make my hls demuxer keepalive patch simpler as well.
I know there were some concerns earlier about exposing URLContext, but
since this is internal I think it should be okay.
Any objections?
Aman
> --
> 1.9.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list