#endif
struct SwsContext *sws_opts;
+SwrContext *swr_opts;
AVDictionary *format_opts, *codec_opts;
const int this_year = 2012;
sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC,
NULL, NULL, NULL);
#endif
+ swr_opts = swr_alloc();
}
void uninit_opts(void)
sws_freeContext(sws_opts);
sws_opts = NULL;
#endif
+ swr_free(&swr_opts);
av_dict_free(&format_opts);
av_dict_free(&codec_opts);
}
#define FLAGS(o) ((o)->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
int opt_default(const char *opt, const char *arg)
{
- const AVOption *oc, *of, *os;
+ const AVOption *oc, *of, *os, *oswr = NULL;
char opt_stripped[128];
const char *p;
- const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc;
+ const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc, *swr_class;
if (!(p = strchr(opt, ':')))
p = opt + strlen(opt);
}
}
#endif
+ swr_class = swr_get_class();
+ if (!oc && !of && !os && (oswr = 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 (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
+ return ret;
+ }
+ }
- if (oc || of || os)
+ if (oc || of || os || oswr)
return 0;
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR_OPTION_NOT_FOUND;