[FFmpeg-devel] [PATCH] lavfi/cropdetect: export crop info to metadata

Clément Bœsch ubitux at gmail.com
Fri May 24 16:00:59 CEST 2013


On Fri, May 24, 2013 at 01:53:28PM +0000, Paul B Mahol wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/vf_cropdetect.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c
> index 28ae887..25a8989 100644
> --- a/libavfilter/vf_cropdetect.c
> +++ b/libavfilter/vf_cropdetect.c
> @@ -118,6 +118,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
>      CropDetectContext *s = ctx->priv;
>      int bpp = s->max_pixsteps[0];
>      int w, h, x, y, shrink_by;
> +    char buf[128];
>  
>      // ignore first 2 frames - they may be empty
>      if (++s->frame_nb > 0) {
> @@ -181,6 +182,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
>          h -= shrink_by;
>          y += (shrink_by/2 + 1) & ~1;
>  
> +        snprintf(buf, sizeof(buf), "%d:%d:%d:%d", w, h, x, y);
> +        av_dict_set(avpriv_frame_get_metadatap(frame), "lavfi.crop", buf, 0);
> +

I think I would prefer "lavfi.crop.w", "lavfi.crop.h", etc because current
patch will force parsing metadata with some sscanf or other craziness.
Also, if we need to change the format, it will only bring problems.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130524/da51854d/attachment.asc>


More information about the ffmpeg-devel mailing list