summaryrefslogtreecommitdiff
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-05-27 12:14:33 +0200
committerwm4 <nfxjfg@googlemail.com>2017-03-03 08:45:43 +0100
commitaf1761f7b5b1b72197dc40934953b775c2d951cc (patch)
tree46941e97c792c8331d288639e4f39231bcb0f017 /ffmpeg_opt.c
parent4ee5aed122ba7d289c1686eca6eba161d5d62304 (diff)
ffmpeg: init filtergraphs only after we have a frame on each input
This makes sure the actual stream parameters are used, which is important mainly for hardware decoding+filtering cases, which would previously require various weird workarounds to handle the fact that a fake software graph has to be constructed, but never used. This should also improve behaviour in rare cases where avformat_find_stream_info() does not provide accurate information. This merges Libav commit a3a0230. It was previously skipped. The code in flush_encoders() which sets up a "fake" format wasn't in Libav. I'm not sure if it's a good idea, but it tends to give behavior closer to the old one in certain corner cases. The vp8-size-change gives different result, because now the size of the first frame is used. libavformat reported the size of the largest frame for some reason. The exr tests now use the sample aspect ratio of the first frame. For some reason libavformat determines 0/1 as aspect ratio, while the decoder returns the correct one. The ffm and mxf tests change the field_order values. I'm assuming another libavformat/decoding mismatch. Signed-off-by: wm4 <nfxjfg@googlemail.com>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c44
1 files changed, 0 insertions, 44 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 6a47d32b53..e2c0176e14 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -736,10 +736,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
// avformat_find_stream_info() doesn't set this for us anymore.
ist->dec_ctx->framerate = st->avg_frame_rate;
- ist->resample_height = ist->dec_ctx->height;
- ist->resample_width = ist->dec_ctx->width;
- ist->resample_pix_fmt = ist->dec_ctx->pix_fmt;
-
MATCH_PER_STREAM_OPT(frame_rates, str, framerate, ic, st);
if (framerate && av_parse_video_rate(&ist->framerate,
framerate) < 0) {
@@ -804,12 +800,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
ist->guess_layout_max = INT_MAX;
MATCH_PER_STREAM_OPT(guess_layout_max, i, ist->guess_layout_max, ic, st);
guess_input_channel_layout(ist);
-
- ist->resample_sample_fmt = ist->dec_ctx->sample_fmt;
- ist->resample_sample_rate = ist->dec_ctx->sample_rate;
- ist->resample_channels = ist->dec_ctx->channels;
- ist->resample_channel_layout = ist->dec_ctx->channel_layout;
-
break;
case AVMEDIA_TYPE_DATA:
case AVMEDIA_TYPE_SUBTITLE: {
@@ -2021,33 +2011,6 @@ static int init_complex_filters(void)
return 0;
}
-static int configure_complex_filters(void)
-{
- int i, j, ret = 0;
-
- for (i = 0; i < nb_filtergraphs; i++) {
- FilterGraph *fg = filtergraphs[i];
-
- if (filtergraph_is_simple(fg))
- continue;
-
- for (j = 0; j < fg->nb_inputs; j++) {
- ret = ifilter_parameters_from_decoder(fg->inputs[j],
- fg->inputs[j]->ist->dec_ctx);
- if (ret < 0) {
- av_log(NULL, AV_LOG_ERROR,
- "Error initializing filtergraph %d input %d\n", i, j);
- return ret;
- }
- }
-
- ret = configure_filtergraph(filtergraphs[i]);
- if (ret < 0)
- return ret;
- }
- return 0;
-}
-
static int open_output_file(OptionsContext *o, const char *filename)
{
AVFormatContext *oc;
@@ -3291,13 +3254,6 @@ int ffmpeg_parse_options(int argc, char **argv)
goto fail;
}
- /* configure the complex filtergraphs */
- ret = configure_complex_filters();
- if (ret < 0) {
- av_log(NULL, AV_LOG_FATAL, "Error configuring complex filters.\n");
- goto fail;
- }
-
fail:
uninit_parse_context(&octx);
if (ret < 0) {