Commit 28478438 authored by Kevin Mitchell's avatar Kevin Mitchell Committed by Michael Niedermayer

avfilter/idet: add metadata to "current" frame instead of "next" frame

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 8d9277c3
......@@ -31,7 +31,7 @@
#define LIBAVFILTER_VERSION_MAJOR 5
#define LIBAVFILTER_VERSION_MINOR 2
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_MICRO 101
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
......
......@@ -82,6 +82,7 @@ static void filter(AVFilterContext *ctx)
int64_t delta=0;
Type type, best_type;
int match = 0;
AVDictionary **metadata = avpriv_frame_get_metadatap(idet->cur);
for (i = 0; i < idet->csp->nb_components; i++) {
int w = idet->cur->width;
......@@ -147,14 +148,25 @@ static void filter(AVFilterContext *ctx)
idet->prestat [ type] ++;
idet->poststat[idet->last_type] ++;
av_log(ctx, AV_LOG_DEBUG, "Single frame:%s, Multi frame:%s\n", type2str(type), type2str(idet->last_type));
av_dict_set_int(metadata, "lavfi.idet.single.tff", idet->prestat[TFF], 0);
av_dict_set_int(metadata, "lavfi.idet.single.bff", idet->prestat[BFF], 0);
av_dict_set_int(metadata, "lavfi.idet.single.progressive", idet->prestat[PROGRESSIVE], 0);
av_dict_set_int(metadata, "lavfi.idet.single.undetermined", idet->prestat[UNDETERMINED], 0);
av_dict_set_int(metadata, "lavfi.idet.multiple.tff", idet->poststat[TFF], 0);
av_dict_set_int(metadata, "lavfi.idet.multiple.bff", idet->poststat[BFF], 0);
av_dict_set_int(metadata, "lavfi.idet.multiple.progressive", idet->poststat[PROGRESSIVE], 0);
av_dict_set_int(metadata, "lavfi.idet.multiple.undetermined", idet->poststat[UNDETERMINED], 0);
}
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);
......@@ -178,16 +190,6 @@ static int filter_frame(AVFilterLink *link, AVFrame *picref)
filter(ctx);
av_dict_set_int(metadata, "lavfi.idet.single.tff", idet->prestat[TFF], 0);
av_dict_set_int(metadata, "lavfi.idet.single.bff", idet->prestat[BFF], 0);
av_dict_set_int(metadata, "lavfi.idet.single.progressive", idet->prestat[PROGRESSIVE], 0);
av_dict_set_int(metadata, "lavfi.idet.single.undetermined", idet->prestat[UNDETERMINED], 0);
av_dict_set_int(metadata, "lavfi.idet.multiple.tff", idet->poststat[TFF], 0);
av_dict_set_int(metadata, "lavfi.idet.multiple.bff", idet->poststat[BFF], 0);
av_dict_set_int(metadata, "lavfi.idet.multiple.progressive", idet->poststat[PROGRESSIVE], 0);
av_dict_set_int(metadata, "lavfi.idet.multiple.undetermined", idet->poststat[UNDETERMINED], 0);
return ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->cur));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment