aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/options.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-05-22 08:37:25 +0200
committerAnton Khirnov <anton@khirnov.net>2011-06-16 20:24:56 +0200
commit05e84c95c7f0543553af8f0ebd50fb5604e7e2ff (patch)
tree0b1399a338e2d8d3bda48477f35286c56bbc901c /libavformat/options.c
parentdc59ec5e79d813228e3dfbc8942a5fe424b399a0 (diff)
downloadffmpeg-05e84c95c7f0543553af8f0ebd50fb5604e7e2ff.tar.gz
lavf: add avformat_open_input() as a replacement for av_open_input_*
Add support for demuxer private options.
Diffstat (limited to 'libavformat/options.c')
-rw-r--r--libavformat/options.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libavformat/options.c b/libavformat/options.c
index c11f19e687..c2729b75d9 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -33,6 +33,33 @@ static const char* format_to_name(void* ptr)
else return "NULL";
}
+static const AVOption *opt_find(void *obj, const char *name, const char *unit, int opt_flags, int search_flags)
+{
+ AVFormatContext *s = obj;
+ AVInputFormat *ifmt = NULL;
+ AVOutputFormat *ofmt = NULL;
+ if (s->priv_data) {
+ if ((s->iformat && !s->iformat->priv_class) ||
+ (s->oformat && !s->oformat->priv_class))
+ return NULL;
+ return av_opt_find(s->priv_data, name, unit, opt_flags, search_flags);
+ }
+
+ while ((ifmt = av_iformat_next(ifmt))) {
+ const AVOption *o;
+
+ if (ifmt->priv_class && (o = av_opt_find(&ifmt->priv_class, name, unit, opt_flags, search_flags)))
+ return o;
+ }
+ while ((ofmt = av_oformat_next(ofmt))) {
+ const AVOption *o;
+
+ if (ofmt->priv_class && (o = av_opt_find(&ofmt->priv_class, name, unit, opt_flags, search_flags)))
+ return o;
+ }
+ return NULL;
+}
+
#define OFFSET(x) offsetof(AVFormatContext,x)
#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
//these names are too long to be readable
@@ -72,6 +99,7 @@ static const AVClass av_format_context_class = {
.item_name = format_to_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
+ .opt_find = opt_find,
};
static void avformat_get_context_defaults(AVFormatContext *s)