The attached patch adds the cumulative tff / bff / progressive /
undetermined counts to the AVFrame metadata. The use case is to decide
which deinterlacing filter to insert in an mpv lua script.
From a06cf8a453139964bc7dd7c27612692a3f660b0d Mon Sep 17 00:00:00 2001
From: Kevin Mitchell <kevmi...@gmail.com>
Date: Sun, 19 Oct 2014 04:11:25 -0700
Subject: [PATCH] avfilter/vf_idet: add counts to frame metadata

---
 libavfilter/vf_idet.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c
index f8d71de..ebbc7d2 100644
--- a/libavfilter/vf_idet.c
+++ b/libavfilter/vf_idet.c
@@ -154,6 +154,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
 {
     AVFilterContext *ctx = link->dst;
     IDETContext *idet = ctx->priv;
+    AVDictionary **metadata = avpriv_frame_get_metadatap(picref);
 
     if (idet->prev)
         av_frame_free(&idet->prev);
@@ -177,6 +178,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
 
     filter(ctx);
 
+    av_dict_set_int(metadata, "lavfi.idet.tff", idet->prestat[TFF], 0);
+    av_dict_set_int(metadata, "lavfi.idet.bff", idet->prestat[BFF], 0);
+    av_dict_set_int(metadata, "lavfi.idet.progressive", idet->prestat[PROGRESSIVE], 0);
+    av_dict_set_int(metadata, "lavfi.idet.undetermined", idet->prestat[UNDETERMINED], 0);
+
     return ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->cur));
 }
 
-- 
2.1.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to