FFmpeg
Data Structures | Macros | Functions | Variables
af_adelay.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
#include "libavutil/opt.h"
#include "libavutil/samplefmt.h"
#include "avfilter.h"
#include "audio.h"
#include "filters.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  ChanDelay
 
struct  AudioDelayContext
 

Macros

#define OFFSET(x)   offsetof(AudioDelayContext, x)
 
#define A   AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
 
#define DELAY(name, type, fill)
 

Functions

 AVFILTER_DEFINE_CLASS (adelay)
 
static int query_formats (AVFilterContext *ctx)
 
static int config_input (AVFilterLink *inlink)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *frame)
 
static int activate (AVFilterContext *ctx)
 
static av_cold void uninit (AVFilterContext *ctx)
 

Variables

static const AVOption adelay_options []
 
static const AVFilterPad adelay_inputs []
 
static const AVFilterPad adelay_outputs []
 
AVFilter ff_af_adelay
 

Macro Definition Documentation

◆ OFFSET

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

Definition at line 52 of file af_adelay.c.

◆ A

Definition at line 53 of file af_adelay.c.

◆ DELAY

#define DELAY (   name,
  type,
  fill 
)
Value:
static void delay_channel_## name ##p(ChanDelay *d, int nb_samples, \
const uint8_t *ssrc, uint8_t *ddst) \
{ \
const type *src = (type *)ssrc; \
type *dst = (type *)ddst; \
type *samples = (type *)d->samples; \
\
while (nb_samples) { \
if (d->delay_index < d->delay) { \
const int len = FFMIN(nb_samples, d->delay - d->delay_index); \
\
memcpy(&samples[d->delay_index], src, len * sizeof(type)); \
memset(dst, fill, len * sizeof(type)); \
d->delay_index += len; \
src += len; \
dst += len; \
nb_samples -= len; \
} else { \
*dst = samples[d->index]; \
samples[d->index] = *src; \
nb_samples--; \
d->index++; \
src++, dst++; \
d->index = d->index >= d->delay ? 0 : d->index; \
} \
} \
}

Definition at line 93 of file af_adelay.c.

Function Documentation

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( adelay  )

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 62 of file af_adelay.c.

◆ config_input()

static int config_input ( AVFilterLink inlink)
static

Definition at line 128 of file af_adelay.c.

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame frame 
)
static

Definition at line 205 of file af_adelay.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 239 of file af_adelay.c.

◆ uninit()

static av_cold void uninit ( AVFilterContext ctx)
static

Definition at line 310 of file af_adelay.c.

Variable Documentation

◆ adelay_options

const AVOption adelay_options[]
static
Initial value:
= {
{ "delays", "set list of delays for each channel", OFFSET(delays), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, A },
{ NULL }
}

Definition at line 55 of file af_adelay.c.

◆ adelay_inputs

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

Definition at line 321 of file af_adelay.c.

◆ adelay_outputs

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

Definition at line 330 of file af_adelay.c.

◆ ff_af_adelay

AVFilter ff_af_adelay
Initial value:
= {
.name = "adelay",
.description = NULL_IF_CONFIG_SMALL("Delay one or more audio channels."),
.query_formats = query_formats,
.priv_size = sizeof(AudioDelayContext),
.priv_class = &adelay_class,
}

Definition at line 338 of file af_adelay.c.

name
const char * name
Definition: avisynth_c.h:867
ChanDelay
Definition: af_adelay.c:30
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_adelay.c:62
OFFSET
#define OFFSET(x)
Definition: af_adelay.c:52
AudioDelayContext
Definition: af_adelay.c:37
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
src
#define src
Definition: vp8dsp.c:254
activate
static int activate(AVFilterContext *ctx)
Definition: af_adelay.c:239
config_input
static int config_input(AVFilterLink *inlink)
Definition: af_adelay.c:128
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
adelay_outputs
static const AVFilterPad adelay_outputs[]
Definition: af_adelay.c:330
A
#define A
Definition: af_adelay.c:53
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
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:188
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
uint8_t
uint8_t
Definition: audio_convert.c:194
len
int len
Definition: vorbis_enc_data.h:452
adelay_inputs
static const AVFilterPad adelay_inputs[]
Definition: af_adelay.c:321
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_adelay.c:310
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:133
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227