FFmpeg
af_pan.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002 Anders Johansson <ajh@atri.curtin.edu.au>
3  * Copyright (c) 2011 Clément Bœsch <u pkh me>
4  * Copyright (c) 2011 Nicolas George <nicolas.george@normalesup.org>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * Audio panning filter (channels mixing)
26  * Original code written by Anders Johansson for MPlayer,
27  * reimplemented for FFmpeg.
28  */
29 
30 #include <stdio.h>
31 #include "libavutil/avstring.h"
33 #include "libavutil/mem.h"
34 #include "libavutil/opt.h"
36 #include "audio.h"
37 #include "avfilter.h"
38 #include "formats.h"
39 #include "internal.h"
40 
41 #define MAX_CHANNELS 64
42 
43 typedef struct PanContext {
44  const AVClass *class;
45  char *args;
51 
53  /* channel mapping specific */
55  struct SwrContext *swr;
56 } PanContext;
57 
58 static void skip_spaces(char **arg)
59 {
60  int len = 0;
61 
62  sscanf(*arg, " %n", &len);
63  *arg += len;
64 }
65 
66 static int parse_channel_name(char **arg, int *rchannel, int *rnamed)
67 {
68  char buf[8];
69  int len, channel_id = 0;
70 
72  /* try to parse a channel name, e.g. "FL" */
73  if (sscanf(*arg, "%7[A-Z]%n", buf, &len)) {
74  channel_id = av_channel_from_string(buf);
75  if (channel_id < 0)
76  return channel_id;
77 
78  *rchannel = channel_id;
79  *rnamed = 1;
80  *arg += len;
81  return 0;
82  }
83  /* try to parse a channel number, e.g. "c2" */
84  if (sscanf(*arg, "c%d%n", &channel_id, &len) &&
85  channel_id >= 0 && channel_id < MAX_CHANNELS) {
86  *rchannel = channel_id;
87  *rnamed = 0;
88  *arg += len;
89  return 0;
90  }
91  return AVERROR(EINVAL);
92 }
93 
95 {
96  PanContext *const pan = ctx->priv;
97  char *arg, *arg0, *tokenizer, *args = av_strdup(pan->args);
98  int out_ch_id, in_ch_id, len, named, ret, sign = 1;
99  int nb_in_channels[2] = { 0, 0 }; // number of unnamed and named input channels
100  int used_out_ch[MAX_CHANNELS] = {0};
101  double gain;
102 
103  if (!pan->args) {
105  "pan filter needs a channel layout and a set "
106  "of channel definitions as parameter\n");
107  return AVERROR(EINVAL);
108  }
109  if (!args)
110  return AVERROR(ENOMEM);
111  arg = av_strtok(args, "|", &tokenizer);
112  if (!arg) {
113  av_log(ctx, AV_LOG_ERROR, "Channel layout not specified\n");
114  ret = AVERROR(EINVAL);
115  goto fail;
116  }
118  &pan->nb_output_channels, arg, ctx);
119  if (ret < 0)
120  goto fail;
121 
122  if (pan->nb_output_channels > MAX_CHANNELS) {
124  "af_pan supports a maximum of %d channels. "
125  "Feel free to ask for a higher limit.\n", MAX_CHANNELS);
127  goto fail;
128  }
129 
130  /* parse channel specifications */
131  while ((arg = arg0 = av_strtok(NULL, "|", &tokenizer))) {
132  int used_in_ch[MAX_CHANNELS] = {0};
133  /* channel name */
134  if (parse_channel_name(&arg, &out_ch_id, &named)) {
136  "Expected out channel name, got \"%.8s\"\n", arg);
137  ret = AVERROR(EINVAL);
138  goto fail;
139  }
140  if (named) {
141  if ((out_ch_id = av_channel_layout_index_from_channel(&pan->out_channel_layout, out_ch_id)) < 0) {
143  "Channel \"%.8s\" does not exist in the chosen layout\n", arg0);
144  ret = AVERROR(EINVAL);
145  goto fail;
146  }
147  }
148  if (out_ch_id < 0 || out_ch_id >= pan->nb_output_channels) {
150  "Invalid out channel name \"%.8s\"\n", arg0);
151  ret = AVERROR(EINVAL);
152  goto fail;
153  }
154  if (used_out_ch[out_ch_id]) {
156  "Can not reference out channel %d twice\n", out_ch_id);
157  ret = AVERROR(EINVAL);
158  goto fail;
159  }
160  used_out_ch[out_ch_id] = 1;
161  skip_spaces(&arg);
162  if (*arg == '=') {
163  arg++;
164  } else if (*arg == '<') {
165  pan->need_renorm |= (int64_t)1 << out_ch_id;
166  arg++;
167  } else {
169  "Syntax error after channel name in \"%.8s\"\n", arg0);
170  ret = AVERROR(EINVAL);
171  goto fail;
172  }
173  /* gains */
174  sign = 1;
175  while (1) {
176  gain = 1;
177  if (sscanf(arg, "%lf%n *%n", &gain, &len, &len))
178  arg += len;
179  if (parse_channel_name(&arg, &in_ch_id, &named)){
181  "Expected in channel name, got \"%.8s\"\n", arg);
182  ret = AVERROR(EINVAL);
183  goto fail;
184  }
185  nb_in_channels[named]++;
186  if (nb_in_channels[!named]) {
188  "Can not mix named and numbered channels\n");
189  ret = AVERROR(EINVAL);
190  goto fail;
191  }
192  if (used_in_ch[in_ch_id]) {
194  "Can not reference in channel %d twice\n", in_ch_id);
195  ret = AVERROR(EINVAL);
196  goto fail;
197  }
198  used_in_ch[in_ch_id] = 1;
199  pan->gain[out_ch_id][in_ch_id] = sign * gain;
200  skip_spaces(&arg);
201  if (!*arg)
202  break;
203  if (*arg == '-') {
204  sign = -1;
205  } else if (*arg != '+') {
206  av_log(ctx, AV_LOG_ERROR, "Syntax error near \"%.8s\"\n", arg);
207  ret = AVERROR(EINVAL);
208  goto fail;
209  } else {
210  sign = 1;
211  }
212  arg++;
213  }
214  }
215  pan->need_renumber = !!nb_in_channels[1];
216 
217  ret = 0;
218 fail:
219  av_free(args);
220  return ret;
221 }
222 
223 static int are_gains_pure(const PanContext *pan)
224 {
225  int i, j;
226 
227  for (i = 0; i < MAX_CHANNELS; i++) {
228  int nb_gain = 0;
229 
230  for (j = 0; j < MAX_CHANNELS; j++) {
231  double gain = pan->gain[i][j];
232 
233  /* channel mapping is effective only if 0% or 100% of a channel is
234  * selected... */
235  if (gain != 0. && gain != 1.)
236  return 0;
237  /* ...and if the output channel is only composed of one input */
238  if (gain && nb_gain++)
239  return 0;
240  }
241  }
242  return 1;
243 }
244 
246 {
247  PanContext *pan = ctx->priv;
248  AVFilterLink *inlink = ctx->inputs[0];
249  AVFilterLink *outlink = ctx->outputs[0];
251  int ret;
252 
253  pan->pure_gains = are_gains_pure(pan);
254  /* libswr supports any sample and packing formats */
256  return ret;
257 
259  return ret;
260 
261  // inlink supports any channel layout
263  if ((ret = ff_channel_layouts_ref(layouts, &inlink->outcfg.channel_layouts)) < 0)
264  return ret;
265 
266  // outlink supports only requested output channel layout
267  layouts = NULL;
269  return ret;
271 }
272 
274 {
275  AVFilterContext *ctx = link->dst;
276  PanContext *pan = ctx->priv;
277  char buf[1024], *cur;
278  int i, j, k, r, ret;
279  double t;
280 
281  if (pan->need_renumber) {
282  // input channels were given by their name: renumber them
283  for (i = j = 0; i < MAX_CHANNELS; i++) {
285  for (k = 0; k < pan->nb_output_channels; k++)
286  pan->gain[k][j] = pan->gain[k][i];
287  j++;
288  }
289  }
290  }
291 
292  // sanity check; can't be done in query_formats since the inlink
293  // channel layout is unknown at that time
297  "af_pan supports a maximum of %d channels. "
298  "Feel free to ask for a higher limit.\n", MAX_CHANNELS);
299  return AVERROR_PATCHWELCOME;
300  }
301 
302  // init libswresample context
303  ret = swr_alloc_set_opts2(&pan->swr,
306  0, ctx);
307  if (ret < 0)
308  return AVERROR(ENOMEM);
309 
310  // gains are pure, init the channel mapping
311  if (pan->pure_gains) {
312 
313  // get channel map from the pure gains
314  for (i = 0; i < pan->nb_output_channels; i++) {
315  int ch_id = -1;
316  for (j = 0; j < link->ch_layout.nb_channels; j++) {
317  if (pan->gain[i][j]) {
318  ch_id = j;
319  break;
320  }
321  }
322  pan->channel_map[i] = ch_id;
323  }
324 
325  av_opt_set_chlayout(pan->swr, "uchl", &pan->out_channel_layout, 0);
327  } else {
328  // renormalize
329  for (i = 0; i < pan->nb_output_channels; i++) {
330  if (!((pan->need_renorm >> i) & 1))
331  continue;
332  t = 0;
333  for (j = 0; j < link->ch_layout.nb_channels; j++)
334  t += fabs(pan->gain[i][j]);
335  if (t > -1E-5 && t < 1E-5) {
336  // t is almost 0 but not exactly, this is probably a mistake
337  if (t)
339  "Degenerate coefficients while renormalizing\n");
340  continue;
341  }
342  for (j = 0; j < link->ch_layout.nb_channels; j++)
343  pan->gain[i][j] /= t;
344  }
345  swr_set_matrix(pan->swr, pan->gain[0], pan->gain[1] - pan->gain[0]);
346  }
347 
348  r = swr_init(pan->swr);
349  if (r < 0)
350  return r;
351 
352  // summary
353  for (i = 0; i < pan->nb_output_channels; i++) {
354  cur = buf;
355  for (j = 0; j < link->ch_layout.nb_channels; j++) {
356  r = snprintf(cur, buf + sizeof(buf) - cur, "%s%.3g i%d",
357  j ? " + " : "", pan->gain[i][j], j);
358  cur += FFMIN(buf + sizeof(buf) - cur, r);
359  }
360  av_log(ctx, AV_LOG_VERBOSE, "o%d = %s\n", i, buf);
361  }
362  // add channel mapping summary if possible
363  if (pan->pure_gains) {
364  av_log(ctx, AV_LOG_INFO, "Pure channel mapping detected:");
365  for (i = 0; i < pan->nb_output_channels; i++)
366  if (pan->channel_map[i] < 0)
367  av_log(ctx, AV_LOG_INFO, " M");
368  else
369  av_log(ctx, AV_LOG_INFO, " %d", pan->channel_map[i]);
370  av_log(ctx, AV_LOG_INFO, "\n");
371  return 0;
372  }
373  return 0;
374 }
375 
376 static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
377 {
378  int ret;
379  int n = insamples->nb_samples;
380  AVFilterLink *const outlink = inlink->dst->outputs[0];
381  AVFrame *outsamples = ff_get_audio_buffer(outlink, n);
382  PanContext *pan = inlink->dst->priv;
383 
384  if (!outsamples) {
385  av_frame_free(&insamples);
386  return AVERROR(ENOMEM);
387  }
388  swr_convert(pan->swr, outsamples->extended_data, n,
389  (void *)insamples->extended_data, n);
390  av_frame_copy_props(outsamples, insamples);
391  if ((ret = av_channel_layout_copy(&outsamples->ch_layout, &outlink->ch_layout)) < 0) {
392  av_frame_free(&outsamples);
393  av_frame_free(&insamples);
394  return ret;
395  }
396 
397  av_frame_free(&insamples);
398  return ff_filter_frame(outlink, outsamples);
399 }
400 
402 {
403  PanContext *pan = ctx->priv;
404  swr_free(&pan->swr);
406 }
407 
408 #define OFFSET(x) offsetof(PanContext, x)
409 
410 static const AVOption pan_options[] = {
412  { NULL }
413 };
414 
416 
417 static const AVFilterPad pan_inputs[] = {
418  {
419  .name = "default",
420  .type = AVMEDIA_TYPE_AUDIO,
421  .config_props = config_props,
422  .filter_frame = filter_frame,
423  },
424 };
425 
427  .name = "pan",
428  .description = NULL_IF_CONFIG_SMALL("Remix channels with coefficients (panning)."),
429  .priv_size = sizeof(PanContext),
430  .priv_class = &pan_class,
431  .init = init,
432  .uninit = uninit,
436 };
ff_get_audio_buffer
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
Definition: audio.c:97
AVFilterChannelLayouts
A list of supported channel layouts.
Definition: formats.h:85
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
PanContext::out_channel_layout
AVChannelLayout out_channel_layout
Definition: af_pan.c:46
r
const char * r
Definition: vf_curves.c:127
AVERROR
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
opt.h
AVFilterFormatsConfig::channel_layouts
AVFilterChannelLayouts * channel_layouts
Lists of supported channel layouts, only for audio.
Definition: avfilter.h:520
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1015
ff_channel_layouts_ref
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition: formats.c:674
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:335
int64_t
long long int64_t
Definition: coverity.c:34
inlink
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
Definition: filter_design.txt:212
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
ff_all_channel_counts
AVFilterChannelLayouts * ff_all_channel_counts(void)
Construct an AVFilterChannelLayouts coding for any channel layout, with known or unknown disposition.
Definition: formats.c:622
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
AVOption
AVOption.
Definition: opt.h:357
config_props
static int config_props(AVFilterLink *link)
Definition: af_pan.c:273
FILTER_QUERY_FUNC
#define FILTER_QUERY_FUNC(func)
Definition: internal.h:159
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
ff_set_common_all_samplerates
int ff_set_common_all_samplerates(AVFilterContext *ctx)
Equivalent to ff_set_common_samplerates(ctx, ff_all_samplerates())
Definition: formats.c:822
swr_set_channel_mapping
int swr_set_channel_mapping(struct SwrContext *s, const int *channel_map)
Set a customized input channel mapping.
Definition: swresample.c:33
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:321
swr_set_matrix
int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
Set a customized remix matrix.
Definition: rematrix.c:65
ff_af_pan
const AVFilter ff_af_pan
Definition: af_pan.c:426
formats.h
fail
#define fail()
Definition: checkasm.h:186
AVFrame::ch_layout
AVChannelLayout ch_layout
Channel layout of the audio data.
Definition: frame.h:775
ff_all_formats
AVFilterFormats * ff_all_formats(enum AVMediaType type)
Return a list of all formats supported by FFmpeg for the given media type.
Definition: formats.c:536
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
swr_convert
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.
Definition: swresample.c:719
AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_AUDIO_PARAM
Definition: opt.h:285
PanContext::pure_gains
int pure_gains
Definition: af_pan.c:52
PanContext::swr
struct SwrContext * swr
Definition: af_pan.c:55
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
ff_set_common_formats
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:868
swr_init
av_cold int swr_init(struct SwrContext *s)
Initialize context after user parameters have been set.
Definition: swresample.c:140
PanContext::args
char * args
Definition: af_pan.c:45
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
Definition: af_pan.c:376
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: af_pan.c:245
av_strtok
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().
Definition: avstring.c:178
skip_spaces
static void skip_spaces(char **arg)
Definition: af_pan.c:58
ctx
AVFormatContext * ctx
Definition: movenc.c:49
SwrContext
The libswresample context.
Definition: swresample_internal.h:95
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
E
#define E
Definition: avdct.c:33
link
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
Definition: filter_design.txt:23
arg
const char * arg
Definition: jacosubdec.c:67
PanContext::need_renorm
int64_t need_renorm
Definition: af_pan.c:48
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
fabs
static __device__ float fabs(float a)
Definition: cuda_runtime.h:182
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:709
ff_audio_default_filterpad
const AVFilterPad ff_audio_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_AUDIO.
Definition: audio.c:33
pan_inputs
static const AVFilterPad pan_inputs[]
Definition: af_pan.c:417
are_gains_pure
static int are_gains_pure(const PanContext *pan)
Definition: af_pan.c:223
pan_options
static const AVOption pan_options[]
Definition: af_pan.c:410
ff_add_channel_layout
int ff_add_channel_layout(AVFilterChannelLayouts **l, const AVChannelLayout *channel_layout)
Definition: formats.c:522
PanContext::nb_output_channels
int nb_output_channels
Definition: af_pan.c:50
swresample.h
OFFSET
#define OFFSET(x)
Definition: af_pan.c:408
AV_OPT_FLAG_FILTERING_PARAM
#define AV_OPT_FLAG_FILTERING_PARAM
A generic parameter which can be set by the user for filtering.
Definition: opt.h:309
swr_alloc_set_opts2
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.
Definition: swresample.c:40
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:311
ff_parse_channel_layout
int ff_parse_channel_layout(AVChannelLayout *ret, int *nret, const char *arg, void *log_ctx)
Parse a channel layout or a corresponding integer representation.
Definition: formats.c:967
av_opt_set_chlayout
int av_opt_set_chlayout(void *obj, const char *name, const AVChannelLayout *channel_layout, int search_flags)
Definition: opt.c:941
AVFrame::sample_rate
int sample_rate
Sample rate of the audio data.
Definition: frame.h:573
PanContext::need_renumber
int need_renumber
Definition: af_pan.c:49
swr_free
av_cold void swr_free(SwrContext **ss)
Free the given SwrContext and set the pointer to NULL.
Definition: swresample.c:121
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:461
PanContext::channel_map
int channel_map[MAX_CHANNELS]
Definition: af_pan.c:54
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
internal.h
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:454
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVFrame::extended_data
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:435
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
len
int len
Definition: vorbis_enc_data.h:426
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
AVFilter
Filter definition.
Definition: avfilter.h:166
ret
ret
Definition: filter_design.txt:187
av_channel_from_string
enum AVChannel av_channel_from_string(const char *str)
This is the inverse function of av_channel_name().
Definition: channel_layout.c:150
channel_layout.h
av_channel_layout_index_from_channel
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.
Definition: channel_layout.c:708
avfilter.h
av_channel_layout_uninit
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Definition: channel_layout.c:437
init
static av_cold int init(AVFilterContext *ctx)
Definition: af_pan.c:94
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
av_channel_layout_copy
int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src)
Make a copy of a channel layout.
Definition: channel_layout.c:444
av_strdup
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:272
MAX_CHANNELS
#define MAX_CHANNELS
Definition: af_pan.c:41
mem.h
audio.h
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
PanContext
Definition: af_pan.c:43
parse_channel_name
static int parse_channel_name(char **arg, int *rchannel, int *rnamed)
Definition: af_pan.c:66
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
PanContext::gain
double gain[MAX_CHANNELS][MAX_CHANNELS]
Definition: af_pan.c:47
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(pan)
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: af_pan.c:401
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
avstring.h
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:249
snprintf
#define snprintf
Definition: snprintf.h:34