Libav
Data Structures | Macros | Enumerations | Functions | Variables
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"

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

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)

Variables

static const AVOption options []
static const AVClass drawbox_class
static const AVFilterPad avfilter_vf_drawbox_inputs []
static const AVFilterPad avfilter_vf_drawbox_outputs []
AVFilter ff_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

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

Definition at line 123 of file vf_drawbox.c.

#define FLAGS   AV_OPT_FLAG_VIDEO_PARAM

Definition at line 124 of file vf_drawbox.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
Y 
U 
V 
A 

Definition at line 37 of file vf_drawbox.c.

Function Documentation

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 47 of file vf_drawbox.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 63 of file vf_drawbox.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 77 of file vf_drawbox.c.

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 95 of file vf_drawbox.c.

Variable Documentation

const AVOption 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_opt), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "height", "Height of the box", OFFSET(h_opt), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FLAGS },
{ "color", "Color of the box", OFFSET(color_str), AV_OPT_TYPE_STRING, { .str = "black" }, .flags = FLAGS },
{ NULL },
}

Definition at line 125 of file vf_drawbox.c.

const AVClass drawbox_class
static
Initial value:
{
.class_name = "drawbox",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 134 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 }
}

Definition at line 141 of file vf_drawbox.c.

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

Definition at line 153 of file vf_drawbox.c.

AVFilter ff_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,
}

Definition at line 161 of file vf_drawbox.c.