[FFmpeg-cvslog] libavformat/avio: Utility function to return URLContext
Jeyapal, Karthick
git at videolan.org
Wed Nov 29 08:33:26 EET 2017
ffmpeg | branch: master | Jeyapal, Karthick <kjeyapal at akamai.com> | Wed Nov 29 14:31:34 2017 +0800| [62f63b24bfec22134bc5b9312bc6afe824e63199] | committer: Steven Liu
libavformat/avio: Utility function to return URLContext
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=62f63b24bfec22134bc5b9312bc6afe824e63199
---
libavformat/avio_internal.h | 8 ++++++++
libavformat/aviobuf.c | 13 +++++++++++++
2 files changed, 21 insertions(+)
diff --git a/libavformat/avio_internal.h b/libavformat/avio_internal.h
index c01835df96..04c1ad5157 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 3b4c8439d6..86eb6579f4 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -980,6 +980,19 @@ fail:
return AVERROR(ENOMEM);
}
+URLContext* ffio_geturlcontext(AVIOContext *s)
+{
+ AVIOInternal *internal;
+ if (!s)
+ return NULL;
+
+ internal = s->opaque;
+ if (internal && s->read_packet == io_read_packet)
+ return internal->h;
+ else
+ return NULL;
+}
+
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
{
uint8_t *buffer;
More information about the ffmpeg-cvslog
mailing list