FFmpeg
Data Structures | Macros | Functions | Variables
asrc_afirsrc.c File Reference
#include "libavutil/channel_layout.h"
#include "libavutil/eval.h"
#include "libavutil/opt.h"
#include "libavutil/tx.h"
#include "audio.h"
#include "avfilter.h"
#include "filters.h"
#include "internal.h"
#include "window_func.h"

Go to the source code of this file.

Data Structures

struct  AudioFIRSourceContext
 

Macros

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

Functions

 AVFILTER_DEFINE_CLASS (afirsrc)
 
static av_cold int init (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 
static av_cold int query_formats (AVFilterContext *ctx)
 
static int parse_string (char *str, float **items, int *nb_items, int *items_size)
 
static void lininterp (AVComplexFloat *complexf, const float *freq, const float *magnitude, const float *phase, int m, int minterp)
 
static av_cold int config_output (AVFilterLink *outlink)
 
static int activate (AVFilterContext *ctx)
 

Variables

static const AVOption afirsrc_options []
 
static const AVFilterPad afirsrc_outputs []
 
const AVFilter ff_asrc_afirsrc
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 61 of file asrc_afirsrc.c.

◆ FLAGS

Definition at line 62 of file asrc_afirsrc.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( afirsrc  )

◆ init()

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 84 of file asrc_afirsrc.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 96 of file asrc_afirsrc.c.

◆ query_formats()

static av_cold int query_formats ( AVFilterContext ctx)
static

Definition at line 109 of file asrc_afirsrc.c.

◆ parse_string()

static int parse_string ( char *  str,
float **  items,
int nb_items,
int items_size 
)
static

Definition at line 129 of file asrc_afirsrc.c.

Referenced by config_output().

◆ lininterp()

static void lininterp ( AVComplexFloat complexf,
const float *  freq,
const float *  magnitude,
const float *  phase,
int  m,
int  minterp 
)
static

Definition at line 156 of file asrc_afirsrc.c.

Referenced by config_output().

◆ config_output()

static av_cold int config_output ( AVFilterLink outlink)
static

Definition at line 178 of file asrc_afirsrc.c.

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 257 of file asrc_afirsrc.c.

Variable Documentation

◆ afirsrc_options

const AVOption afirsrc_options[]
static
Initial value:
= {
{ "taps", "set number of taps", OFFSET(nb_taps), AV_OPT_TYPE_INT, {.i64=1025}, 9, UINT16_MAX, FLAGS },
{ "t", "set number of taps", OFFSET(nb_taps), AV_OPT_TYPE_INT, {.i64=1025}, 9, UINT16_MAX, FLAGS },
{ "frequency", "set frequency points", OFFSET(freq_points_str), AV_OPT_TYPE_STRING, {.str="0 1"}, 0, 0, FLAGS },
{ "f", "set frequency points", OFFSET(freq_points_str), AV_OPT_TYPE_STRING, {.str="0 1"}, 0, 0, FLAGS },
{ "magnitude", "set magnitude values", OFFSET(magnitude_str), AV_OPT_TYPE_STRING, {.str="1 1"}, 0, 0, FLAGS },
{ "m", "set magnitude values", OFFSET(magnitude_str), AV_OPT_TYPE_STRING, {.str="1 1"}, 0, 0, FLAGS },
{ "phase", "set phase values", OFFSET(phase_str), AV_OPT_TYPE_STRING, {.str="0 0"}, 0, 0, FLAGS },
{ "p", "set phase values", OFFSET(phase_str), AV_OPT_TYPE_STRING, {.str="0 0"}, 0, 0, FLAGS },
{ "sample_rate", "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64=44100}, 1, INT_MAX, FLAGS },
{ "r", "set sample rate", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64=44100}, 1, INT_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 },
WIN_FUNC_OPTION("win_func", OFFSET(win_func), FLAGS, WFUNC_BLACKMAN),
{NULL}
}

Definition at line 64 of file asrc_afirsrc.c.

◆ afirsrc_outputs

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

Definition at line 283 of file asrc_afirsrc.c.

◆ ff_asrc_afirsrc

const AVFilter ff_asrc_afirsrc
Initial value:
= {
.name = "afirsrc",
.description = NULL_IF_CONFIG_SMALL("Generate a FIR coefficients audio stream."),
.init = init,
.uninit = uninit,
.activate = activate,
.priv_size = sizeof(AudioFIRSourceContext),
.priv_class = &afirsrc_class,
}

Definition at line 291 of file asrc_afirsrc.c.

AudioFIRSourceContext
Definition: asrc_afirsrc.c:31
activate
static int activate(AVFilterContext *ctx)
Definition: asrc_afirsrc.c:257
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:168
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: asrc_afirsrc.c:96
WIN_FUNC_OPTION
#define WIN_FUNC_OPTION(win_func_opt_name, win_func_offset, flag, default_window_func)
Definition: window_func.h:36
sample_rate
sample_rate
Definition: ffmpeg_filter.c:156
WFUNC_BLACKMAN
@ WFUNC_BLACKMAN
Definition: af_firequalizer.c:37
OFFSET
#define OFFSET(x)
Definition: asrc_afirsrc.c:61
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
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
NULL
#define NULL
Definition: coverity.c:32
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:117
query_formats
static av_cold int query_formats(AVFilterContext *ctx)
Definition: asrc_afirsrc.c:109
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
FLAGS
#define FLAGS
Definition: asrc_afirsrc.c:62
init
static av_cold int init(AVFilterContext *ctx)
Definition: asrc_afirsrc.c:84
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:228
afirsrc_outputs
static const AVFilterPad afirsrc_outputs[]
Definition: asrc_afirsrc.c:283
config_output
static av_cold int config_output(AVFilterLink *outlink)
Definition: asrc_afirsrc.c:178