51 #define OFFSET(x) offsetof(AudioDelayContext, x)
52 #define A AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
92 #define DELAY(name, type, fill) \
93 static void delay_channel_## name ##p(ChanDelay *d, int nb_samples, \
94 const uint8_t *ssrc, uint8_t *ddst) \
96 const type *src = (type *)ssrc; \
97 type *dst = (type *)ddst; \
98 type *samples = (type *)d->samples; \
100 while (nb_samples) { \
101 if (d->delay_index < d->delay) { \
102 const int len = FFMIN(nb_samples, d->delay - d->delay_index); \
104 memcpy(&samples[d->delay_index], src, len * sizeof(type)); \
105 memset(dst, fill, len * sizeof(type)); \
106 d->delay_index += len; \
111 *dst = samples[d->index]; \
112 samples[d->index] = *src; \
116 d->index = d->index >= d->delay ? 0 : d->index; \
122 DELAY(s16, int16_t, 0)
125 DELAY(dbl,
double, 0)
131 char *p, *
arg, *saveptr =
NULL;
147 if (!(arg =
av_strtok(p,
"|", &saveptr)))
152 ret = sscanf(arg,
"%d%c", &d->
delay, &type);
153 if (ret != 2 || type !=
'S') {
154 sscanf(arg,
"%f", &delay);
155 d->
delay = delay * inlink->sample_rate / 1000.0;
192 switch (inlink->format) {
341 .priv_class = &adelay_class,
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
This structure describes decoded (raw) audio or video data.
static int activate(AVFilterContext *ctx)
static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
Main libavfilter public API header.
#define FFERROR_NOT_READY
Filters implementation helper functions.
int is_disabled
the enabled state from the last expression evaluation
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
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.
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
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.
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
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)
#define FF_FILTER_FORWARD_WANTED(outlink, inlink)
Forward the frame_wanted_out flag from an output link to an input link.
static int query_formats(AVFilterContext *ctx)
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static const AVFilterPad inputs[]
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...
AVSampleFormat
Audio sample formats.
Describe the class of an AVClass context structure.
Rational number (pair of numerator and 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
#define flags(name, subs,...)
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[]
#define DELAY(name, type, fill)
#define av_malloc_array(a, b)
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.