FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
avf_showwaves.c File Reference

audio to video multimedia filter More...

#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "audio.h"
#include "video.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  frame_node
 
struct  ShowWavesContext
 

Macros

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

Enumerations

enum  ShowWavesMode {
  MODE_POINT, MODE_LINE, MODE_P2P, MODE_CENTERED_LINE,
  MODE_NB
}
 
enum  ShowWavesScale {
  SCALE_LIN, SCALE_LOG, SCALE_SQRT, SCALE_CBRT,
  SCALE_NB
}
 
enum  ShowWavesDrawMode { DRAW_SCALE, DRAW_FULL, DRAW_NB }
 

Functions

 AVFILTER_DEFINE_CLASS (showwaves)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int get_lin_h (int16_t sample, int height)
 
static int get_lin_h2 (int16_t sample, int height)
 
static int get_log_h (int16_t sample, int height)
 
static int get_log_h2 (int16_t sample, int height)
 
static int get_sqrt_h (int16_t sample, int height)
 
static int get_sqrt_h2 (int16_t sample, int height)
 
static int get_cbrt_h (int16_t sample, int height)
 
static int get_cbrt_h2 (int16_t sample, int height)
 
static void draw_sample_point_rgba_scale (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_point_rgba_full (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_line_rgba_scale (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_line_rgba_full (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_p2p_rgba_scale (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_p2p_rgba_full (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_cline_rgba_scale (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_cline_rgba_full (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_point_gray (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_line_gray (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_p2p_gray (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static void draw_sample_cline_gray (uint8_t *buf, int height, int linesize, int16_t *prev_y, const uint8_t color[4], int h)
 
static int config_output (AVFilterLink *outlink)
 
static int push_frame (AVFilterLink *outlink)
 
static int push_single_pic (AVFilterLink *outlink)
 
static int request_frame (AVFilterLink *outlink)
 
static int alloc_out_frame (ShowWavesContext *showwaves, const int16_t *p, const AVFilterLink *inlink, AVFilterLink *outlink, const AVFrame *in)
 
static av_cold int init (AVFilterContext *ctx)
 

Variables

static const AVOption showwaves_options []
 

Detailed Description

audio to video multimedia filter

Definition in file avf_showwaves.c.

Macro Definition Documentation

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

Definition at line 94 of file avf_showwaves.c.

Referenced by init().

Definition at line 95 of file avf_showwaves.c.

Referenced by init().

Enumeration Type Documentation

Enumerator
MODE_POINT 
MODE_LINE 
MODE_P2P 
MODE_CENTERED_LINE 
MODE_NB 

Definition at line 38 of file avf_showwaves.c.

Enumerator
SCALE_LIN 
SCALE_LOG 
SCALE_SQRT 
SCALE_CBRT 
SCALE_NB 

Definition at line 46 of file avf_showwaves.c.

Enumerator
DRAW_SCALE 
DRAW_FULL 
DRAW_NB 

Definition at line 54 of file avf_showwaves.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( showwaves  )

Referenced by init().

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 123 of file avf_showwaves.c.

Referenced by init().

static int query_formats ( AVFilterContext ctx)
static

Definition at line 145 of file avf_showwaves.c.

Referenced by init().

static int get_lin_h ( int16_t  sample,
int  height 
)
static

Definition at line 176 of file avf_showwaves.c.

Referenced by config_output().

static int get_lin_h2 ( int16_t  sample,
int  height 
)
static

Definition at line 181 of file avf_showwaves.c.

Referenced by config_output().

static int get_log_h ( int16_t  sample,
int  height 
)
static

Definition at line 186 of file avf_showwaves.c.

Referenced by config_output().

static int get_log_h2 ( int16_t  sample,
int  height 
)
static

Definition at line 191 of file avf_showwaves.c.

Referenced by config_output().

static int get_sqrt_h ( int16_t  sample,
int  height 
)
static

Definition at line 196 of file avf_showwaves.c.

Referenced by config_output().

static int get_sqrt_h2 ( int16_t  sample,
int  height 
)
static

Definition at line 201 of file avf_showwaves.c.

Referenced by config_output().

static int get_cbrt_h ( int16_t  sample,
int  height 
)
static

Definition at line 206 of file avf_showwaves.c.

Referenced by config_output().

static int get_cbrt_h2 ( int16_t  sample,
int  height 
)
static

Definition at line 211 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_point_rgba_scale ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 216 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_point_rgba_full ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 228 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_line_rgba_scale ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 240 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_line_rgba_full ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 257 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_p2p_rgba_scale ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 274 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_p2p_rgba_full ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 300 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_cline_rgba_scale ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 326 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_cline_rgba_full ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 340 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_point_gray ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 355 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_line_gray ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 363 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_p2p_gray ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 376 of file avf_showwaves.c.

Referenced by config_output().

static void draw_sample_cline_gray ( uint8_t buf,
int  height,
int  linesize,
int16_t *  prev_y,
const uint8_t  color[4],
int  h 
)
static

Definition at line 395 of file avf_showwaves.c.

Referenced by config_output().

static int config_output ( AVFilterLink outlink)
static

Definition at line 406 of file avf_showwaves.c.

Referenced by init().

static int push_frame ( AVFilterLink outlink)
inlinestatic

Definition at line 542 of file avf_showwaves.c.

Referenced by init(), push_single_pic(), and request_frame().

static int push_single_pic ( AVFilterLink outlink)
static

Definition at line 558 of file avf_showwaves.c.

Referenced by request_frame().

static int request_frame ( AVFilterLink outlink)
static

Definition at line 619 of file avf_showwaves.c.

Referenced by init().

static int alloc_out_frame ( ShowWavesContext showwaves,
const int16_t *  p,
const AVFilterLink inlink,
AVFilterLink outlink,
const AVFrame in 
)
static

Definition at line 636 of file avf_showwaves.c.

Referenced by init().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 657 of file avf_showwaves.c.

Variable Documentation

const AVOption showwaves_options[]
static
Initial value:
= {
{ "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "600x240"}, 0, 0, FLAGS },
{ "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "600x240"}, 0, 0, FLAGS },
{ "mode", "select display mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_POINT}, 0, MODE_NB-1, FLAGS, "mode"},
{ "point", "draw a point for each sample", 0, AV_OPT_TYPE_CONST, {.i64=MODE_POINT}, .flags=FLAGS, .unit="mode"},
{ "line", "draw a line for each sample", 0, AV_OPT_TYPE_CONST, {.i64=MODE_LINE}, .flags=FLAGS, .unit="mode"},
{ "p2p", "draw a line between samples", 0, AV_OPT_TYPE_CONST, {.i64=MODE_P2P}, .flags=FLAGS, .unit="mode"},
{ "cline", "draw a centered line for each sample", 0, AV_OPT_TYPE_CONST, {.i64=MODE_CENTERED_LINE}, .flags=FLAGS, .unit="mode"},
{ "n", "set how many samples to show in the same point", OFFSET(n), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
{ "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },
{ "r", "set video rate", OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, FLAGS },
{ "split_channels", "draw channels separately", OFFSET(split_channels), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS },
{ "colors", "set channels colors", OFFSET(colors), AV_OPT_TYPE_STRING, {.str = "red|green|blue|yellow|orange|lime|pink|magenta|brown" }, 0, 0, FLAGS },
{ "scale", "set amplitude scale", OFFSET(scale), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, SCALE_NB-1, FLAGS, .unit="scale" },
{ "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=SCALE_LIN}, .flags=FLAGS, .unit="scale"},
{ "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=SCALE_LOG}, .flags=FLAGS, .unit="scale"},
{ "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=SCALE_SQRT}, .flags=FLAGS, .unit="scale"},
{ "cbrt", "cubic root", 0, AV_OPT_TYPE_CONST, {.i64=SCALE_CBRT}, .flags=FLAGS, .unit="scale"},
{ "draw", "set draw mode", OFFSET(draw_mode), AV_OPT_TYPE_INT, {.i64 = DRAW_SCALE}, 0, DRAW_NB-1, FLAGS, .unit="draw" },
{ "scale", "scale pixel values for each drawn sample", 0, AV_OPT_TYPE_CONST, {.i64=DRAW_SCALE}, .flags=FLAGS, .unit="draw"},
{ "full", "draw every pixel for sample directly", 0, AV_OPT_TYPE_CONST, {.i64=DRAW_FULL}, .flags=FLAGS, .unit="draw"},
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: avf_showwaves.c:94
uint8_t w
Definition: llviddspenc.c:38
int n
Definition: avisynth_c.h:760
offset must point to AVRational
Definition: opt.h:236
offset must point to two consecutive integers
Definition: opt.h:233
#define FLAGS
Definition: avf_showwaves.c:95
mode
Use these values in ebur128_init (or'ed).
Definition: ebur128.h:83

Definition at line 97 of file avf_showwaves.c.