[FFmpeg-cvslog] avio: add a function for iterating though protocol names.

Anton Khirnov git at videolan.org
Sat Apr 9 03:24:59 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Apr  4 08:18:54 2011 +0200| [f8270bbf8ce891cc614a5562c02ce18a50a89f1d] | committer: Anton Khirnov

avio: add a function for iterating though protocol names.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f8270bbf8ce891cc614a5562c02ce18a50a89f1d
---

 libavformat/avio.c |   10 ++++++++++
 libavformat/avio.h |   13 +++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/libavformat/avio.c b/libavformat/avio.c
index e043058..ab7a7f5 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -57,6 +57,16 @@ URLProtocol *av_protocol_next(URLProtocol *p)
     else  return first_protocol;
 }
 
+const char *avio_enum_protocols(void **opaque, int output)
+{
+    URLProtocol **p = opaque;
+    *p = *p ? (*p)->next : first_protocol;
+    if (!*p) return NULL;
+    if ((output && (*p)->url_write) || (!output && (*p)->url_read))
+        return (*p)->name;
+    return avio_enum_protocols(opaque, output);
+}
+
 int ffurl_register_protocol(URLProtocol *protocol, int size)
 {
     URLProtocol **p;
diff --git a/libavformat/avio.h b/libavformat/avio.h
index c39d2a0..9ea138e 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -600,4 +600,17 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
 int udp_get_file_handle(URLContext *h);
 #endif
 
+/**
+ * Iterate through names of available protocols.
+ *
+ * @param opaque A private pointer representing current protocol.
+ *        It must be a pointer to NULL on first iteration and will
+ *        be updated by successive calls to avio_enum_protocols.
+ * @param output If set to 1, iterate over output protocols,
+ *               otherwise over input protocols.
+ *
+ * @return A static string containing the name of current protocol or NULL
+ */
+const char *avio_enum_protocols(void **opaque, int output);
+
 #endif /* AVFORMAT_AVIO_H */



More information about the ffmpeg-cvslog mailing list