diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-02-29 19:59:47 +0300 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-02-29 20:00:44 +0300 |
commit | 53025fe1870afb19ee715e80615a1fc497dab13e (patch) | |
tree | b52e4ceb29f961ff76ea1dd11ffe0fced9e8edcc | |
parent | 8fd5342463b07fdfe2f6e89620182380c1c10ab8 (diff) | |
parent | 7d61dc95d741ca134d59b1f34c4e10c4c4e36f56 (diff) |
Merge commit '7d61dc95d741ca134d59b1f34c4e10c4c4e36f56'
* commit '7d61dc95d741ca134d59b1f34c4e10c4c4e36f56':
lavf: move urlcontext_child_class_next() to protocols.c
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r-- | libavformat/avio.c | 22 | ||||
-rw-r--r-- | libavformat/protocols.c | 20 | ||||
-rw-r--r-- | libavformat/url.h | 2 |
3 files changed, 24 insertions, 20 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c index ef4253cbb9..4a29827935 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -50,25 +50,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; -} - #define OFFSET(x) offsetof(URLContext,x) #define E AV_OPT_FLAG_ENCODING_PARAM #define D AV_OPT_FLAG_DECODING_PARAM @@ -76,13 +57,14 @@ static const AVOption options[] = { {"protocol_whitelist", "List of protocols that are allowed to be used", OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, D }, { NULL } }; + const AVClass ffurl_context_class = { .class_name = "URLContext", .item_name = urlcontext_to_name, .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 2c48983c87..266e2c0d6d 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -207,6 +207,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 085c24c628..810fd147b1 100644 --- a/libavformat/url.h +++ b/libavformat/url.h @@ -309,6 +309,8 @@ void ff_make_absolute_url(char *buf, int size, const char *base, */ AVIODirEntry *ff_alloc_dir_entry(void); +const AVClass *ff_urlcontext_child_class_next(const AVClass *prev); + extern const URLProtocol *ff_url_protocols[]; #endif /* AVFORMAT_URL_H */ |