vf_drawbox.c File Reference

Box drawing filter. More...

#include "libavutil/colorspace.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
Include dependency graph for vf_drawbox.c:

Go to the source code of this file.

Data Structures

struct  DrawBoxContext
 

Macros

#define OFFSET(x)   offsetof(DrawBoxContext, x)
 
#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  { Y, U, V, A }
 

Functions

static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
 AVFILTER_DEFINE_CLASS (drawbox)
 

Variables

static const AVOption drawbox_options []
 
static const AVFilterPad avfilter_vf_drawbox_inputs []
 
static const AVFilterPad avfilter_vf_drawbox_outputs []
 
AVFilter avfilter_vf_drawbox
 

Detailed Description

Box drawing filter.

Also a nice template for a filter that needs to write in the input frame.

Definition in file vf_drawbox.c.

Macro Definition Documentation

Definition at line 136 of file vf_drawbox.c.

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

Definition at line 135 of file vf_drawbox.c.

Enumeration Type Documentation

anonymous enum
Enumerator

Definition at line 37 of file vf_drawbox.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( drawbox  )
static int config_input ( AVFilterLink inlink)
static

Definition at line 82 of file vf_drawbox.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 100 of file vf_drawbox.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 48 of file vf_drawbox.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 68 of file vf_drawbox.c.

Variable Documentation

AVFilter avfilter_vf_drawbox
Initial value:
= {
.name = "drawbox",
.description = NULL_IF_CONFIG_SMALL("Draw a colored box on the input video."),
.priv_size = sizeof(DrawBoxContext),
.priv_class = &drawbox_class,
.init = init,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static int query_formats(AVFilterContext *ctx)
Definition: vf_drawbox.c:68
static const AVFilterPad avfilter_vf_drawbox_outputs[]
Definition: vf_drawbox.c:166
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const AVFilterPad avfilter_vf_drawbox_inputs[]
Definition: vf_drawbox.c:154
static av_cold int init(AVFilterContext *ctx)
Definition: vf_drawbox.c:48
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 174 of file vf_drawbox.c.

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

Definition at line 154 of file vf_drawbox.c.

const AVFilterPad avfilter_vf_drawbox_outputs[]
static
Initial value:
= {
{
.name = "default",
},
{ NULL }
}
NULL
Definition: eval.c:55

Definition at line 166 of file vf_drawbox.c.

const AVOption drawbox_options[]
static
Initial value:
= {
{ "x", "Horizontal position of the left box edge", OFFSET(x), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS },
{ "y", "Vertical position of the top box edge", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FLAGS },
{ "width", "Width of the box", OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "w", "Width of the box", OFFSET(w), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "height", "Height of the box", OFFSET(h), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "h", "Height of the box", OFFSET(h), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "color", "Color of the box", OFFSET(color_str), AV_OPT_TYPE_STRING, { .str = "black" }, CHAR_MIN, CHAR_MAX, .flags = FLAGS },
{ "c", "Color of the box", OFFSET(color_str), AV_OPT_TYPE_STRING, { .str = "black" }, CHAR_MIN, CHAR_MAX, .flags = FLAGS },
{ "thickness", "set the box maximum thickness", OFFSET(thickness), AV_OPT_TYPE_INT, {.i64=4}, 0, INT_MAX, FLAGS },
{ "t", "set the box maximum thickness", OFFSET(thickness), AV_OPT_TYPE_INT, {.i64=4}, 0, INT_MAX, FLAGS },
{ NULL },
}
output residual component w
#define OFFSET(x)
Definition: vf_drawbox.c:135
#define FLAGS
Definition: vf_drawbox.c:136
Discrete Time axis x
NULL
Definition: eval.c:55
function y
Definition: D.m:1

Definition at line 138 of file vf_drawbox.c.