|
|
@ -175,11 +175,11 @@ static int query_formats(AVFilterContext *ctx) |
|
|
|
|
|
|
|
|
|
|
|
static av_cold int init(AVFilterContext *ctx) |
|
|
|
static av_cold int init(AVFilterContext *ctx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DelogoContext *delogo = ctx->priv; |
|
|
|
DelogoContext *s = ctx->priv; |
|
|
|
|
|
|
|
|
|
|
|
#define CHECK_UNSET_OPT(opt) \ |
|
|
|
#define CHECK_UNSET_OPT(opt) \ |
|
|
|
if (delogo->opt == -1) { \
|
|
|
|
if (s->opt == -1) { \
|
|
|
|
av_log(delogo, AV_LOG_ERROR, "Option %s was not set.\n", #opt); \
|
|
|
|
av_log(s, AV_LOG_ERROR, "Option %s was not set.\n", #opt); \
|
|
|
|
return AVERROR(EINVAL); \
|
|
|
|
return AVERROR(EINVAL); \
|
|
|
|
} |
|
|
|
} |
|
|
|
CHECK_UNSET_OPT(x); |
|
|
|
CHECK_UNSET_OPT(x); |
|
|
@ -187,23 +187,23 @@ static av_cold int init(AVFilterContext *ctx) |
|
|
|
CHECK_UNSET_OPT(w); |
|
|
|
CHECK_UNSET_OPT(w); |
|
|
|
CHECK_UNSET_OPT(h); |
|
|
|
CHECK_UNSET_OPT(h); |
|
|
|
|
|
|
|
|
|
|
|
if (delogo->show) |
|
|
|
if (s->show) |
|
|
|
delogo->band = 4; |
|
|
|
s->band = 4; |
|
|
|
|
|
|
|
|
|
|
|
av_log(ctx, AV_LOG_DEBUG, "x:%d y:%d, w:%d h:%d band:%d show:%d\n", |
|
|
|
av_log(ctx, AV_LOG_DEBUG, "x:%d y:%d, w:%d h:%d band:%d show:%d\n", |
|
|
|
delogo->x, delogo->y, delogo->w, delogo->h, delogo->band, delogo->show); |
|
|
|
s->x, s->y, s->w, s->h, s->band, s->show); |
|
|
|
|
|
|
|
|
|
|
|
delogo->w += delogo->band*2; |
|
|
|
s->w += s->band*2; |
|
|
|
delogo->h += delogo->band*2; |
|
|
|
s->h += s->band*2; |
|
|
|
delogo->x -= delogo->band; |
|
|
|
s->x -= s->band; |
|
|
|
delogo->y -= delogo->band; |
|
|
|
s->y -= s->band; |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
|
|
|
static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DelogoContext *delogo = inlink->dst->priv; |
|
|
|
DelogoContext *s = inlink->dst->priv; |
|
|
|
AVFilterLink *outlink = inlink->dst->outputs[0]; |
|
|
|
AVFilterLink *outlink = inlink->dst->outputs[0]; |
|
|
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); |
|
|
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); |
|
|
|
AVFrame *out; |
|
|
|
AVFrame *out; |
|
|
@ -234,10 +234,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
|
|
|
apply_delogo(out->data[plane], out->linesize[plane], |
|
|
|
apply_delogo(out->data[plane], out->linesize[plane], |
|
|
|
in ->data[plane], in ->linesize[plane], |
|
|
|
in ->data[plane], in ->linesize[plane], |
|
|
|
inlink->w>>hsub, inlink->h>>vsub, |
|
|
|
inlink->w>>hsub, inlink->h>>vsub, |
|
|
|
delogo->x>>hsub, delogo->y>>vsub, |
|
|
|
s->x>>hsub, s->y>>vsub, |
|
|
|
delogo->w>>hsub, delogo->h>>vsub, |
|
|
|
s->w>>hsub, s->h>>vsub, |
|
|
|
delogo->band>>FFMIN(hsub, vsub), |
|
|
|
s->band>>FFMIN(hsub, vsub), |
|
|
|
delogo->show, direct); |
|
|
|
s->show, direct); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!direct) |
|
|
|
if (!direct) |
|
|
|