Go to the documentation of this file.
40 #define MAX_CHANNELS 64
68 int len, channel_id = 0;
72 if (sscanf(*
arg,
"%7[A-Z]%n", buf, &
len)) {
77 *rchannel = channel_id;
83 if (sscanf(*
arg,
"c%d%n", &channel_id, &
len) &&
85 *rchannel = channel_id;
97 int out_ch_id, in_ch_id,
len, named,
ret, sign = 1;
98 int nb_in_channels[2] = { 0, 0 };
104 "pan filter needs a channel layout and a set "
105 "of channel definitions as parameter\n");
123 "af_pan supports a maximum of %d channels. "
124 "Feel free to ask for a higher limit.\n",
MAX_CHANNELS);
135 "Expected out channel name, got \"%.8s\"\n",
arg);
142 "Channel \"%.8s\" does not exist in the chosen layout\n", arg0);
149 "Invalid out channel name \"%.8s\"\n", arg0);
153 if (used_out_ch[out_ch_id]) {
155 "Can not reference out channel %d twice\n", out_ch_id);
159 used_out_ch[out_ch_id] = 1;
163 }
else if (*
arg ==
'<') {
168 "Syntax error after channel name in \"%.8s\"\n", arg0);
176 if (sscanf(
arg,
"%lf%n *%n", &gain, &
len, &
len))
180 "Expected in channel name, got \"%.8s\"\n",
arg);
184 nb_in_channels[named]++;
185 if (nb_in_channels[!named]) {
187 "Can not mix named and numbered channels\n");
191 if (used_in_ch[in_ch_id]) {
193 "Can not reference in channel %d twice\n", in_ch_id);
197 used_in_ch[in_ch_id] = 1;
198 pan->
gain[out_ch_id][in_ch_id] = sign * gain;
204 }
else if (*
arg !=
'+') {
230 double gain = pan->
gain[
i][j];
234 if (gain != 0. && gain != 1.)
237 if (gain && nb_gain++)
276 char buf[1024], *cur;
296 "af_pan supports a maximum of %d channels. "
297 "Feel free to ask for a higher limit.\n",
MAX_CHANNELS);
316 if (pan->
gain[
i][j]) {
334 if (t > -1
E-5 && t < 1
E-5) {
338 "Degenerate coefficients while renormalizing\n");
342 pan->
gain[
i][j] /= t;
355 r =
snprintf(cur, buf +
sizeof(buf) - cur,
"%s%.3g i%d",
356 j ?
" + " :
"", pan->
gain[
i][j], j);
357 cur +=
FFMIN(buf +
sizeof(buf) - cur,
r);
407 #define OFFSET(x) offsetof(PanContext, x)
429 .priv_class = &pan_class,
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.
#define AV_LOG_WARNING
Something somehow does not look correct.
AVChannelLayout out_channel_layout
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.
enum MovChannelLayoutTag * layouts
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 int config_props(AVFilterLink *link)
#define FILTER_QUERY_FUNC(func)
#define AV_LOG_VERBOSE
Detailed information.
int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map)
Set a customized input channel mapping.
const char * name
Filter name.
int nb_channels
Number of channels in this layout.
A link between two filters.
int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
Set a customized remix matrix.
AVChannelLayout ch_layout
Channel layout of the audio data.
A filter pad used for either input or output.
int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t *const *out_arg, int out_count, const uint8_t *const *in_arg, int in_count)
Convert audio.
#define AV_OPT_FLAG_AUDIO_PARAM
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
av_cold int swr_init(struct SwrContext *s)
Initialize context after user parameters have been set.
static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
static int query_formats(AVFilterContext *ctx)
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().
static void skip_spaces(char **arg)
The libswresample context.
#define FILTER_INPUTS(array)
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 link
Describe the class of an AVClass context structure.
static __device__ float fabs(float a)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
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.
static const AVFilterPad pan_inputs[]
static int are_gains_pure(const PanContext *pan)
static const AVOption pan_options[]
#define AV_OPT_FLAG_FILTERING_PARAM
A generic parameter which can be set by the user for filtering.
int swr_alloc_set_opts2(struct SwrContext **ps, const AVChannelLayout *out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate, const AVChannelLayout *in_ch_layout, enum AVSampleFormat in_sample_fmt, int in_sample_rate, int log_offset, void *log_ctx)
Allocate SwrContext if needed and set/reset common parameters.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
An AVChannelLayout holds information about the channel layout of audio data.
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *channel_layout, int search_flags)
int sample_rate
Sample rate of the audio data.
av_cold void swr_free(SwrContext **ss)
Free the given SwrContext and set the pointer to NULL.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
AVFilterFormatsConfig incfg
Lists of supported formats / etc.
int channel_map[MAX_CHANNELS]
#define AV_LOG_INFO
Standard information.
int nb_samples
number of audio samples (per channel) described by this frame
#define i(width, name, range_min, range_max)
uint8_t ** extended_data
pointers to the data planes/channels.
const char * name
Pad name.
enum AVChannel av_channel_from_string(const char *str)
This is the inverse function of av_channel_name().
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout, enum AVChannel channel)
Get the index of a given channel in a channel layout.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
static av_cold int init(AVFilterContext *ctx)
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
char * av_strdup(const char *s)
Duplicate a string.
AVChannelLayout ch_layout
channel layout of current buffer (see libavutil/channel_layout.h)
static int parse_channel_name(char **arg, int *rchannel, int *rnamed)
#define FILTER_OUTPUTS(array)
double gain[MAX_CHANNELS][MAX_CHANNELS]
AVFILTER_DEFINE_CLASS(pan)
static av_cold void uninit(AVFilterContext *ctx)