aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/options.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-02-10 14:40:32 +0000
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-02-10 14:42:41 +0000
commitbc9a5965c815cf7fd998d8ce14a18b8e861dd9ce (patch)
tree7011642746984633573c9a2d993d58dfd12ee44b /libavformat/options.c
parentd94b11a721385aa406187da8f49380f29be0fa7e (diff)
parent9f61abc8111c7c43f49ca012e957a108b9cc7610 (diff)
downloadffmpeg-bc9a5965c815cf7fd998d8ce14a18b8e861dd9ce.tar.gz
Merge commit '9f61abc8111c7c43f49ca012e957a108b9cc7610'
This also deprecates our old duplicated callbacks. * commit '9f61abc8111c7c43f49ca012e957a108b9cc7610': lavf: allow custom IO for all files Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavformat/options.c')
-rw-r--r--libavformat/options.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavformat/options.c b/libavformat/options.c
index 9918349703..8fe0017196 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -99,12 +99,33 @@ static const AVClass av_format_context_class = {
.get_category = get_category,
};
+static int io_open_default(AVFormatContext *s, AVIOContext **pb,
+ const char *url, int flags, AVDictionary **options)
+{
+#if FF_API_OLD_OPEN_CALLBACKS
+FF_DISABLE_DEPRECATION_WARNINGS
+ if (s->open_cb)
+ return s->open_cb(s, pb, url, flags, &s->interrupt_callback, options);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+ return ffio_open_whitelist(pb, url, flags, &s->interrupt_callback, options, s->protocol_whitelist);
+}
+
+static void io_close_default(AVFormatContext *s, AVIOContext *pb)
+{
+ avio_close(pb);
+}
+
static void avformat_get_context_defaults(AVFormatContext *s)
{
memset(s, 0, sizeof(AVFormatContext));
s->av_class = &av_format_context_class;
+ s->io_open = io_open_default;
+ s->io_close = io_close_default;
+
av_opt_set_defaults(s);
}