Go to the documentation of this file.
42 #define OFFSET(x) offsetof(CompensationDelayContext, x)
43 #define A (AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM)
58 #define COMP_DELAY_MAX_DISTANCE (100.0 * 100.0 + 100.0 * 1.0 + 1.0)
60 #define COMP_DELAY_SOUND_SPEED_KM_H(temp) 1.85325 * (643.95 * sqrt(((temp + 273.15) / 273.15)))
61 #define COMP_DELAY_SOUND_SPEED_CM_S(temp) (COMP_DELAY_SOUND_SPEED_KM_H(temp) * (1000.0 * 100.0) / (60.0 * 60.0) )
62 #define COMP_DELAY_SOUND_FRONT_DELAY(temp) (1.0 / COMP_DELAY_SOUND_SPEED_CM_S(temp))
64 #define COMP_DELAY_MAX_DELAY (COMP_DELAY_MAX_DISTANCE * COMP_DELAY_SOUND_FRONT_DELAY(50))
70 unsigned min_size, new_size = 1;
72 s->delay = (
s->distance_m * 100. +
s->distance_cm * 1. +
s->distance_mm * .1) *
76 while (new_size < min_size)
79 s->buf_size = new_size;
92 const unsigned b_mask =
s->buf_size - 1;
93 const unsigned buf_size =
s->buf_size;
94 const unsigned delay =
s->delay;
95 const double dry =
s->dry;
96 const double wet =
s->wet;
97 unsigned r_ptr, w_ptr = 0;
108 for (ch = 0; ch <
inlink->ch_layout.nb_channels; ch++) {
110 double *dst = (
double *)
out->extended_data[ch];
111 double *
buffer = (
double *)
s->delay_frame->extended_data[ch];
114 r_ptr = (w_ptr + buf_size - delay) & b_mask;
121 w_ptr = (w_ptr + 1) & b_mask;
122 r_ptr = (r_ptr + 1) & b_mask;
127 if (
ctx->is_disabled) {
137 char *res,
int res_len,
int flags)
147 s->delay = (
s->distance_m * 100. +
s->distance_cm * 1. +
s->distance_mm * .1) *
170 .
name =
"compensationdelay",
173 .priv_class = &compensationdelay_class,
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
static int config_input(AVFilterLink *inlink)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
const AVFilter ff_af_compensationdelay
#define FILTER_SINGLE_SAMPLEFMT(sample_fmt_)
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
This structure describes decoded (raw) audio or video data.
static const AVFilterPad compensationdelay_inputs[]
static const AVOption compensationdelay_options[]
const char * name
Filter name.
A link between two filters.
#define COMP_DELAY_MAX_DELAY
AVFILTER_DEFINE_CLASS(compensationdelay)
A filter pad used for either input or output.
#define FILTER_INPUTS(array)
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Describe the class of an AVClass context structure.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
int sample_rate
samples per second
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t ** extended_data
pointers to the data planes/channels.
#define COMP_DELAY_SOUND_FRONT_DELAY(temp)
const char * name
Pad name.
static av_cold void uninit(AVFilterContext *ctx)
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
@ AV_SAMPLE_FMT_DBLP
double, planar
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
#define FILTER_OUTPUTS(array)
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
#define flags(name, subs,...)