char sws_flags_str[128];
char buffersrc_args[256];
int ret;
- AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_crop;
AVCodecContext *codec = is->video_st->codec;
AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
- if (!buffersink_params)
- return AVERROR(ENOMEM);
-
av_opt_get_int(sws_opts, "sws_flags", 0, &sws_flags);
snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%"PRId64, sws_flags);
graph->scale_sws_opts = av_strdup(sws_flags_str);
graph)) < 0)
goto fail;
- buffersink_params->pixel_fmts = pix_fmts;
ret = avfilter_graph_create_filter(&filt_out,
avfilter_get_by_name("buffersink"),
- "ffplay_buffersink", NULL, buffersink_params, graph);
+ "ffplay_buffersink", NULL, NULL, graph);
if (ret < 0)
goto fail;
+ if ((ret = av_opt_set_int_list(filt_out, "pix_fmts", pix_fmts, AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
+ goto fail;
+
/* SDL YUV code is not handling odd width/height for some driver
* combinations, therefore we crop the picture to an even width/height. */
if ((ret = avfilter_graph_create_filter(&filt_crop,
is->out_video_filter = filt_out;
fail:
- av_freep(&buffersink_params);
return ret;
}
int channels[2] = { 0, -1 };
AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
char asrc_args[256];
- AVABufferSinkParams *asink_params = NULL;
int ret;
avfilter_graph_free(&is->agraph);
if (ret < 0)
goto end;
- if (!(asink_params = av_abuffersink_params_alloc())) {
- ret = AVERROR(ENOMEM);
+
+ ret = avfilter_graph_create_filter(&filt_asink,
+ avfilter_get_by_name("abuffersink"), "ffplay_abuffersink",
+ NULL, NULL, is->agraph);
+ if (ret < 0)
+ goto end;
+
+ if ((ret = av_opt_set_int_list(filt_asink, "sample_fmts", sample_fmts, AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
+ goto end;
+ if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0)
goto end;
- }
- asink_params->sample_fmts = sample_fmts;
- asink_params->all_channel_counts = 1;
if (force_output_format) {
channel_layouts[0] = is->audio_tgt.channel_layout;
- asink_params->channel_layouts = channel_layouts;
- asink_params->all_channel_counts = 0;
- channels[0] = is->audio_tgt.channels;
- asink_params->channel_counts = channels;
- asink_params->all_channel_counts = 0;
- sample_rates[0] = is->audio_tgt.freq;
- asink_params->sample_rates = sample_rates;
+ channels [0] = is->audio_tgt.channels;
+ sample_rates [0] = is->audio_tgt.freq;
+ if ((ret = av_opt_set_int(filt_asink, "all_channel_counts", 0, AV_OPT_SEARCH_CHILDREN)) < 0)
+ goto end;
+ if ((ret = av_opt_set_int_list(filt_asink, "channel_layouts", channel_layouts, -1, AV_OPT_SEARCH_CHILDREN)) < 0)
+ goto end;
+ if ((ret = av_opt_set_int_list(filt_asink, "channel_counts" , channels , -1, AV_OPT_SEARCH_CHILDREN)) < 0)
+ goto end;
+ if ((ret = av_opt_set_int_list(filt_asink, "sample_rates" , sample_rates , -1, AV_OPT_SEARCH_CHILDREN)) < 0)
+ goto end;
}
- ret = avfilter_graph_create_filter(&filt_asink,
- avfilter_get_by_name("abuffersink"), "ffplay_abuffersink",
- NULL, asink_params, is->agraph);
- if (ret < 0)
- goto end;
if ((ret = configure_filtergraph(is->agraph, afilters, filt_asrc, filt_asink)) < 0)
goto end;
is->out_audio_filter = filt_asink;
end:
- av_freep(&asink_params);
if (ret < 0)
avfilter_graph_free(&is->agraph);
return ret;
is->max_frame_duration = (ic->iformat->flags & AVFMT_TS_DISCONT) ? 10.0 : 3600.0;
+ if (!window_title && (t = av_dict_get(ic->metadata, "title", NULL, 0)))
+ window_title = av_asprintf("%s - %s", t->value, input_filename);
+
/* if seeking requested, we execute it */
if (start_time != AV_NOPTS_VALUE) {
int64_t timestamp;