summaryrefslogtreecommitdiff
path: root/avconv_filter.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2016-03-23 23:48:13 +0000
committerAnton Khirnov <anton@khirnov.net>2016-03-30 09:04:53 +0200
commit5d273d3efac340ef8de445c955ff44c7abed4e8f (patch)
tree245dbf7c3bb31832b9d0937fc52f4232f9f5b87d /avconv_filter.c
parentca8c7591735c0f80cc29e31e2e92cb10228e14c7 (diff)
avconv: VAAPI hwcontext initialisation and hwaccel helper
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'avconv_filter.c')
-rw-r--r--avconv_filter.c9
1 files changed, 8 insertions, 1 deletions
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);