[FFmpeg-devel] [PATCH 1/3] lavfi: add frame counter into AVFilterLink and use it in filters.

Stefano Sabatini stefasab at gmail.com
Sat Apr 20 11:17:41 CEST 2013


On date Friday 2013-04-19 00:28:52 +0200, Clément Bœsch encoded:
> ---
>  libavfilter/avfilter.c          | 1 +
>  libavfilter/avfilter.h          | 5 +++++
>  libavfilter/f_select.c          | 2 +-
>  libavfilter/vf_blackdetect.c    | 6 ++----
>  libavfilter/vf_blend.c          | 3 +--
>  libavfilter/vf_crop.c           | 3 +--
>  libavfilter/vf_decimate.c       | 3 +--
>  libavfilter/vf_drawtext.c       | 7 +++----
>  libavfilter/vf_fieldmatch.c     | 8 +++-----
>  libavfilter/vf_framestep.c      | 4 ++--
>  libavfilter/vf_geq.c            | 2 +-
>  libavfilter/vf_hue.c            | 3 +--
>  libavfilter/vf_overlay.c        | 2 +-
>  libavfilter/vf_separatefields.c | 6 +++---
>  libavfilter/vf_telecine.c       | 3 +--
>  15 files changed, 27 insertions(+), 31 deletions(-)
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index f392613..43340d1 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -915,6 +915,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
>  
>      pts = out->pts;
>      ret = filter_frame(link, out);
> +    link->frame_count++;
>      link->frame_requested = 0;
>      ff_update_link_current_pts(link, pts);
>      return ret;
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 0b970d0..38bc5ee 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -718,6 +718,11 @@ struct AVFilterLink {
>       * Link processing flags.
>       */
>      unsigned flags;
> +

> +    /**
> +     * Number of frames a link has seen
> +     */
> +    int64_t frame_count;

Description is a bit idiomatic (a link can't "see"), also I'm not sure
it is accurate since the frame_count is updated *after* a frame has
been passed through the link.

I suggest:
number of past frames sent through the link

[...]

LGTM otherwise, thanks.
-- 
FFmpeg = Furious Fantastic Magical Perfectionist Elaborated Gangster


More information about the ffmpeg-devel mailing list