aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_blackframe.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-05 12:39:51 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-05 13:02:20 +0200
commit22d841becd89f21fcd88a76bcafb675fd051ce86 (patch)
tree04f910119420fabb5557217eb8c7cd6c1a0d24ea /libavfilter/vf_blackframe.c
parent25c2f13d00fcfdb81c33a459795c33d29f8690e8 (diff)
parent6e19cfb083eda83aaf4b49ae765ab2b3e578d32d (diff)
downloadffmpeg-22d841becd89f21fcd88a76bcafb675fd051ce86.tar.gz
Merge branch 'master' into oldabi
* master: (780 commits) ffmpeg: Fix doxygen comments for MetadataMap filters.texi: fix wrong references in the "Filtergraph syntax" section yadif: correct documentation on the parity parameter mpegvideo.h: remove the 1 line difference to qatar applehttp: fix variant discard logic Fix possible crash when decoding mpeg streams. h263dec: Fix asserts broken by the elimination of FF_COMMON_FRAME. avidec: skip seek pos adjustment for non interleaved files. Fixes Ticket327 lsws: remove deprecated and unused stuff after the 0->1 major bump cosmetics: remove some stray comments from AVCodec declarations cosmetics: fix indentation/alignment in AVCodec declarations Abort if command offset decreases, avoids potential endless loop. Warn when falling back to unreliable UMF fps tag. Detect NI-avi at playtime like mplayer. Fixes Ticket333 avidec: Fix XAN DPCM demuxing. Fix a possible miscompilation of cabac with old (broken) compilers. Fix -loop_input. Set bits_per_coded_sample when encoding ADPCM. vf_boxblur: call avfilter_draw_slice() at the end of draw_slice() vf_boxblur: fix out-of-buffer access when h > w ... Conflicts: ffmpeg.c libavcodec/avcodec.h libavcodec/opt.h libavcodec/version.h libavdevice/avdevice.h libavfilter/avfilter.h libavformat/avformat.h libavformat/aviobuf.c libavformat/rtsp.c libavformat/udp.c libavformat/utils.c libavformat/version.h libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_blackframe.c')
-rw-r--r--libavfilter/vf_blackframe.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c
index 41b4a92ce5..843e8273f4 100644
--- a/libavfilter/vf_blackframe.c
+++ b/libavfilter/vf_blackframe.c
@@ -34,6 +34,7 @@ typedef struct {
unsigned int bthresh; ///< black threshold
unsigned int frame; ///< frame number
unsigned int nblack; ///< number of black pixels counted so far
+ unsigned int last_keyframe; ///< frame number of the last received key-frame
} BlackFrameContext;
static int query_formats(AVFilterContext *ctx)
@@ -56,6 +57,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
blackframe->bthresh = 32;
blackframe->nblack = 0;
blackframe->frame = 0;
+ blackframe->last_keyframe = 0;
if (args)
sscanf(args, "%u:%u", &blackframe->bamount, &blackframe->bthresh);
@@ -95,11 +97,16 @@ static void end_frame(AVFilterLink *inlink)
AVFilterBufferRef *picref = inlink->cur_buf;
int pblack = 0;
+ if (picref->video->key_frame)
+ blackframe->last_keyframe = blackframe->frame;
+
pblack = blackframe->nblack * 100 / (inlink->w * inlink->h);
if (pblack >= blackframe->bamount)
- av_log(ctx, AV_LOG_INFO, "frame:%u pblack:%u pos:%"PRId64" pts:%"PRId64" t:%f\n",
+ av_log(ctx, AV_LOG_INFO, "frame:%u pblack:%u pos:%"PRId64" pts:%"PRId64" t:%f "
+ "type:%c last_keyframe:%d\n",
blackframe->frame, pblack, picref->pos, picref->pts,
- picref->pts == AV_NOPTS_VALUE ? -1 : picref->pts * av_q2d(inlink->time_base));
+ picref->pts == AV_NOPTS_VALUE ? -1 : picref->pts * av_q2d(inlink->time_base),
+ av_get_picture_type_char(picref->video->pict_type), blackframe->last_keyframe);
blackframe->frame++;
blackframe->nblack = 0;