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;
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)
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);
#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
#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);
}
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
extern AVFormatContext *avformat_opts;
extern struct SwsContext *sws_opts;
-extern struct SwrContext *swr_opts;
+extern AVDictionary *swr_opts;
extern AVDictionary *format_opts, *codec_opts, *resample_opts;
/**
AVDictionary *format_opts;
AVDictionary *resample_opts;
struct SwsContext *sws_opts;
- struct SwrContext *swr_opts;
+ AVDictionary *swr_opts;
} OptionGroup;
/**
av_freep(&ost->st->codec->subtitle_header);
av_free(ost->forced_kf_pts);
av_dict_free(&ost->opts);
+ av_dict_free(&ost->swr_opts);
av_dict_free(&ost->resample_opts);
}
}
char *avfilter;
int64_t sws_flags;
- int64_t swr_filter_type;
- int64_t swr_dither_method;
- double swr_dither_scale;
AVDictionary *opts;
+ AVDictionary *swr_opts;
AVDictionary *resample_opts;
int finished; /* no more packets should be written for this stream */
int unavailable; /* true if the steram is unavailable (possibly temporarily) */
fg->graph->scale_sws_opts = av_strdup(args);
args[0] = 0;
- if (ost->swr_filter_type != SWR_FILTER_TYPE_KAISER)
- av_strlcatf(args, sizeof(args), "filter_type=%d:", (int)ost->swr_filter_type);
- if (ost->swr_dither_method)
- av_strlcatf(args, sizeof(args), "dither_method=%d:", (int)ost->swr_dither_method);
- if (ost->swr_dither_scale != 1.0)
- av_strlcatf(args, sizeof(args), "dither_scale=%f:", ost->swr_dither_scale);
+ while ((e = av_dict_get(ost->swr_opts, "", e,
+ AV_DICT_IGNORE_SUFFIX))) {
+ av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
+ }
if (strlen(args))
args[strlen(args)-1] = 0;
av_opt_set(fg->graph, "aresample_swr_opts", args, 0);
st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
av_opt_get_int(o->g->sws_opts, "sws_flags", 0, &ost->sws_flags);
- av_opt_get_int (o->g->swr_opts, "filter_type" , 0, &ost->swr_filter_type);
- av_opt_get_int (o->g->swr_opts, "dither_method", 0, &ost->swr_dither_method);
- av_opt_get_double(o->g->swr_opts, "dither_scale" , 0, &ost->swr_dither_scale);
+
+ av_dict_copy(&ost->swr_opts, o->g->swr_opts, 0);
if (ost->enc && av_get_exact_bits_per_sample(ost->enc->id) == 24)
- ost->swr_dither_scale = ost->swr_dither_scale*256;
+ av_dict_set(&ost->swr_opts, "output_sample_bits", "24", 0);
av_dict_copy(&ost->resample_opts, o->g->resample_opts, 0);