vf_blackdetect.c File Reference

Video black detector, loosely based on blackframe with extended syntax and features. More...

#include <float.h>
#include "libavutil/opt.h"
#include "libavutil/timestamp.h"
#include "avfilter.h"
#include "internal.h"
Include dependency graph for vf_blackdetect.c:

Go to the source code of this file.

Data Structures

struct  BlackDetectContext
 

Macros

#define OFFSET(x)   offsetof(BlackDetectContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define YUVJ_FORMATS   AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P
 

Functions

 AVFILTER_DEFINE_CLASS (blackdetect)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static void check_black_end (AVFilterContext *ctx)
 
static int request_frame (AVFilterLink *outlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *picref)
 

Variables

static const AVOption blackdetect_options []
 
static enum AVPixelFormat yuvj_formats []
 
static const AVFilterPad blackdetect_inputs []
 
static const AVFilterPad blackdetect_outputs []
 
AVFilter avfilter_vf_blackdetect
 

Detailed Description

Video black detector, loosely based on blackframe with extended syntax and features.

Definition in file vf_blackdetect.c.

Macro Definition Documentation

Definition at line 51 of file vf_blackdetect.c.

#define OFFSET (   x)    offsetof(BlackDetectContext, x)

Definition at line 50 of file vf_blackdetect.c.

Definition at line 65 of file vf_blackdetect.c.

Referenced by query_formats().

Function Documentation

AVFILTER_DEFINE_CLASS ( blackdetect  )
static void check_black_end ( AVFilterContext ctx)
static

Definition at line 106 of file vf_blackdetect.c.

Referenced by filter_frame(), and request_frame().

static int config_input ( AVFilterLink inlink)
static

Definition at line 85 of file vf_blackdetect.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame picref 
)
static

Definition at line 135 of file vf_blackdetect.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 72 of file vf_blackdetect.c.

static int request_frame ( AVFilterLink outlink)
static

Definition at line 120 of file vf_blackdetect.c.

Variable Documentation

AVFilter avfilter_vf_blackdetect
Initial value:
= {
.name = "blackdetect",
.description = NULL_IF_CONFIG_SMALL("Detect video intervals that are (almost) black."),
.priv_size = sizeof(BlackDetectContext),
.priv_class = &blackdetect_class,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static const AVFilterPad blackdetect_inputs[]
static int query_formats(AVFilterContext *ctx)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const AVFilterPad blackdetect_outputs[]
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs

Definition at line 196 of file vf_blackdetect.c.

const AVFilterPad blackdetect_inputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_input,
.get_video_buffer = ff_null_get_video_buffer,
.filter_frame = filter_frame,
},
{ NULL }
}
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
Definition: video.c:35
static int config_input(AVFilterLink *inlink)
NULL
Definition: eval.c:55
static int filter_frame(AVFilterLink *inlink, AVFrame *picref)

Definition at line 176 of file vf_blackdetect.c.

const AVOption blackdetect_options[]
static
Initial value:
= {
{ "d", "set minimum detected black duration in seconds", OFFSET(black_min_duration_time), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 0, DBL_MAX, FLAGS },
{ "black_min_duration", "set minimum detected black duration in seconds", OFFSET(black_min_duration_time), AV_OPT_TYPE_DOUBLE, {.dbl=2}, 0, DBL_MAX, FLAGS },
{ "picture_black_ratio_th", "set the picture black ratio threshold", OFFSET(picture_black_ratio_th), AV_OPT_TYPE_DOUBLE, {.dbl=.98}, 0, 1, FLAGS },
{ "pic_th", "set the picture black ratio threshold", OFFSET(picture_black_ratio_th), AV_OPT_TYPE_DOUBLE, {.dbl=.98}, 0, 1, FLAGS },
{ "pixel_black_th", "set the pixel black threshold", OFFSET(pixel_black_th), AV_OPT_TYPE_DOUBLE, {.dbl=.10}, 0, 1, FLAGS },
{ "pix_th", "set the pixel black threshold", OFFSET(pixel_black_th), AV_OPT_TYPE_DOUBLE, {.dbl=.10}, 0, 1, FLAGS },
{ NULL },
}
#define OFFSET(x)
#define FLAGS
NULL
Definition: eval.c:55

Definition at line 53 of file vf_blackdetect.c.

const AVFilterPad blackdetect_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = request_frame,
},
{ NULL }
}
NULL
Definition: eval.c:55
static int request_frame(AVFilterLink *outlink)

Definition at line 187 of file vf_blackdetect.c.

enum AVPixelFormat yuvj_formats[]
static
Initial value:

Definition at line 68 of file vf_blackdetect.c.

Referenced by config_input().