From a3a0230a9870b9018dc7415ae5872784d524cfe5 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 27 May 2016 12:14:33 +0200 Subject: avconv: 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. --- avconv_opt.c | 44 -------------------------------------------- 1 file changed, 44 deletions(-) (limited to 'avconv_opt.c') diff --git a/avconv_opt.c b/avconv_opt.c index 814500d2bd..362a5b7f5e 100644 --- a/avconv_opt.c +++ b/avconv_opt.c @@ -553,10 +553,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) switch (par->codec_type) { case AVMEDIA_TYPE_VIDEO: - 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) { @@ -616,12 +612,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) break; case AVMEDIA_TYPE_AUDIO: 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: @@ -1497,33 +1487,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; @@ -2471,13 +2434,6 @@ int avconv_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) { -- cgit v1.2.3