diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-12-02 00:58:59 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-12-02 12:42:29 +0100 |
commit | 83ab46a57e4b8c647366bf81679891164e215a00 (patch) | |
tree | a39f4ec538600153ab4a273a126f4e5391070d00 /libavfilter/vf_blackdetect.c | |
parent | 86a2486812f14bf513632e425649a534882e56f7 (diff) | |
download | ffmpeg-83ab46a57e4b8c647366bf81679891164e215a00.tar.gz |
lavfi/blackdetect: switch to new ff_filter_frame() API
Diffstat (limited to 'libavfilter/vf_blackdetect.c')
-rw-r--r-- | libavfilter/vf_blackdetect.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c index a981212a4d..f2f2cfa231 100644 --- a/libavfilter/vf_blackdetect.c +++ b/libavfilter/vf_blackdetect.c @@ -146,30 +146,20 @@ static int request_frame(AVFilterLink *outlink) return ret; } -static int draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) +static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) { AVFilterContext *ctx = inlink->dst; BlackDetectContext *blackdetect = ctx->priv; - AVFilterBufferRef *picref = inlink->cur_buf; + double picture_black_ratio = 0; + const uint8_t *p = picref->data[0]; int x, i; - const uint8_t *p = picref->data[0] + y * picref->linesize[0]; - for (i = 0; i < h; i++) { + for (i = 0; i < inlink->h; i++) { for (x = 0; x < inlink->w; x++) blackdetect->nb_black_pixels += p[x] <= blackdetect->pixel_black_th_i; p += picref->linesize[0]; } - return ff_draw_slice(ctx->outputs[0], y, h, slice_dir); -} - -static int end_frame(AVFilterLink *inlink) -{ - AVFilterContext *ctx = inlink->dst; - BlackDetectContext *blackdetect = ctx->priv; - AVFilterBufferRef *picref = inlink->cur_buf; - double picture_black_ratio = 0; - picture_black_ratio = (double)blackdetect->nb_black_pixels / (inlink->w * inlink->h); av_log(ctx, AV_LOG_DEBUG, @@ -194,7 +184,7 @@ static int end_frame(AVFilterLink *inlink) blackdetect->last_picref_pts = picref->pts; blackdetect->frame_count++; blackdetect->nb_black_pixels = 0; - return ff_end_frame(inlink->dst->outputs[0]); + return ff_filter_frame(inlink->dst->outputs[0], picref); } static const AVFilterPad blackdetect_inputs[] = { @@ -202,10 +192,8 @@ static const AVFilterPad blackdetect_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, - .draw_slice = draw_slice, .get_video_buffer = ff_null_get_video_buffer, - .start_frame = ff_null_start_frame, - .end_frame = end_frame, + .filter_frame = filter_frame, }, { NULL } }; |