48 #define OFFSET(x) offsetof(AudioDelayContext, x)
49 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
89 #define DELAY(name, type, fill) \
90 static void delay_channel_## name ##p(ChanDelay *d, int nb_samples, \
91 const uint8_t *ssrc, uint8_t *ddst) \
93 const type *src = (type *)ssrc; \
94 type *dst = (type *)ddst; \
95 type *samples = (type *)d->samples; \
97 while (nb_samples) { \
98 if (d->delay_index < d->delay) { \
99 const int len = FFMIN(nb_samples, d->delay - d->delay_index); \
101 memcpy(&samples[d->delay_index], src, len * sizeof(type)); \
102 memset(dst, fill, len * sizeof(type)); \
103 d->delay_index += len; \
108 *dst = samples[d->index]; \
109 samples[d->index] = *src; \
113 d->index = d->index >= d->delay ? 0 : d->index; \
119 DELAY(s16, int16_t, 0)
122 DELAY(dbl,
double, 0)
128 char *p, *
arg, *saveptr =
NULL;
142 if (!(arg =
av_strtok(p,
"|", &saveptr)))
146 sscanf(arg,
"%f", &delay);
148 d->
delay = delay * inlink->sample_rate / 1000.0;
173 switch (inlink->format) {
282 .priv_class = &adelay_class,
This structure describes decoded (raw) audio or video data.
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Main libavfilter public API header.
static enum AVSampleFormat formats[]
int is_disabled
the enabled state from the last expression evaluation
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
void(* delay_channel)(ChanDelay *d, int nb_samples, const uint8_t *src, uint8_t *dst)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define AVERROR_EOF
End of file.
static const AVOption adelay_options[]
A filter pad used for either input or output.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
static av_cold void uninit(AVFilterContext *ctx)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt)
Fill an audio buffer with silence.
int sample_rate
samples per second
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
AVFILTER_DEFINE_CLASS(adelay)
static int query_formats(AVFilterContext *ctx)
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
AVFilterContext * src
source filter
static const AVFilterPad outputs[]
A list of supported channel layouts.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
static const AVFilterPad inputs[]
AVSampleFormat
Audio sample formats.
Describe the class of an AVClass context structure.
rational number numerator/denominator
const char * name
Filter name.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
void * av_calloc(size_t nmemb, size_t size)
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok()...
int channels
Number of channels.
static const AVFilterPad adelay_inputs[]
static int config_input(AVFilterLink *inlink)
AVFilterContext * dst
dest filter
static const AVFilterPad adelay_outputs[]
static enum AVSampleFormat sample_fmts[]
static int request_frame(AVFilterLink *outlink)
#define DELAY(name, type, fill)
#define av_malloc_array(a, b)
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
uint8_t ** extended_data
pointers to the data planes/channels.
int nb_samples
number of audio samples (per channel) described by this frame
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_NOPTS_VALUE
Undefined timestamp value.