FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
f_drawgraph.c File Reference
#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

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 }
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 53 of file f_drawgraph.c.

◆ FLAGS

Definition at line 54 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 84 of file f_drawgraph.c.

Function Documentation

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 86 of file f_drawgraph.c.

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 123 of file f_drawgraph.c.

◆ clear_image()

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

Definition at line 139 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 149 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 154 of file f_drawgraph.c.

◆ request_frame()

static int request_frame ( AVFilterLink outlink)
static

Definition at line 320 of file f_drawgraph.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 402 of file f_drawgraph.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 413 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=""}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "fg1", "set 1st foreground color expression", OFFSET(fg_str[0]), AV_OPT_TYPE_STRING, {.str="0xffff0000"}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "m2", "set 2nd metadata key", OFFSET(key[1]), AV_OPT_TYPE_STRING, {.str=""}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "fg2", "set 2nd foreground color expression", OFFSET(fg_str[1]), AV_OPT_TYPE_STRING, {.str="0xff00ff00"}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "m3", "set 3rd metadata key", OFFSET(key[2]), AV_OPT_TYPE_STRING, {.str=""}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "fg3", "set 3rd foreground color expression", OFFSET(fg_str[2]), AV_OPT_TYPE_STRING, {.str="0xffff00ff"}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "m4", "set 4th metadata key", OFFSET(key[3]), AV_OPT_TYPE_STRING, {.str=""}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "fg4", "set 4th foreground color expression", OFFSET(fg_str[3]), AV_OPT_TYPE_STRING, {.str="0xffffff00"}, CHAR_MIN, CHAR_MAX, FLAGS },
{ "bg", "set background color", OFFSET(bg), AV_OPT_TYPE_COLOR, {.str="white"}, CHAR_MIN, CHAR_MAX, 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, "mode" },
{"bar", "draw bars", OFFSET(mode), AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "mode"},
{"dot", "draw dots", OFFSET(mode), AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "mode"},
{"line", "draw lines", OFFSET(mode), AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "mode"},
{ "slide", "set slide mode", OFFSET(slide), AV_OPT_TYPE_INT, {.i64=0}, 0, 4, FLAGS, "slide" },
{"frame", "draw new frames", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, "slide"},
{"replace", "replace old columns with new", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "slide"},
{"scroll", "scroll from right to left", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "slide"},
{"rscroll", "scroll from left to right", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, FLAGS, "slide"},
{"picture", "display graph in single frame", OFFSET(slide), AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, FLAGS, "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 },
{ NULL }
}

Definition at line 56 of file f_drawgraph.c.

◆ var_names

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

Definition at line 83 of file f_drawgraph.c.

Referenced by init().

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:54
OFFSET
#define OFFSET(x)
Definition: f_drawgraph.c:53
key
const char * key
Definition: hwcontext_opencl.c:168
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_COLOR
@ AV_OPT_TYPE_COLOR
Definition: opt.h:238
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:233
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
mode
mode
Definition: ebur128.h:83
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
min
float min
Definition: vorbis_enc_data.h:456