Go to the documentation of this file.
76 static double val(
void *priv,
double ch)
85 #define OFFSET(x) offsetof(EvalContext, x)
86 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
90 {
"nb_samples",
"set the number of samples per requested frame",
OFFSET(nb_samples),
AV_OPT_TYPE_INT, {.i64 = 1024}, 0, INT_MAX,
FLAGS },
91 {
"n",
"set the number of samples per requested frame",
OFFSET(nb_samples),
AV_OPT_TYPE_INT, {.i64 = 1024}, 0, INT_MAX,
FLAGS },
104 int expected_nb_channels)
108 char *expr, *last_expr =
NULL, *buf;
109 double (*
const *
func1)(
void *, double) =
NULL;
121 if (!strcmp(
ctx->filter->name,
"aeval")) {
126 #define ADD_EXPRESSION(expr_) do { \
127 ret = av_dynarray_add_nofree(&eval->expr, \
128 &eval->nb_channels, NULL); \
131 eval->expr[eval->nb_channels-1] = NULL; \
132 ret = av_expr_parse(&eval->expr[eval->nb_channels - 1], expr_, \
133 var_names, func1_names, func1, \
134 NULL, NULL, 0, ctx); \
148 while (expr =
av_strtok(buf,
"|", &buf)) {
157 if (expected_nb_channels > 0 && eval->
nb_channels != expected_nb_channels) {
159 "Mismatch between the specified number of channel expressions '%d' "
160 "and the number of expected output channels '%d' for the specified channel layout\n",
177 if (!strcmp(eval->
chlayout_str,
"same") && !strcmp(
ctx->filter->name,
"aeval")) {
237 "sample_rate:%d chlayout:%s duration:%"PRId64
"\n",
293 for (
i = 0;
i < nb_samples;
i++, eval->
n++) {
303 samplesref->
pts = eval->
pts;
305 eval->
pts += nb_samples;
310 #if CONFIG_AEVALSRC_FILTER
329 .priv_class = &aevalsrc_class,
334 #define OFFSET(x) offsetof(EvalContext, x)
335 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
429 for (
i = 0;
i < nb_samples;
i++, eval->
n++) {
436 for (j = 0; j < outlink->
channels; j++) {
438 *((
double *)
out->extended_data[j] +
i) =
447 #if CONFIG_AEVAL_FILTER
467 .description =
NULL_IF_CONFIG_SMALL(
"Filter audio signal according to a specified expression."),
474 .priv_class = &aeval_class,
int64_t out_channel_layout
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
A list of supported channel layouts.
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.
static enum AVSampleFormat sample_fmts[]
enum MovChannelLayoutTag * layouts
#define AVERROR_EOF
End of file.
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.
static av_cold int init(AVFilterContext *ctx)
static int aeval_query_formats(AVFilterContext *ctx)
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout)
Return a description of a channel layout.
This structure describes decoded (raw) audio or video data.
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
#define ADD_EXPRESSION(expr_)
#define FILTER_QUERY_FUNC(func)
static const char *const aeval_func1_names[]
#define AV_LOG_VERBOSE
Detailed information.
const char * name
Filter name.
static int config_props(AVFilterLink *outlink)
A link between two filters.
int channels
Number of channels.
static av_cold void uninit(AVFilterContext *ctx)
void * priv
private data for use by the filter
int same_chlayout
set output as input channel layout
static double val(void *priv, double ch)
static const char *const func1_names[]
void av_expr_free(AVExpr *e)
Free a parsed expression previously created with av_expr_parse().
A filter pad used for either input or output.
double var_values[VAR_VARS_NB]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
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().
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
Evaluate a previously parsed expression.
#define FILTER_INPUTS(array)
#define av_realloc_f(p, o, n)
static const AVOption aevalsrc_options[]
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.
static int aeval_config_output(AVFilterLink *outlink)
Rational number (pair of numerator and denominator).
const AVFilter ff_af_aeval
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
int nb_in_channels
number of input channels
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
static const AVOption aeval_options[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int sample_rate
Sample rate of the audio data.
int nb_channels
number of output channels
AVFilterContext * src
source filter
static double(*const aeval_func1[])(void *, double)
AVFilterFormatsConfig incfg
Lists of supported formats / etc.
#define AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC
Some filters support a generic "enable" expression option that can be used to enable or disable a fil...
int sample_rate
samples per second
int nb_samples
number of audio samples (per channel) described by this frame
static double(*const func1[])(void *, double)
#define i(width, name, range_min, range_max)
#define AV_TIME_BASE
Internal time base represented as integer.
uint8_t ** extended_data
pointers to the data planes/channels.
AVSampleFormat
Audio sample formats.
const char * name
Pad name.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
AVFILTER_DEFINE_CLASS(aevalsrc)
static const char *const var_names[]
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
@ AV_SAMPLE_FMT_DBLP
double, planar
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
static int activate(AVFilterContext *ctx)
char * av_strdup(const char *s)
Duplicate a string.
static int parse_channel_expressions(AVFilterContext *ctx, int expected_nb_channels)
int64_t av_get_default_channel_layout(int nb_channels)
Return default channel layout for a given number of channels.
#define FILTER_OUTPUTS(array)
static int query_formats(AVFilterContext *ctx)
the definition of that something depends on the semantic of the filter The callback must examine the status of the filter s links and proceed accordingly The status of output links is stored in the status_in and status_out fields and tested by the ff_outlink_frame_wanted() function. If this function returns true
const AVFilter ff_asrc_aevalsrc
int nb_samples
number of samples per requested frame