ffmpeg: switch swscale option handling to AVDictionary similar to what the other subsystems use
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
d3d776ccf9
commit
6dbaeed6b7
1
ffmpeg.c
1
ffmpeg.c
@ -4034,6 +4034,7 @@ static int transcode(void)
|
|||||||
av_freep(&ost->apad);
|
av_freep(&ost->apad);
|
||||||
av_freep(&ost->disposition);
|
av_freep(&ost->disposition);
|
||||||
av_dict_free(&ost->encoder_opts);
|
av_dict_free(&ost->encoder_opts);
|
||||||
|
av_dict_free(&ost->sws_dict);
|
||||||
av_dict_free(&ost->swr_opts);
|
av_dict_free(&ost->swr_opts);
|
||||||
av_dict_free(&ost->resample_opts);
|
av_dict_free(&ost->resample_opts);
|
||||||
av_dict_free(&ost->bsf_args);
|
av_dict_free(&ost->bsf_args);
|
||||||
|
2
ffmpeg.h
2
ffmpeg.h
@ -432,8 +432,8 @@ typedef struct OutputStream {
|
|||||||
char *filters; ///< filtergraph associated to the -filter option
|
char *filters; ///< filtergraph associated to the -filter option
|
||||||
char *filters_script; ///< filtergraph script associated to the -filter_script option
|
char *filters_script; ///< filtergraph script associated to the -filter_script option
|
||||||
|
|
||||||
int64_t sws_flags;
|
|
||||||
AVDictionary *encoder_opts;
|
AVDictionary *encoder_opts;
|
||||||
|
AVDictionary *sws_dict;
|
||||||
AVDictionary *swr_opts;
|
AVDictionary *swr_opts;
|
||||||
AVDictionary *resample_opts;
|
AVDictionary *resample_opts;
|
||||||
AVDictionary *bsf_args;
|
AVDictionary *bsf_args;
|
||||||
|
@ -423,11 +423,17 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
|
|||||||
if (codec->width || codec->height) {
|
if (codec->width || codec->height) {
|
||||||
char args[255];
|
char args[255];
|
||||||
AVFilterContext *filter;
|
AVFilterContext *filter;
|
||||||
|
AVDictionaryEntry *e = NULL;
|
||||||
|
|
||||||
snprintf(args, sizeof(args), "%d:%d:0x%X",
|
snprintf(args, sizeof(args), "%d:%d",
|
||||||
codec->width,
|
codec->width,
|
||||||
codec->height,
|
codec->height);
|
||||||
(unsigned)ost->sws_flags);
|
|
||||||
|
while ((e = av_dict_get(ost->sws_dict, "", e,
|
||||||
|
AV_DICT_IGNORE_SUFFIX))) {
|
||||||
|
av_strlcatf(args, sizeof(args), ":%s=%s", e->key, e->value);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "scaler for output stream %d:%d",
|
snprintf(name, sizeof(name), "scaler for output stream %d:%d",
|
||||||
ost->file_index, ost->index);
|
ost->file_index, ost->index);
|
||||||
if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
|
if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
|
||||||
@ -961,7 +967,13 @@ int configure_filtergraph(FilterGraph *fg)
|
|||||||
char args[512];
|
char args[512];
|
||||||
AVDictionaryEntry *e = NULL;
|
AVDictionaryEntry *e = NULL;
|
||||||
|
|
||||||
snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags);
|
args[0] = 0;
|
||||||
|
while ((e = av_dict_get(ost->sws_dict, "", e,
|
||||||
|
AV_DICT_IGNORE_SUFFIX))) {
|
||||||
|
av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value);
|
||||||
|
}
|
||||||
|
if (strlen(args))
|
||||||
|
args[strlen(args)-1] = 0;
|
||||||
fg->graph->scale_sws_opts = av_strdup(args);
|
fg->graph->scale_sws_opts = av_strdup(args);
|
||||||
|
|
||||||
args[0] = 0;
|
args[0] = 0;
|
||||||
|
@ -1240,7 +1240,7 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e
|
|||||||
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
|
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
|
||||||
ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
|
||||||
|
|
||||||
av_opt_get_int(o->g->sws_opts, "sws_flags", 0, &ost->sws_flags);
|
av_dict_copy(&ost->sws_dict, o->g->sws_dict, 0);
|
||||||
|
|
||||||
av_dict_copy(&ost->swr_opts, o->g->swr_opts, 0);
|
av_dict_copy(&ost->swr_opts, o->g->swr_opts, 0);
|
||||||
if (ost->enc && av_get_exact_bits_per_sample(ost->enc->id) == 24)
|
if (ost->enc && av_get_exact_bits_per_sample(ost->enc->id) == 24)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user