FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
af_headphone.c File Reference
#include <math.h>
#include "libavutil/avstring.h"
#include "libavutil/channel_layout.h"
#include "libavutil/float_dsp.h"
#include "libavutil/intmath.h"
#include "libavutil/opt.h"
#include "libavcodec/avfft.h"
#include "avfilter.h"
#include "filters.h"
#include "internal.h"
#include "audio.h"

Go to the source code of this file.

Data Structures

struct  HeadphoneContext
 
struct  HeadphoneContext::headphone_inputs
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define TIME_DOMAIN   0
 
#define FREQUENCY_DOMAIN   1
 
#define HRIR_STEREO   0
 
#define HRIR_MULTI   1
 
#define OFFSET(x)   offsetof(HeadphoneContext, x)
 
#define FLAGS   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 

Functions

static int parse_channel_name (HeadphoneContext *s, int x, char **arg, int *rchannel, char *buf)
 
static void parse_map (AVFilterContext *ctx)
 
static int headphone_convolute (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int headphone_fast_convolute (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int check_ir (AVFilterLink *inlink, int input_number)
 
static int headphone_frame (HeadphoneContext *s, AVFrame *in, AVFilterLink *outlink)
 
static int convert_coeffs (AVFilterContext *ctx, AVFilterLink *inlink)
 
static int activate (AVFilterContext *ctx)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static av_cold int init (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 
static av_cold void uninit (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (headphone)
 

Variables

static const AVOption headphone_options []
 
static const AVFilterPad outputs []
 
AVFilter ff_af_headphone
 

Macro Definition Documentation

#define TIME_DOMAIN   0

Definition at line 35 of file af_headphone.c.

Referenced by convert_coeffs(), and headphone_frame().

#define FREQUENCY_DOMAIN   1

Definition at line 36 of file af_headphone.c.

Referenced by convert_coeffs().

#define HRIR_STEREO   0

Definition at line 38 of file af_headphone.c.

Referenced by convert_coeffs().

#define HRIR_MULTI   1

Definition at line 39 of file af_headphone.c.

Referenced by config_output(), parse_map(), and query_formats().

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

Definition at line 827 of file af_headphone.c.

Definition at line 828 of file af_headphone.c.

Function Documentation

static int parse_channel_name ( HeadphoneContext s,
int  x,
char **  arg,
int rchannel,
char *  buf 
)
static

Definition at line 89 of file af_headphone.c.

Referenced by parse_map().

static void parse_map ( AVFilterContext ctx)
static

Definition at line 113 of file af_headphone.c.

Referenced by init().

static int headphone_convolute ( AVFilterContext ctx,
void arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 162 of file af_headphone.c.

Referenced by headphone_frame().

static int headphone_fast_convolute ( AVFilterContext ctx,
void arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 235 of file af_headphone.c.

Referenced by headphone_frame().

static int check_ir ( AVFilterLink inlink,
int  input_number 
)
static

Definition at line 329 of file af_headphone.c.

Referenced by activate().

static int headphone_frame ( HeadphoneContext s,
AVFrame in,
AVFilterLink outlink 
)
static

Definition at line 347 of file af_headphone.c.

Referenced by activate().

static int convert_coeffs ( AVFilterContext ctx,
AVFilterLink inlink 
)
static

Definition at line 382 of file af_headphone.c.

Referenced by activate().

static int activate ( AVFilterContext ctx)
static

Definition at line 602 of file af_headphone.c.

static int query_formats ( AVFilterContext ctx)
static

Definition at line 666 of file af_headphone.c.

static int config_input ( AVFilterLink inlink)
static

Definition at line 719 of file af_headphone.c.

Referenced by init().

static av_cold int init ( AVFilterContext ctx)
static

Definition at line 732 of file af_headphone.c.

static int config_output ( AVFilterLink outlink)
static

Definition at line 777 of file af_headphone.c.

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 797 of file af_headphone.c.

AVFILTER_DEFINE_CLASS ( headphone  )

Variable Documentation

const AVOption headphone_options[]
static
Initial value:
= {
{ "map", "set channels convolution mappings", OFFSET(map), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
{ "gain", "set gain in dB", OFFSET(gain), AV_OPT_TYPE_FLOAT, {.dbl=0}, -20, 40, .flags = FLAGS },
{ "lfe", "set lfe gain in dB", OFFSET(lfe_gain), AV_OPT_TYPE_FLOAT, {.dbl=0}, -20, 40, .flags = FLAGS },
{ "type", "set processing", OFFSET(type), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, .flags = FLAGS, "type" },
{ "time", "time domain", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, .flags = FLAGS, "type" },
{ "freq", "frequency domain", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, .flags = FLAGS, "type" },
{ "size", "set frame size", OFFSET(size), AV_OPT_TYPE_INT, {.i64=1024},1024,96000, .flags = FLAGS },
{ "hrir", "set hrir format", OFFSET(hrir_fmt), AV_OPT_TYPE_INT, {.i64=HRIR_STEREO}, 0, 1, .flags = FLAGS, "hrir" },
{ "stereo", "hrir files have exactly 2 channels", 0, AV_OPT_TYPE_CONST, {.i64=HRIR_STEREO}, 0, 0, .flags = FLAGS, "hrir" },
{ "multich", "single multichannel hrir file", 0, AV_OPT_TYPE_CONST, {.i64=HRIR_MULTI}, 0, 0, .flags = FLAGS, "hrir" },
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: af_headphone.c:827
#define HRIR_MULTI
Definition: af_headphone.c:39
ptrdiff_t size
Definition: opengl_enc.c:101
#define HRIR_STEREO
Definition: af_headphone.c:38
#define FLAGS
Definition: af_headphone.c:828
GLint GLenum type
Definition: opengl_enc.c:105
const VDPAUPixFmtMap * map

Definition at line 830 of file af_headphone.c.

const AVFilterPad outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = config_output,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int config_output(AVFilterLink *outlink)
Definition: af_headphone.c:777

Definition at line 846 of file af_headphone.c.

AVFilter ff_af_headphone
Initial value:
= {
.name = "headphone",
.description = NULL_IF_CONFIG_SMALL("Apply headphone binaural spatialization with HRTFs in additional streams."),
.priv_size = sizeof(HeadphoneContext),
.priv_class = &headphone_class,
.init = init,
}
#define NULL
Definition: coverity.c:32
#define AVFILTER_FLAG_DYNAMIC_INPUTS
The number of the filter inputs is not determined just by AVFilter.inputs.
Definition: avfilter.h:105
static int activate(AVFilterContext *ctx)
Definition: af_headphone.c:602
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:116
static const AVFilterPad outputs[]
Definition: af_headphone.c:846
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_headphone.c:797
static int query_formats(AVFilterContext *ctx)
Definition: af_headphone.c:666
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static av_cold int init(AVFilterContext *ctx)
Definition: af_headphone.c:732
#define flags(name, subs,...)
Definition: cbs_av1.c:596

Definition at line 855 of file af_headphone.c.