mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-19 09:02:26 +02:00
ffplay: replace opaque/params for buffersinks
This fixes a regression caused by droping opaque. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
047a027d0b
commit
e87c1cdbb5
52
ffplay.c
52
ffplay.c
@ -1758,14 +1758,10 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
|||||||
char sws_flags_str[128];
|
char sws_flags_str[128];
|
||||||
char buffersrc_args[256];
|
char buffersrc_args[256];
|
||||||
int ret;
|
int ret;
|
||||||
AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
|
|
||||||
AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_crop;
|
AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_crop;
|
||||||
AVCodecContext *codec = is->video_st->codec;
|
AVCodecContext *codec = is->video_st->codec;
|
||||||
AVRational fr = av_guess_frame_rate(is->ic, is->video_st, NULL);
|
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);
|
av_opt_get_int(sws_opts, "sws_flags", 0, &sws_flags);
|
||||||
snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%"PRId64, sws_flags);
|
snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%"PRId64, sws_flags);
|
||||||
graph->scale_sws_opts = av_strdup(sws_flags_str);
|
graph->scale_sws_opts = av_strdup(sws_flags_str);
|
||||||
@ -1784,13 +1780,15 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
|||||||
graph)) < 0)
|
graph)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
buffersink_params->pixel_fmts = pix_fmts;
|
|
||||||
ret = avfilter_graph_create_filter(&filt_out,
|
ret = avfilter_graph_create_filter(&filt_out,
|
||||||
avfilter_get_by_name("buffersink"),
|
avfilter_get_by_name("buffersink"),
|
||||||
"ffplay_buffersink", NULL, buffersink_params, graph);
|
"ffplay_buffersink", NULL, NULL, graph);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
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
|
/* SDL YUV code is not handling odd width/height for some driver
|
||||||
* combinations, therefore we crop the picture to an even width/height. */
|
* combinations, therefore we crop the picture to an even width/height. */
|
||||||
if ((ret = avfilter_graph_create_filter(&filt_crop,
|
if ((ret = avfilter_graph_create_filter(&filt_crop,
|
||||||
@ -1807,7 +1805,6 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
|||||||
is->out_video_filter = filt_out;
|
is->out_video_filter = filt_out;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
av_freep(&buffersink_params);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1819,7 +1816,6 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
|||||||
int channels[2] = { 0, -1 };
|
int channels[2] = { 0, -1 };
|
||||||
AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
|
AVFilterContext *filt_asrc = NULL, *filt_asink = NULL;
|
||||||
char asrc_args[256];
|
char asrc_args[256];
|
||||||
AVABufferSinkParams *asink_params = NULL;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
avfilter_graph_free(&is->agraph);
|
avfilter_graph_free(&is->agraph);
|
||||||
@ -1841,30 +1837,33 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (!(asink_params = av_abuffersink_params_alloc())) {
|
|
||||||
ret = AVERROR(ENOMEM);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = avfilter_graph_create_filter(&filt_asink,
|
ret = avfilter_graph_create_filter(&filt_asink,
|
||||||
avfilter_get_by_name("abuffersink"), "ffplay_abuffersink",
|
avfilter_get_by_name("abuffersink"), "ffplay_abuffersink",
|
||||||
NULL, asink_params, is->agraph);
|
NULL, NULL, is->agraph);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto end;
|
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;
|
||||||
|
|
||||||
|
if (force_output_format) {
|
||||||
|
channel_layouts[0] = is->audio_tgt.channel_layout;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((ret = configure_filtergraph(is->agraph, afilters, filt_asrc, filt_asink)) < 0)
|
if ((ret = configure_filtergraph(is->agraph, afilters, filt_asrc, filt_asink)) < 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
@ -1872,7 +1871,6 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for
|
|||||||
is->out_audio_filter = filt_asink;
|
is->out_audio_filter = filt_asink;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
av_freep(&asink_params);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
avfilter_graph_free(&is->agraph);
|
avfilter_graph_free(&is->agraph);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user