FFmpeg
Data Structures | Macros | Functions | Variables
vf_blackframe.c File Reference
#include <stdio.h>
#include <inttypes.h>
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  BlackFrameContext
 

Macros

#define SET_META(key, format, value)
 
#define OFFSET(x)   offsetof(BlackFrameContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

static int query_formats (AVFilterContext *ctx)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
 AVFILTER_DEFINE_CLASS (blackframe)
 

Variables

static const AVOption blackframe_options []
 
static const AVFilterPad avfilter_vf_blackframe_inputs []
 
static const AVFilterPad avfilter_vf_blackframe_outputs []
 
AVFilter ff_vf_blackframe
 

Detailed Description

Search for black frames to detect scene transitions. Ported from MPlayer libmpcodecs/vf_blackframe.c.

Definition in file vf_blackframe.c.

Macro Definition Documentation

◆ SET_META

#define SET_META (   key,
  format,
  value 
)
Value:
snprintf(buf, sizeof(buf), format, value); \
av_dict_set(metadata, key, buf, 0)

Definition at line 63 of file vf_blackframe.c.

◆ OFFSET

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

Definition at line 104 of file vf_blackframe.c.

◆ FLAGS

Definition at line 105 of file vf_blackframe.c.

Function Documentation

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 49 of file vf_blackframe.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 67 of file vf_blackframe.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( blackframe  )

Variable Documentation

◆ blackframe_options

const AVOption blackframe_options[]
static
Initial value:
= {
{ "amount", "percentage of the pixels that have to be below the threshold "
"for the frame to be considered black", OFFSET(bamount), AV_OPT_TYPE_INT, { .i64 = 98 }, 0, 100, FLAGS },
{ "threshold", "threshold below which a pixel value is considered black",
OFFSET(bthresh), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, 255, FLAGS },
{ "thresh", "threshold below which a pixel value is considered black",
OFFSET(bthresh), AV_OPT_TYPE_INT, { .i64 = 32 }, 0, 255, FLAGS },
{ NULL }
}

Definition at line 106 of file vf_blackframe.c.

◆ avfilter_vf_blackframe_inputs

const AVFilterPad avfilter_vf_blackframe_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = filter_frame,
},
{ NULL }
}

Definition at line 118 of file vf_blackframe.c.

◆ avfilter_vf_blackframe_outputs

const AVFilterPad avfilter_vf_blackframe_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}

Definition at line 127 of file vf_blackframe.c.

◆ ff_vf_blackframe

AVFilter ff_vf_blackframe
Initial value:
= {
.name = "blackframe",
.description = NULL_IF_CONFIG_SMALL("Detect frames that are (almost) black."),
.priv_size = sizeof(BlackFrameContext),
.priv_class = &blackframe_class,
}

Definition at line 135 of file vf_blackframe.c.

avfilter_vf_blackframe_outputs
static const AVFilterPad avfilter_vf_blackframe_outputs[]
Definition: vf_blackframe.c:127
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Definition: vf_blackframe.c:67
buf
void * buf
Definition: avisynth_c.h:766
format
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
key
const char * key
Definition: hwcontext_opencl.c:168
NULL
#define NULL
Definition: coverity.c:32
inputs
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: filter_design.txt:243
avfilter_vf_blackframe_inputs
static const AVFilterPad avfilter_vf_blackframe_inputs[]
Definition: vf_blackframe.c:118
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
FLAGS
#define FLAGS
Definition: vf_blackframe.c:105
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
OFFSET
#define OFFSET(x)
Definition: vf_blackframe.c:104
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_blackframe.c:49
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
BlackFrameContext
Definition: vf_blackframe.c:40
snprintf
#define snprintf
Definition: snprintf.h:34