[FFmpeg-cvslog] lavf: move urlcontext_child_class_next() to protocols.c
Anton Khirnov
git at videolan.org
Mon Feb 29 18:03:13 CET 2016
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Feb 19 10:59:46 2016 +0100| [7d61dc95d741ca134d59b1f34c4e10c4c4e36f56] | committer: Anton Khirnov
lavf: move urlcontext_child_class_next() to protocols.c
It needs to access the list of protocols directly, so it more properly
belongs there.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d61dc95d741ca134d59b1f34c4e10c4c4e36f56
---
libavformat/avio.c | 21 +--------------------
libavformat/protocols.c | 20 ++++++++++++++++++++
libavformat/url.h | 2 ++
3 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 3ead41a..b4e57e9 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -49,25 +49,6 @@ static void *urlcontext_child_next(void *obj, void *prev)
return NULL;
}
-static const AVClass *urlcontext_child_class_next(const AVClass *prev)
-{
- int i;
-
- /* find the protocol that corresponds to prev */
- for (i = 0; ff_url_protocols[i]; i++) {
- if (ff_url_protocols[i]->priv_data_class == prev) {
- i++;
- break;
- }
- }
-
- /* find next protocol with priv options */
- for (; ff_url_protocols[i]; i++)
- if (ff_url_protocols[i]->priv_data_class)
- return ff_url_protocols[i]->priv_data_class;
- return NULL;
-}
-
static const AVOption options[] = { { NULL } };
const AVClass ffurl_context_class = {
.class_name = "URLContext",
@@ -75,7 +56,7 @@ const AVClass ffurl_context_class = {
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.child_next = urlcontext_child_next,
- .child_class_next = urlcontext_child_class_next,
+ .child_class_next = ff_urlcontext_child_class_next,
};
/*@}*/
diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index c1e9989..45b2a90 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -163,6 +163,26 @@ const URLProtocol *ff_url_protocols[] = {
NULL,
};
+const AVClass *ff_urlcontext_child_class_next(const AVClass *prev)
+{
+ int i;
+
+ /* find the protocol that corresponds to prev */
+ for (i = 0; ff_url_protocols[i]; i++) {
+ if (ff_url_protocols[i]->priv_data_class == prev) {
+ i++;
+ break;
+ }
+ }
+
+ /* find next protocol with priv options */
+ for (; ff_url_protocols[i]; i++)
+ if (ff_url_protocols[i]->priv_data_class)
+ return ff_url_protocols[i]->priv_data_class;
+ return NULL;
+}
+
+
const char *avio_enum_protocols(void **opaque, int output)
{
const URLProtocol **p = *opaque;
diff --git a/libavformat/url.h b/libavformat/url.h
index a8f292c..3006905 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -264,6 +264,8 @@ int ff_url_join(char *str, int size, const char *proto,
void ff_make_absolute_url(char *buf, int size, const char *base,
const char *rel);
+const AVClass *ff_urlcontext_child_class_next(const AVClass *prev);
+
extern const URLProtocol *ff_url_protocols[];
#endif /* AVFORMAT_URL_H */
More information about the ffmpeg-cvslog
mailing list