asrc_sine.c File Reference
#include <float.h>
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "audio.h"
#include "avfilter.h"
#include "internal.h"
Include dependency graph for asrc_sine.c:

Go to the source code of this file.

Data Structures

struct  SineContext
 

Macros

#define CONTEXT   SineContext
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define OPT_GENERIC(name, field, def, min, max, descr, type, deffield, ...)
 
#define OPT_INT(name, field, def, min, max, descr, ...)   OPT_GENERIC(name, field, def, min, max, descr, INT, i64, __VA_ARGS__)
 
#define OPT_DBL(name, field, def, min, max, descr, ...)   OPT_GENERIC(name, field, def, min, max, descr, DOUBLE, dbl, __VA_ARGS__)
 
#define OPT_DUR(name, field, def, min, max, descr, ...)   OPT_GENERIC(name, field, def, min, max, descr, DURATION, str, __VA_ARGS__)
 
#define LOG_PERIOD   15
 
#define AMPLITUDE   4095
 
#define AMPLITUDE_SHIFT   3
 

Functions

 AVFILTER_DEFINE_CLASS (sine)
 
static void make_sin_table (int16_t *sin)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static av_cold int query_formats (AVFilterContext *ctx)
 
static av_cold int config_props (AVFilterLink *outlink)
 
static int request_frame (AVFilterLink *outlink)
 

Variables

static const AVOption sine_options []
 
static const AVFilterPad sine_outputs []
 
AVFilter avfilter_asrc_sine
 

Macro Definition Documentation

#define AMPLITUDE   4095

Definition at line 80 of file asrc_sine.c.

Referenced by make_sin_table().

#define AMPLITUDE_SHIFT   3

Definition at line 81 of file asrc_sine.c.

Referenced by make_sin_table().

#define CONTEXT   SineContext

Definition at line 48 of file asrc_sine.c.

Definition at line 49 of file asrc_sine.c.

#define LOG_PERIOD   15

Definition at line 79 of file asrc_sine.c.

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

#define OPT_DBL (   name,
  field,
  def,
  min,
  max,
  descr,
  ... 
)    OPT_GENERIC(name, field, def, min, max, descr, DOUBLE, dbl, __VA_ARGS__)

Definition at line 58 of file asrc_sine.c.

#define OPT_DUR (   name,
  field,
  def,
  min,
  max,
  descr,
  ... 
)    OPT_GENERIC(name, field, def, min, max, descr, DURATION, str, __VA_ARGS__)

Definition at line 61 of file asrc_sine.c.

#define OPT_GENERIC (   name,
  field,
  def,
  min,
  max,
  descr,
  type,
  deffield,
  ... 
)
Value:
{ name, descr, offsetof(CONTEXT, field), AV_OPT_TYPE_ ## type, \
{ .deffield = def }, min, max, FLAGS, __VA_ARGS__ }
const char * name
Definition: avisynth_c.h:675
if max(w)>1 w=0.9 *w/max(w)
#define FLAGS
Definition: asrc_sine.c:49
#define type
#define CONTEXT
Definition: asrc_sine.c:48
float min

Definition at line 51 of file asrc_sine.c.

#define OPT_INT (   name,
  field,
  def,
  min,
  max,
  descr,
  ... 
)    OPT_GENERIC(name, field, def, min, max, descr, INT, i64, __VA_ARGS__)

Definition at line 55 of file asrc_sine.c.

Function Documentation

AVFILTER_DEFINE_CLASS ( sine  )
static av_cold int config_props ( AVFilterLink outlink)
static

Definition at line 163 of file asrc_sine.c.

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 123 of file asrc_sine.c.

static void make_sin_table ( int16_t *  sin)
static

Definition at line 83 of file asrc_sine.c.

Referenced by init().

static av_cold int query_formats ( AVFilterContext ctx)
static

Definition at line 149 of file asrc_sine.c.

static int request_frame ( AVFilterLink outlink)
static

Definition at line 170 of file asrc_sine.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 142 of file asrc_sine.c.

Variable Documentation

AVFilter avfilter_asrc_sine
Initial value:
= {
.name = "sine",
.description = NULL_IF_CONFIG_SMALL("Generate sine wave audio signal."),
.query_formats = query_formats,
.init = init,
.uninit = uninit,
.priv_size = sizeof(SineContext),
.priv_class = &sine_class,
}
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:117
static av_cold int init(AVFilterContext *ctx)
Definition: asrc_sine.c:123
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
NULL
Definition: eval.c:55
static const AVFilterPad sine_outputs[]
Definition: asrc_sine.c:203
static av_cold void uninit(AVFilterContext *ctx)
Definition: asrc_sine.c:142
static av_cold int query_formats(AVFilterContext *ctx)
Definition: asrc_sine.c:149
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 at line 213 of file asrc_sine.c.

const AVOption sine_options[]
static
Initial value:
= {
OPT_DBL("frequency", frequency, 440, 0, DBL_MAX, "set the sine frequency"),
OPT_DBL("f", frequency, 440, 0, DBL_MAX, "set the sine frequency"),
OPT_DBL("beep_factor", beep_factor, 0, 0, DBL_MAX, "set the beep fequency factor"),
OPT_DBL("b", beep_factor, 0, 0, DBL_MAX, "set the beep fequency factor"),
OPT_INT("sample_rate", sample_rate, 44100, 1, INT_MAX, "set the sample rate"),
OPT_INT("r", sample_rate, 44100, 1, INT_MAX, "set the sample rate"),
OPT_DUR("duration", duration, 0, 0, INT64_MAX, "set the audio duration"),
OPT_DUR("d", duration, 0, 0, INT64_MAX, "set the audio duration"),
OPT_INT("samples_per_frame", samples_per_frame, 1024, 0, INT_MAX, "set the number of samples per frame"),
{NULL},
}
#define OPT_INT(name, field, def, min, max, descr,...)
Definition: asrc_sine.c:55
static int64_t duration
Definition: ffplay.c:294
NULL
Definition: eval.c:55
sample_rate
#define OPT_DBL(name, field, def, min, max, descr,...)
Definition: asrc_sine.c:58
#define OPT_DUR(name, field, def, min, max, descr,...)
Definition: asrc_sine.c:61

Definition at line 64 of file asrc_sine.c.

const AVFilterPad sine_outputs[]
static
Initial value:
= {
{
.name = "default",
.request_frame = request_frame,
.config_props = config_props,
},
{ NULL }
}
NULL
Definition: eval.c:55
static int request_frame(AVFilterLink *outlink)
Definition: asrc_sine.c:170
static av_cold int config_props(AVFilterLink *outlink)
Definition: asrc_sine.c:163

Definition at line 203 of file asrc_sine.c.