diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-05-27 13:14:33 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-06-25 13:04:32 +0300 |
commit | a3a0230a9870b9018dc7415ae5872784d524cfe5 (patch) | |
tree | e3b25576b71cdae38235c1cd480455329480d027 /avconv_filter.c | |
parent | 3e265ca58f0505470186dce300ab66a6eac3978e (diff) |
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.
Diffstat (limited to 'avconv_filter.c')
-rw-r--r-- | avconv_filter.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/avconv_filter.c b/avconv_filter.c index 44f3d07eaf..9c983c0e2b 100644 --- a/avconv_filter.c +++ b/avconv_filter.c @@ -100,6 +100,10 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost) fg->inputs[0]->graph = fg; fg->inputs[0]->format = -1; + fg->inputs[0]->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*)); + if (!fg->inputs[0]) + exit_program(1); + GROW_ARRAY(ist->filters, ist->nb_filters); ist->filters[ist->nb_filters - 1] = fg->inputs[0]; @@ -176,6 +180,10 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) fg->inputs[fg->nb_inputs - 1]->graph = fg; fg->inputs[fg->nb_inputs - 1]->format = -1; + fg->inputs[fg->nb_inputs - 1]->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*)); + if (!fg->inputs[fg->nb_inputs - 1]) + exit_program(1); + GROW_ARRAY(ist->filters, ist->nb_filters); ist->filters[ist->nb_filters - 1] = fg->inputs[fg->nb_inputs - 1]; } @@ -786,31 +794,6 @@ int ifilter_parameters_from_frame(InputFilter *ifilter, const AVFrame *frame) return 0; } -int ifilter_parameters_from_decoder(InputFilter *ifilter, const AVCodecContext *avctx) -{ - av_buffer_unref(&ifilter->hw_frames_ctx); - - if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) - ifilter->format = avctx->pix_fmt; - else - ifilter->format = avctx->sample_fmt; - - ifilter->width = avctx->width; - ifilter->height = avctx->height; - ifilter->sample_aspect_ratio = avctx->sample_aspect_ratio; - - ifilter->sample_rate = avctx->sample_rate; - ifilter->channel_layout = avctx->channel_layout; - - if (avctx->hw_frames_ctx) { - ifilter->hw_frames_ctx = av_buffer_ref(avctx->hw_frames_ctx); - if (!ifilter->hw_frames_ctx) - return AVERROR(ENOMEM); - } - - return 0; -} - int ist_in_filtergraph(FilterGraph *fg, InputStream *ist) { int i; |