FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
asrc_anoisesrc.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "formats.h"
#include "libavutil/lfg.h"
#include "libavutil/random_seed.h"

Go to the source code of this file.

Data Structures

struct  ANoiseSrcContext
 

Macros

#define OFFSET(x)   offsetof(ANoiseSrcContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Enumerations

enum  NoiseMode {
  NM_WHITE, NM_PINK, NM_BROWN, NM_BLUE,
  NM_VIOLET, NM_VELVET, NM_NB
}
 

Functions

 AVFILTER_DEFINE_CLASS (anoisesrc)
 
static av_cold int query_formats (const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
 
static double white_filter (double white, double *buf)
 
static double pink_filter (double white, double *buf)
 
static double blue_filter (double white, double *buf)
 
static double brown_filter (double white, double *buf)
 
static double violet_filter (double white, double *buf)
 
static double velvet_filter (double white, double *buf)
 
static av_cold int config_props (AVFilterLink *outlink)
 
static int activate (AVFilterContext *ctx)
 

Variables

static const AVOption anoisesrc_options []
 
static const AVFilterPad anoisesrc_outputs []
 
const AVFilter ff_asrc_anoisesrc
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 57 of file asrc_anoisesrc.c.

◆ FLAGS

Definition at line 58 of file asrc_anoisesrc.c.

Enumeration Type Documentation

◆ NoiseMode

enum NoiseMode
Enumerator
NM_WHITE 
NM_PINK 
NM_BROWN 
NM_BLUE 
NM_VIOLET 
NM_VELVET 
NM_NB 

Definition at line 47 of file asrc_anoisesrc.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( anoisesrc  )

◆ query_formats()

static av_cold int query_formats ( const AVFilterContext ctx,
AVFilterFormatsConfig **  cfg_in,
AVFilterFormatsConfig **  cfg_out 
)
static

Definition at line 86 of file asrc_anoisesrc.c.

◆ white_filter()

static double white_filter ( double  white,
double buf 
)
static

Definition at line 108 of file asrc_anoisesrc.c.

Referenced by config_props().

◆ pink_filter()

static double pink_filter ( double  white,
double buf 
)
static

Definition at line 113 of file asrc_anoisesrc.c.

Referenced by config_props().

◆ blue_filter()

static double blue_filter ( double  white,
double buf 
)
static

Definition at line 129 of file asrc_anoisesrc.c.

Referenced by config_props().

◆ brown_filter()

static double brown_filter ( double  white,
double buf 
)
static

Definition at line 145 of file asrc_anoisesrc.c.

Referenced by config_props().

◆ violet_filter()

static double violet_filter ( double  white,
double buf 
)
static

Definition at line 154 of file asrc_anoisesrc.c.

Referenced by config_props().

◆ velvet_filter()

static double velvet_filter ( double  white,
double buf 
)
static

Definition at line 163 of file asrc_anoisesrc.c.

Referenced by config_props().

◆ config_props()

static av_cold int config_props ( AVFilterLink outlink)
static

Definition at line 169 of file asrc_anoisesrc.c.

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 196 of file asrc_anoisesrc.c.

Variable Documentation

◆ anoisesrc_options

const AVOption anoisesrc_options[]
static
Initial value:
= {
{ "sample_rate", "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 15, INT_MAX, FLAGS },
{ "r", "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 48000}, 15, INT_MAX, FLAGS },
{ "amplitude", "set amplitude", OFFSET(amplitude), AV_OPT_TYPE_DOUBLE, {.dbl = 1.}, 0., 1., FLAGS },
{ "a", "set amplitude", OFFSET(amplitude), AV_OPT_TYPE_DOUBLE, {.dbl = 1.}, 0., 1., FLAGS },
{ "duration", "set duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS },
{ "d", "set duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS },
{ "color", "set noise color", OFFSET(color), AV_OPT_TYPE_INT, {.i64 = 0}, 0, NM_NB - 1, FLAGS, .unit = "color" },
{ "colour", "set noise color", OFFSET(color), AV_OPT_TYPE_INT, {.i64 = 0}, 0, NM_NB - 1, FLAGS, .unit = "color" },
{ "c", "set noise color", OFFSET(color), AV_OPT_TYPE_INT, {.i64 = 0}, 0, NM_NB - 1, FLAGS, .unit = "color" },
{ "white", 0, 0, AV_OPT_TYPE_CONST, {.i64 = NM_WHITE}, 0, 0, FLAGS, .unit = "color" },
{ "pink", 0, 0, AV_OPT_TYPE_CONST, {.i64 = NM_PINK}, 0, 0, FLAGS, .unit = "color" },
{ "brown", 0, 0, AV_OPT_TYPE_CONST, {.i64 = NM_BROWN}, 0, 0, FLAGS, .unit = "color" },
{ "blue", 0, 0, AV_OPT_TYPE_CONST, {.i64 = NM_BLUE}, 0, 0, FLAGS, .unit = "color" },
{ "violet", 0, 0, AV_OPT_TYPE_CONST, {.i64 = NM_VIOLET}, 0, 0, FLAGS, .unit = "color" },
{ "velvet", 0, 0, AV_OPT_TYPE_CONST, {.i64 = NM_VELVET}, 0, 0, FLAGS, .unit = "color" },
{ "seed", "set random seed", OFFSET(seed), AV_OPT_TYPE_INT64, {.i64 = -1}, -1, UINT_MAX, FLAGS },
{ "s", "set random seed", OFFSET(seed), AV_OPT_TYPE_INT64, {.i64 = -1}, -1, UINT_MAX, FLAGS },
{ "nb_samples", "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX, FLAGS },
{ "n", "set the number of samples per requested frame", OFFSET(nb_samples), AV_OPT_TYPE_INT, {.i64 = 1024}, 1, INT_MAX, FLAGS },
{ "density", "set density", OFFSET(density), AV_OPT_TYPE_DOUBLE, {.dbl = 0.05}, 0., 1., FLAGS },
{NULL}
}

Definition at line 60 of file asrc_anoisesrc.c.

◆ anoisesrc_outputs

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

Definition at line 234 of file asrc_anoisesrc.c.

◆ ff_asrc_anoisesrc

const AVFilter ff_asrc_anoisesrc
Initial value:
= {
.name = "anoisesrc",
.description = NULL_IF_CONFIG_SMALL("Generate a noise audio signal."),
.priv_size = sizeof(ANoiseSrcContext),
.priv_class = &anoisesrc_class,
}

Definition at line 242 of file asrc_anoisesrc.c.

NM_PINK
@ NM_PINK
Definition: asrc_anoisesrc.c:49
color
Definition: vf_paletteuse.c:513
activate
static int activate(AVFilterContext *ctx)
Definition: asrc_anoisesrc.c:196
AV_OPT_TYPE_DURATION
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
Definition: opt.h:319
anoisesrc_outputs
static const AVFilterPad anoisesrc_outputs[]
Definition: asrc_anoisesrc.c:234
ANoiseSrcContext
Definition: asrc_anoisesrc.c:30
NM_WHITE
@ NM_WHITE
Definition: asrc_anoisesrc.c:48
duration
int64_t duration
Definition: movenc.c:65
AV_OPT_TYPE_DOUBLE
@ AV_OPT_TYPE_DOUBLE
Underlying C type is double.
Definition: opt.h:267
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
query_formats
static av_cold int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: asrc_anoisesrc.c:86
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Underlying C type is int64_t.
Definition: opt.h:263
NM_VIOLET
@ NM_VIOLET
Definition: asrc_anoisesrc.c:52
NM_NB
@ NM_NB
Definition: asrc_anoisesrc.c:54
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
NM_BROWN
@ NM_BROWN
Definition: asrc_anoisesrc.c:50
NULL
#define NULL
Definition: coverity.c:32
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
seed
static unsigned int seed
Definition: videogen.c:78
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
config_props
static av_cold int config_props(AVFilterLink *outlink)
Definition: asrc_anoisesrc.c:169
NM_VELVET
@ NM_VELVET
Definition: asrc_anoisesrc.c:53
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
OFFSET
#define OFFSET(x)
Definition: asrc_anoisesrc.c:57
NM_BLUE
@ NM_BLUE
Definition: asrc_anoisesrc.c:51
FLAGS
#define FLAGS
Definition: asrc_anoisesrc.c:58
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299