summaryrefslogtreecommitdiffstats
path: root/cmdutils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-24 19:07:42 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-24 20:31:56 +0100
commitad899522ffa7f0039e631b0408a36f23aa84c0e7 (patch)
tree6a2890728bf42084705e0100bec473570d1071a7 /cmdutils.c
parentf3abdf4392a146462dc679846c061b8bf2b5c7a0 (diff)
downloadffmpeg-streaming-ad899522ffa7f0039e631b0408a36f23aa84c0e7.zip
ffmpeg-streaming-ad899522ffa7f0039e631b0408a36f23aa84c0e7.tar.gz
ffmpeg: use a AVDictionary instead of the context to move swr parameters around
This avoids per parameter changes in ffmpeg at the cost of making access somewhat more annoying. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'cmdutils.c')
-rw-r--r--cmdutils.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/cmdutils.c b/cmdutils.c
index 3e0dfbc..1634947 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -62,7 +62,7 @@
static int init_report(const char *env);
struct SwsContext *sws_opts;
-SwrContext *swr_opts;
+AVDictionary *swr_opts;
AVDictionary *format_opts, *codec_opts, *resample_opts;
const int this_year = 2013;
@@ -75,9 +75,6 @@ void init_opts(void)
if(CONFIG_SWSCALE)
sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC,
NULL, NULL, NULL);
-
- if(CONFIG_SWRESAMPLE)
- swr_opts = swr_alloc();
}
void uninit_opts(void)
@@ -87,9 +84,7 @@ void uninit_opts(void)
sws_opts = NULL;
#endif
- if(CONFIG_SWRESAMPLE)
- swr_free(&swr_opts);
-
+ av_dict_free(&swr_opts);
av_dict_free(&format_opts);
av_dict_free(&codec_opts);
av_dict_free(&resample_opts);
@@ -518,13 +513,16 @@ int opt_default(void *optctx, const char *opt, const char *arg)
#endif
#if CONFIG_SWRESAMPLE
swr_class = swr_get_class();
- if (!consumed && av_opt_find(&swr_class, opt, NULL, 0,
- AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) {
- int ret = av_opt_set(swr_opts, opt, arg, 0);
+ if (!consumed && (o=av_opt_find(&swr_class, opt, NULL, 0,
+ AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
+ struct SwrContext *swr = swr_alloc();
+ int ret = av_opt_set(swr, opt, arg, 0);
+ swr_free(&swr);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
return ret;
}
+ av_dict_set(&swr_opts, opt, arg, FLAGS);
consumed = 1;
}
#endif
@@ -651,8 +649,7 @@ void uninit_parse_context(OptionParseContext *octx)
#if CONFIG_SWSCALE
sws_freeContext(l->groups[j].sws_opts);
#endif
- if(CONFIG_SWRESAMPLE)
- swr_free(&l->groups[j].swr_opts);
+ av_dict_free(&l->groups[j].swr_opts);
}
av_freep(&l->groups);
}
OpenPOWER on IntegriCloud