FFmpeg
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  { Y, U, V, A }
 

Functions

 AVFILTER_DEFINE_CLASS (drawbox)
 
static av_cold int init (AVFilterContext *ctx, const char *args)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFilterBufferRef *frame)
 

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

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

Definition at line 48 of file vf_drawbox.c.

Definition at line 49 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

AVFILTER_DEFINE_CLASS ( drawbox  )
static av_cold int init ( AVFilterContext ctx,
const char *  args 
)
static

Definition at line 67 of file vf_drawbox.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 95 of file vf_drawbox.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 101 of file vf_drawbox.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 115 of file vf_drawbox.c.

static int filter_frame ( AVFilterLink inlink,
AVFilterBufferRef frame 
)
static

Definition at line 133 of file vf_drawbox.c.

Variable Documentation

const AVOption drawbox_options[]
static
Initial value:
= {
{ "x", "set the box top-left corner x position", OFFSET(x), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX, FLAGS },
{ "y", "set the box top-left corner y position", OFFSET(y), AV_OPT_TYPE_INT, {.i64=0}, INT_MIN, INT_MAX, FLAGS },
{ "width", "set the box width", OFFSET(w), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
{ "w", "set the box width", OFFSET(w), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
{ "height", "set the box height", OFFSET(h), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
{ "h", "set the box height", OFFSET(h), AV_OPT_TYPE_INT, {.i64=0}, 0, INT_MAX, FLAGS },
{ "color", "set the box edge color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "c", "set the box edge color", OFFSET(color_str), AV_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX, 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},
}

Definition at line 51 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,
.min_perms = AV_PERM_WRITE | AV_PERM_READ,
},
{ NULL }
}

Definition at line 168 of file vf_drawbox.c.

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

Definition at line 180 of file vf_drawbox.c.

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),
.init = init,
.priv_class = &drawbox_class,
}

Definition at line 188 of file vf_drawbox.c.