diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-02-02 09:47:16 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-02-14 22:21:00 +0100 |
commit | b3dd30db0b2d857147fc0e1461a00bd6172a26a3 (patch) | |
tree | f486f89cbcb2e4c6cf975db2008edaa71563a398 /libavfilter/avfilter.c | |
parent | ad884d100259e55cb51a4239cd8a4fd5154c2073 (diff) | |
download | ffmpeg-b3dd30db0b2d857147fc0e1461a00bd6172a26a3.tar.gz |
lavfi: pass the hw frames context through the filter chain
Diffstat (limited to 'libavfilter/avfilter.c')
-rw-r--r-- | libavfilter/avfilter.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index cd98d16220..8eefc512c0 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -20,8 +20,10 @@ */ #include "libavutil/avstring.h" +#include "libavutil/buffer.h" #include "libavutil/channel_layout.h" #include "libavutil/common.h" +#include "libavutil/hwcontext.h" #include "libavutil/imgutils.h" #include "libavutil/internal.h" #include "libavutil/opt.h" @@ -217,6 +219,17 @@ int avfilter_config_links(AVFilterContext *filter) return ret; } + if (link->src->nb_inputs && link->src->inputs[0]->hw_frames_ctx && + !link->hw_frames_ctx) { + AVHWFramesContext *input_ctx = (AVHWFramesContext*)link->src->inputs[0]->hw_frames_ctx->data; + + if (input_ctx->format == link->format) { + link->hw_frames_ctx = av_buffer_ref(link->src->inputs[0]->hw_frames_ctx); + if (!link->hw_frames_ctx) + return AVERROR(ENOMEM); + } + } + link->init_state = AVLINK_INIT; } } @@ -481,6 +494,8 @@ static void free_link(AVFilterLink *link) if (link->dst) link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL; + av_buffer_unref(&link->hw_frames_ctx); + ff_formats_unref(&link->in_formats); ff_formats_unref(&link->out_formats); ff_formats_unref(&link->in_samplerates); |