FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
f_drawgraph.c File Reference
#include "config_components.h"
#include "float.h"
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
#include "libavutil/intreadwrite.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  DrawGraphContext
 

Macros

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

Enumerations

enum  { VAR_MAX, VAR_MIN, VAR_VAL, VAR_VARS_NB }
 

Functions

 AVFILTER_DEFINE_CLASS_EXT (drawgraph, "(a)drawgraph", drawgraph_options)
 
static av_cold int init (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static void clear_image (DrawGraphContext *s, AVFrame *out, AVFilterLink *outlink)
 
static void draw_dot (int fg, int x, int y, AVFrame *out)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
static int request_frame (AVFilterLink *outlink)
 
static int config_output (AVFilterLink *outlink)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption drawgraph_options []
 
static const char *const var_names [] = { "MAX", "MIN", "VAL", NULL }
 
static const AVFilterPad drawgraph_outputs []
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 57 of file f_drawgraph.c.

◆ FLAGS

Definition at line 58 of file f_drawgraph.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
VAR_MAX 
VAR_MIN 
VAR_VAL 
VAR_VARS_NB 

Definition at line 92 of file f_drawgraph.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS_EXT()

AVFILTER_DEFINE_CLASS_EXT ( drawgraph  ,
"(a)drawgraph"  ,
drawgraph_options   
)

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 94 of file f_drawgraph.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 131 of file f_drawgraph.c.

◆ clear_image()

static void clear_image ( DrawGraphContext s,
AVFrame out,
AVFilterLink outlink 
)
static

Definition at line 147 of file f_drawgraph.c.

Referenced by filter_frame().

◆ draw_dot()

static void draw_dot ( int  fg,
int  x,
int  y,
AVFrame out 
)
inlinestatic

Definition at line 157 of file f_drawgraph.c.

Referenced by filter_frame(), and request_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 162 of file f_drawgraph.c.

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 344 of file f_drawgraph.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 426 of file f_drawgraph.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 440 of file f_drawgraph.c.

Variable Documentation

◆ drawgraph_options

const AVOption drawgraph_options[]
static
Initial value:
= {
{ "m1", "set 1st metadata key", OFFSET(key[0]), AV_OPT_TYPE_STRING, {.str=""}, 0, 0, FLAGS },
{ "fg1", "set 1st foreground color expression", OFFSET(fg_str[0]), AV_OPT_TYPE_STRING, {.str="0xffff0000"}, 0, 0, FLAGS },
{ "m2", "set 2nd metadata key", OFFSET(key[1]), AV_OPT_TYPE_STRING, {.str=""}, 0, 0, FLAGS },
{ "fg2", "set 2nd foreground color expression", OFFSET(fg_str[1]), AV_OPT_TYPE_STRING, {.str="0xff00ff00"}, 0, 0, FLAGS },
{ "m3", "set 3rd metadata key", OFFSET(key[2]), AV_OPT_TYPE_STRING, {.str=""}, 0, 0, FLAGS },
{ "fg3", "set 3rd foreground color expression", OFFSET(fg_str[2]), AV_OPT_TYPE_STRING, {.str="0xffff00ff"}, 0, 0, FLAGS },
{ "m4", "set 4th metadata key", OFFSET(key[3]), AV_OPT_TYPE_STRING, {.str=""}, 0, 0, FLAGS },
{ "fg4", "set 4th foreground color expression", OFFSET(fg_str[3]), AV_OPT_TYPE_STRING, {.str="0xffffff00"}, 0, 0, FLAGS },
{ "bg", "set background color", OFFSET(bg), AV_OPT_TYPE_COLOR, {.str="white"}, 0, 0, FLAGS },
{ "min", "set minimal value", OFFSET(min), AV_OPT_TYPE_FLOAT, {.dbl=-1.}, INT_MIN, INT_MAX, FLAGS },
{ "max", "set maximal value", OFFSET(max), AV_OPT_TYPE_FLOAT, {.dbl=1.}, INT_MIN, INT_MAX, FLAGS },
{ "mode", "set graph mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=2}, 0, 2, FLAGS, .unit = "mode" },
{"bar", "draw bars", OFFSET(mode), AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "mode"},
{"dot", "draw dots", OFFSET(mode), AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "mode"},
{"line", "draw lines", OFFSET(mode), AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "mode"},
{ "slide", "set slide mode", OFFSET(slide), AV_OPT_TYPE_INT, {.i64=0}, 0, 4, FLAGS, .unit = "slide" },
{"frame", "draw new frames", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, .unit = "slide"},
{"replace", "replace old columns with new", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "slide"},
{"scroll", "scroll from right to left", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "slide"},
{"rscroll", "scroll from left to right", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, .unit = "slide"},
{"picture", "display graph in single frame", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, FLAGS, .unit = "slide"},
{ "size", "set graph size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="900x256"}, 0, 0, FLAGS },
{ "s", "set graph size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str="900x256"}, 0, 0, FLAGS },
{ "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
{ "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS },
{ NULL }
}

Definition at line 60 of file f_drawgraph.c.

◆ var_names

const char* const var_names[] = { "MAX", "MIN", "VAL", NULL }
static

Definition at line 91 of file f_drawgraph.c.

Referenced by init().

◆ drawgraph_outputs

const AVFilterPad drawgraph_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
.request_frame = request_frame,
},
}

Definition at line 457 of file f_drawgraph.c.

request_frame
static int request_frame(AVFilterLink *outlink)
Definition: f_drawgraph.c:344
AV_OPT_TYPE_VIDEO_RATE
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
Definition: opt.h:248
config_output
static int config_output(AVFilterLink *outlink)
Definition: f_drawgraph.c:426
w
uint8_t w
Definition: llviddspenc.c:38
max
#define max(a, b)
Definition: cuda_runtime.h:33
FLAGS
#define FLAGS
Definition: f_drawgraph.c:58
OFFSET
#define OFFSET(x)
Definition: f_drawgraph.c:57
key
const char * key
Definition: hwcontext_opencl.c:189
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Definition: opt.h:250
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:245
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
min
float min
Definition: vorbis_enc_data.h:429