X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavfilter%2Favfilter.c;h=963f5e6479053421a0d39e70ad543c4767283f11;hp=7b114676aa6af69aa011e8d8a55bc3f0a71a70f2;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavfilter/avfilter.c b/ffmpeg/libavfilter/avfilter.c index 7b11467..963f5e6 100644 --- a/ffmpeg/libavfilter/avfilter.c +++ b/ffmpeg/libavfilter/avfilter.c @@ -227,6 +227,11 @@ int avfilter_config_links(AVFilterContext *filter) AVFilterLink *inlink; if (!link) continue; + if (!link->src || !link->dst) { + av_log(filter, AV_LOG_ERROR, + "Not all input and output are properly linked (%d).\n", i); + return AVERROR(EINVAL); + } inlink = link->src->nb_inputs ? link->src->inputs[0] : NULL; link->current_pts = AV_NOPTS_VALUE; @@ -381,8 +386,23 @@ int ff_poll_frame(AVFilterLink *link) return min; } -static const char *const var_names[] = { "t", "n", "pos", NULL }; -enum { VAR_T, VAR_N, VAR_POS, VAR_VARS_NB }; +static const char *const var_names[] = { + "t", + "n", + "pos", + "w", + "h", + NULL +}; + +enum { + VAR_T, + VAR_N, + VAR_POS, + VAR_W, + VAR_H, + VAR_VARS_NB +}; static int set_enable_expr(AVFilterContext *ctx, const char *expr) { @@ -1071,6 +1091,8 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) int64_t pos = av_frame_get_pkt_pos(out); dstctx->var_values[VAR_N] = link->frame_count; dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base); + dstctx->var_values[VAR_W] = link->w; + dstctx->var_values[VAR_H] = link->h; dstctx->var_values[VAR_POS] = pos == -1 ? NAN : pos; dstctx->is_disabled = fabs(av_expr_eval(dstctx->enable, dstctx->var_values, NULL)) < 0.5;