From 5d273d3efac340ef8de445c955ff44c7abed4e8f Mon Sep 17 00:00:00 2001 From: Mark Thompson Date: Wed, 23 Mar 2016 23:48:13 +0000 Subject: avconv: VAAPI hwcontext initialisation and hwaccel helper Signed-off-by: Anton Khirnov --- avconv_filter.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'avconv_filter.c') diff --git a/avconv_filter.c b/avconv_filter.c index 3ecad56476..a412f6e314 100644 --- a/avconv_filter.c +++ b/avconv_filter.c @@ -307,7 +307,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, if (ret < 0) return ret; - if (codec->width || codec->height) { + if (!hw_device_ctx && (codec->width || codec->height)) { char args[255]; AVFilterContext *filter; @@ -513,6 +513,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, par->format = ist->hwaccel_retrieve_data ? ist->hwaccel_retrieved_pix_fmt : ist->dec_ctx->pix_fmt; par->time_base = tb; + par->hw_frames_ctx = ist->hw_frames_ctx; ret = av_buffersrc_parameters_set(ifilter->filter, par); av_freep(&par); @@ -719,6 +720,12 @@ int configure_filtergraph(FilterGraph *fg) if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0) return ret; + if (hw_device_ctx) { + for (i = 0; i < fg->graph->nb_filters; i++) { + fg->graph->filters[i]->hw_device_ctx = av_buffer_ref(hw_device_ctx); + } + } + if (simple && (!inputs || inputs->next || !outputs || outputs->next)) { av_log(NULL, AV_LOG_ERROR, "Simple filtergraph '%s' does not have " "exactly one input and output.\n", graph_desc); -- cgit v1.2.3