1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

avfilter/vf_blend: unbreak tblend

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2015-07-18 05:00:03 +00:00
parent 5c7f708683
commit 9a829a2b6a

View File

@ -423,17 +423,17 @@ static av_cold void uninit(AVFilterContext *ctx)
av_expr_free(b->params[i].e); av_expr_free(b->params[i].e);
} }
#if CONFIG_BLEND_FILTER
static int config_output(AVFilterLink *outlink) static int config_output(AVFilterLink *outlink)
{ {
AVFilterContext *ctx = outlink->src; AVFilterContext *ctx = outlink->src;
AVFilterLink *toplink = ctx->inputs[TOP]; AVFilterLink *toplink = ctx->inputs[TOP];
AVFilterLink *bottomlink = ctx->inputs[BOTTOM];
BlendContext *b = ctx->priv; BlendContext *b = ctx->priv;
const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(toplink->format); const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(toplink->format);
int ret, plane, is_16bit; int ret, plane, is_16bit;
if (!b->tblend) {
AVFilterLink *bottomlink = ctx->inputs[BOTTOM];
if (toplink->format != bottomlink->format) { if (toplink->format != bottomlink->format) {
av_log(ctx, AV_LOG_ERROR, "inputs must be of same pixel format\n"); av_log(ctx, AV_LOG_ERROR, "inputs must be of same pixel format\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
@ -453,6 +453,7 @@ static int config_output(AVFilterLink *outlink)
bottomlink->sample_aspect_ratio.den); bottomlink->sample_aspect_ratio.den);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
}
outlink->w = toplink->w; outlink->w = toplink->w;
outlink->h = toplink->h; outlink->h = toplink->h;
@ -466,7 +467,9 @@ static int config_output(AVFilterLink *outlink)
is_16bit = pix_desc->comp[0].depth_minus1 == 15; is_16bit = pix_desc->comp[0].depth_minus1 == 15;
b->nb_planes = av_pix_fmt_count_planes(toplink->format); b->nb_planes = av_pix_fmt_count_planes(toplink->format);
if ((ret = ff_dualinput_init(ctx, &b->dinput)) < 0) if (b->tblend)
outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
else if ((ret = ff_dualinput_init(ctx, &b->dinput)) < 0)
return ret; return ret;
for (plane = 0; plane < FF_ARRAY_ELEMS(b->params); plane++) { for (plane = 0; plane < FF_ARRAY_ELEMS(b->params); plane++) {
@ -525,6 +528,8 @@ static int config_output(AVFilterLink *outlink)
return 0; return 0;
} }
#if CONFIG_BLEND_FILTER
static int request_frame(AVFilterLink *outlink) static int request_frame(AVFilterLink *outlink)
{ {
BlendContext *b = outlink->src->priv; BlendContext *b = outlink->src->priv;
@ -577,21 +582,6 @@ AVFilter ff_vf_blend = {
#if CONFIG_TBLEND_FILTER #if CONFIG_TBLEND_FILTER
static int tblend_config_output(AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
AVFilterLink *inlink = ctx->inputs[0];
BlendContext *b = ctx->priv;
const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(inlink->format);
b->hsub = pix_desc->log2_chroma_w;
b->vsub = pix_desc->log2_chroma_h;
b->nb_planes = av_pix_fmt_count_planes(inlink->format);
outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
return 0;
}
static int tblend_filter_frame(AVFilterLink *inlink, AVFrame *frame) static int tblend_filter_frame(AVFilterLink *inlink, AVFrame *frame)
{ {
BlendContext *b = inlink->dst->priv; BlendContext *b = inlink->dst->priv;
@ -627,7 +617,7 @@ static const AVFilterPad tblend_outputs[] = {
{ {
.name = "default", .name = "default",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.config_props = tblend_config_output, .config_props = config_output,
}, },
{ NULL } { NULL }
}; };