FFmpeg
af_channelmap.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 Google, Inc.
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * audio channel mapping filter
24  */
25 
26 #include <ctype.h>
27 
28 #include "libavutil/avstring.h"
30 #include "libavutil/common.h"
31 #include "libavutil/mathematics.h"
32 #include "libavutil/mem.h"
33 #include "libavutil/opt.h"
34 #include "libavutil/samplefmt.h"
35 
36 #include "audio.h"
37 #include "avfilter.h"
38 #include "filters.h"
39 #include "formats.h"
40 
41 struct ChannelMap {
46 };
47 
56 };
57 
58 typedef struct ChannelMapContext {
59  const AVClass *class;
60  char *mapping_str;
62  struct ChannelMap *map;
63  int nch;
65 
66  uint8_t **source_planes;
68 
69 #define OFFSET(x) offsetof(ChannelMapContext, x)
70 #define A AV_OPT_FLAG_AUDIO_PARAM
71 #define F AV_OPT_FLAG_FILTERING_PARAM
72 static const AVOption channelmap_options[] = {
73  { "map", "A comma-separated list of input channel numbers in output order.",
74  OFFSET(mapping_str), AV_OPT_TYPE_STRING, .flags = A|F },
75  { "channel_layout", "Output channel layout.",
76  OFFSET(output_layout), AV_OPT_TYPE_CHLAYOUT, .flags = A|F },
77  { NULL }
78 };
79 
80 AVFILTER_DEFINE_CLASS(channelmap);
81 
83 {
84  ChannelMapContext *s = ctx->priv;
85  av_freep(&s->map);
86  av_freep(&s->source_planes);
87 }
88 
89 static char* split(char *message, char delim) {
90  char *next = strchr(message, delim);
91  if (next)
92  *next++ = '\0';
93  return next;
94 }
95 
96 static int get_channel_idx(char **map, int *ch, char delim)
97 {
98  char *next;
99  int len;
100  int n = 0;
101  if (!*map)
102  return AVERROR(EINVAL);
103  next = split(*map, delim);
104  if (!next && delim == '-')
105  return AVERROR(EINVAL);
106  len = strlen(*map);
107  sscanf(*map, "%d%n", ch, &n);
108  if (n != len)
109  return AVERROR(EINVAL);
110  if (*ch < 0)
111  return AVERROR(EINVAL);
112  *map = next;
113  return 0;
114 }
115 
116 static int get_channel(char **map, int *ch, char delim)
117 {
118  char *next = split(*map, delim);
119  if (!next && delim == '-')
120  return AVERROR(EINVAL);
121  *ch = av_channel_from_string(*map);
122  if (*ch < 0)
123  return AVERROR(EINVAL);
124  *map = next;
125  return 0;
126 }
127 
128 static int check_idx_and_id(AVFilterContext *ctx, int channel_idx, int channel, AVChannelLayout *ch_layout, const char *io)
129 {
130  char channel_name[64];
131  char layout_name[256];
132  int nb_channels = ch_layout->nb_channels;
133 
134  if (channel_idx < 0 || channel_idx >= nb_channels) {
135  av_channel_layout_describe(ch_layout, layout_name, sizeof(layout_name));
136  if (channel >= 0) {
139  "%sput channel '%s' not available from %sput layout '%s'\n",
140  io, channel_name, io, layout_name);
141  } else {
143  "%sput channel #%d not available from %sput layout '%s'\n",
144  io, channel_idx, io, layout_name);
145  }
146  return AVERROR(EINVAL);
147  }
148 
149  return 0;
150 }
151 
153 {
154  ChannelMapContext *s = ctx->priv;
155  char *mapping, separator = '|';
156  int map_entries = 0;
157  enum MappingMode mode;
158  int64_t out_ch_mask = 0;
159  uint8_t *presence_map = NULL;
160  int ret = 0;
161  int i;
162 
163  mapping = s->mapping_str;
164 
165  if (!mapping) {
166  mode = MAP_NONE;
167  } else {
168  char *dash = strchr(mapping, '-');
169  if (!dash) { // short mapping
170  if (av_isdigit(*mapping))
171  mode = MAP_ONE_INT;
172  else
173  mode = MAP_ONE_STR;
174  } else if (av_isdigit(*mapping)) {
175  if (av_isdigit(*(dash+1)))
177  else
179  } else {
180  if (av_isdigit(*(dash+1)))
182  else
184  }
185  }
186 
187  if (mode != MAP_NONE) {
188  char *sep = mapping;
189  map_entries = 1;
190  while ((sep = strchr(sep, separator))) {
191  if (*++sep) // Allow trailing comma
192  map_entries++;
193  }
194 
195  s->map = av_malloc_array(map_entries, sizeof(*s->map));
196  if (!s->map)
197  return AVERROR(ENOMEM);
198  }
199 
200  for (i = 0; i < map_entries; i++) {
201  int in_ch_idx = -1, out_ch_idx = -1;
202  int in_ch = -1, out_ch = -1;
203  static const char err[] = "Failed to parse channel map\n";
204 
205  s->map[i].in_channel_idx = -1;
206  s->map[i].out_channel_idx = -1;
207  s->map[i].in_channel = -1;
208  s->map[i].out_channel = -1;
209 
210  switch (mode) {
211  case MAP_ONE_INT:
212  if (get_channel_idx(&mapping, &in_ch_idx, separator) < 0) {
213  av_log(ctx, AV_LOG_ERROR, err);
214  return AVERROR(EINVAL);
215  }
216  s->map[i].in_channel_idx = in_ch_idx;
217  s->map[i].out_channel_idx = i;
218  break;
219  case MAP_ONE_STR:
220  if (get_channel(&mapping, &in_ch, separator) < 0) {
221  av_log(ctx, AV_LOG_ERROR, err);
222  return AVERROR(EINVAL);
223  }
224  s->map[i].in_channel = in_ch;
225  s->map[i].out_channel_idx = i;
226  break;
227  case MAP_PAIR_INT_INT:
228  if (get_channel_idx(&mapping, &in_ch_idx, '-') < 0 ||
229  get_channel_idx(&mapping, &out_ch_idx, separator) < 0) {
230  av_log(ctx, AV_LOG_ERROR, err);
231  return AVERROR(EINVAL);
232  }
233  s->map[i].in_channel_idx = in_ch_idx;
234  s->map[i].out_channel_idx = out_ch_idx;
235  break;
236  case MAP_PAIR_INT_STR:
237  if (get_channel_idx(&mapping, &in_ch_idx, '-') < 0 ||
238  get_channel(&mapping, &out_ch, separator) < 0) {
239  av_log(ctx, AV_LOG_ERROR, err);
240  return AVERROR(EINVAL);
241  }
242  s->map[i].in_channel_idx = in_ch_idx;
243  s->map[i].out_channel = out_ch;
244  if (out_ch < 63)
245  out_ch_mask |= 1ULL << out_ch;
246  else
247  out_ch_mask = -1;
248  break;
249  case MAP_PAIR_STR_INT:
250  if (get_channel(&mapping, &in_ch, '-') < 0 ||
251  get_channel_idx(&mapping, &out_ch_idx, separator) < 0) {
252  av_log(ctx, AV_LOG_ERROR, err);
253  return AVERROR(EINVAL);
254  }
255  s->map[i].in_channel = in_ch;
256  s->map[i].out_channel_idx = out_ch_idx;
257  break;
258  case MAP_PAIR_STR_STR:
259  if (get_channel(&mapping, &in_ch, '-') < 0 ||
260  get_channel(&mapping, &out_ch, separator) < 0) {
261  av_log(ctx, AV_LOG_ERROR, err);
262  return AVERROR(EINVAL);
263  }
264  s->map[i].in_channel = in_ch;
265  s->map[i].out_channel = out_ch;
266  if (out_ch < 63)
267  out_ch_mask |= 1ULL << out_ch;
268  else
269  out_ch_mask = -1;
270  break;
271  }
272  }
273  s->mode = mode;
274  s->nch = map_entries;
275  if (s->output_layout.nb_channels == 0) {
276  if (out_ch_mask > 0)
277  av_channel_layout_from_mask(&s->output_layout, out_ch_mask);
278  else if (map_entries)
279  av_channel_layout_default(&s->output_layout, map_entries);
280  }
281 
282  if (mode == MAP_NONE) {
283  int i;
284  s->nch = s->output_layout.nb_channels;
285 
286  s->map = av_malloc_array(s->nch, sizeof(*s->map));
287  if (!s->map)
288  return AVERROR(ENOMEM);
289 
290  for (i = 0; i < s->nch; i++) {
291  s->map[i].in_channel_idx = i;
292  s->map[i].out_channel_idx = i;
293  }
294  } else if (s->nch != s->output_layout.nb_channels) {
295  char buf[256];
296  av_channel_layout_describe(&s->output_layout, buf, sizeof(buf));
298  "Output channel layout %s does not match the number of channels mapped %d.\n",
299  buf, s->nch);
300  return AVERROR(EINVAL);
301  }
302 
303  if (!s->output_layout.nb_channels) {
304  av_log(ctx, AV_LOG_ERROR, "Output channel layout is not set and "
305  "cannot be guessed from the maps.\n");
306  return AVERROR(EINVAL);
307  }
308 
310  for (i = 0; i < s->nch; i++) {
311  s->map[i].out_channel_idx = av_channel_layout_index_from_channel(
312  &s->output_layout, s->map[i].out_channel);
313  }
314  }
315 
316  presence_map = av_calloc(s->nch, sizeof(*presence_map));
317  for (i = 0; i < s->nch; i++) {
318  const int out_idx = s->map[i].out_channel_idx;
319  ret = check_idx_and_id(ctx, out_idx, s->map[i].out_channel, &s->output_layout, "out");
320  if (ret < 0)
321  break;
322  if (presence_map[out_idx]) {
323  char layout_name[256];
324  av_channel_layout_describe(&s->output_layout, layout_name, sizeof(layout_name));
325  av_log(ctx, AV_LOG_ERROR, "Mapping %d assigns channel #%d twice in output layout '%s'.\n",
326  i + 1, s->map[i].out_channel_idx, layout_name);
327  ret = AVERROR(EINVAL);
328  break;
329  }
330  presence_map[out_idx] = 1;
331  }
332  av_freep(&presence_map);
333  if (ret < 0)
334  return ret;
335 
336  return 0;
337 }
338 
340  AVFilterFormatsConfig **cfg_in,
341  AVFilterFormatsConfig **cfg_out)
342 {
343  const ChannelMapContext *s = ctx->priv;
345 
346  int ret;
347 
348  ret = ff_set_common_formats2(ctx, cfg_in, cfg_out, ff_planar_sample_fmts());
349  if (ret < 0)
350  return ret;
351 
352  ret = ff_add_channel_layout(&channel_layouts, &s->output_layout);
353  if (ret < 0)
354  return ret;
355 
357  if (ret < 0)
358  return ret;
359 
360  return 0;
361 }
362 
364 {
365  AVFilterContext *ctx = inlink->dst;
366  AVFilterLink *outlink = ctx->outputs[0];
367  const ChannelMapContext *s = ctx->priv;
368  const int nch_in = inlink->ch_layout.nb_channels;
369  const int nch_out = s->nch;
370  int ch, ret;
371 
372  memcpy(s->source_planes, buf->extended_data,
373  nch_in * sizeof(s->source_planes[0]));
374 
375  if (nch_out > nch_in) {
376  if (nch_out > FF_ARRAY_ELEMS(buf->data)) {
377  uint8_t **new_extended_data =
378  av_calloc(nch_out, sizeof(*buf->extended_data));
379  if (!new_extended_data) {
380  av_frame_free(&buf);
381  return AVERROR(ENOMEM);
382  }
383  if (buf->extended_data == buf->data) {
384  buf->extended_data = new_extended_data;
385  } else {
386  av_free(buf->extended_data);
387  buf->extended_data = new_extended_data;
388  }
389  } else if (buf->extended_data != buf->data) {
390  av_free(buf->extended_data);
391  buf->extended_data = buf->data;
392  }
393  }
394 
395  for (ch = 0; ch < nch_out; ch++) {
396  buf->extended_data[s->map[ch].out_channel_idx] =
397  s->source_planes[s->map[ch].in_channel_idx];
398  }
399 
400  if (buf->data != buf->extended_data)
401  memcpy(buf->data, buf->extended_data,
402  FFMIN(FF_ARRAY_ELEMS(buf->data), nch_out) * sizeof(buf->data[0]));
403 
404  if ((ret = av_channel_layout_copy(&buf->ch_layout, &outlink->ch_layout)) < 0)
405  return ret;
406 
407  return ff_filter_frame(outlink, buf);
408 }
409 
411 {
412  AVFilterContext *ctx = inlink->dst;
413  ChannelMapContext *s = ctx->priv;
414  int i, err = 0;
415 
416  for (i = 0; i < s->nch; i++) {
417  struct ChannelMap *m = &s->map[i];
418 
419  if (s->mode == MAP_PAIR_STR_INT || s->mode == MAP_PAIR_STR_STR || s->mode == MAP_ONE_STR) {
421  &inlink->ch_layout, m->in_channel);
422  }
423 
424  if (check_idx_and_id(ctx, m->in_channel_idx, m->in_channel, &inlink->ch_layout, "in") < 0)
425  err = AVERROR(EINVAL);
426  }
427 
428  av_freep(&s->source_planes);
429  s->source_planes = av_calloc(inlink->ch_layout.nb_channels,
430  sizeof(*s->source_planes));
431  if (!s->source_planes)
432  return AVERROR(ENOMEM);
433 
434  return err;
435 }
436 
438  {
439  .name = "default",
440  .type = AVMEDIA_TYPE_AUDIO,
442  .filter_frame = channelmap_filter_frame,
443  .config_props = channelmap_config_input,
444  },
445 };
446 
448  .name = "channelmap",
449  .description = NULL_IF_CONFIG_SMALL("Remap audio channels."),
450  .init = channelmap_init,
451  .uninit = channelmap_uninit,
452  .priv_size = sizeof(ChannelMapContext),
453  .priv_class = &channelmap_class,
457 };
AVFilterChannelLayouts
A list of supported channel layouts.
Definition: formats.h:85
ChannelMapContext::source_planes
uint8_t ** source_planes
Definition: af_channelmap.c:66
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
MAP_PAIR_STR_STR
@ MAP_PAIR_STR_STR
Definition: af_channelmap.c:55
message
Definition: api-threadmessage-test.c:47
ChannelMapContext::mode
enum MappingMode mode
Definition: af_channelmap.c:64
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1025
ff_channel_layouts_ref
int ff_channel_layouts_ref(AVFilterChannelLayouts *f, AVFilterChannelLayouts **ref)
Add *ref as a new reference to f.
Definition: formats.c:673
channelmap_filter_frame
static int channelmap_filter_frame(AVFilterLink *inlink, AVFrame *buf)
Definition: af_channelmap.c:363
F
#define F
Definition: af_channelmap.c:71
channelmap_init
static av_cold int channelmap_init(AVFilterContext *ctx)
Definition: af_channelmap.c:152
ff_set_common_formats2
int ff_set_common_formats2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *formats)
Definition: formats.c:1007
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:162
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
AVOption
AVOption.
Definition: opt.h:429
get_channel
static int get_channel(char **map, int *ch, char delim)
Definition: af_channelmap.c:116
mathematics.h
channel_name
Definition: channel_layout.c:42
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:205
MAP_NONE
@ MAP_NONE
Definition: af_channelmap.c:49
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:321
channelmap_query_formats
static int channelmap_query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: af_channelmap.c:339
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:410
formats.h
A
#define A
Definition: af_channelmap.c:70
samplefmt.h
ff_af_channelmap
const AVFilter ff_af_channelmap
Definition: af_channelmap.c:447
AVFrame::ch_layout
AVChannelLayout ch_layout
Channel layout of the audio data.
Definition: frame.h:790
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
MappingMode
MappingMode
Definition: af_channelmap.c:48
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
av_channel_layout_describe
int av_channel_layout_describe(const AVChannelLayout *channel_layout, char *buf, size_t buf_size)
Get a human-readable string describing the channel layout properties.
Definition: channel_layout.c:648
channelmap_options
static const AVOption channelmap_options[]
Definition: af_channelmap.c:72
s
#define s(width, name)
Definition: cbs_vp9.c:198
MAP_PAIR_STR_INT
@ MAP_PAIR_STR_INT
Definition: af_channelmap.c:54
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
av_channel_layout_from_mask
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
Definition: channel_layout.c:247
ChannelMapContext::nch
int nch
Definition: af_channelmap.c:63
filters.h
ctx
AVFormatContext * ctx
Definition: movenc.c:49
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
NULL
#define NULL
Definition: coverity.c:32
ChannelMapContext::output_layout
AVChannelLayout output_layout
Definition: af_channelmap.c:61
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:34
ChannelMap::in_channel
int in_channel
Definition: af_channelmap.c:42
get_channel_idx
static int get_channel_idx(char **map, int *ch, char delim)
Definition: af_channelmap.c:96
AV_OPT_TYPE_CHLAYOUT
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Definition: opt.h:331
ff_add_channel_layout
int ff_add_channel_layout(AVFilterChannelLayouts **l, const AVChannelLayout *channel_layout)
Definition: formats.c:521
AVFilterFormatsConfig
Lists of formats / etc.
Definition: avfilter.h:111
channelmap_uninit
static void channelmap_uninit(AVFilterContext *ctx)
Definition: af_channelmap.c:82
MAP_PAIR_INT_INT
@ MAP_PAIR_INT_INT
Definition: af_channelmap.c:52
AVFILTERPAD_FLAG_NEEDS_WRITABLE
#define AVFILTERPAD_FLAG_NEEDS_WRITABLE
The filter expects writable frames from its input link, duplicating data buffers if needed.
Definition: filters.h:57
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
ChannelMapContext
Definition: af_channelmap.c:58
avfilter_af_channelmap_inputs
static const AVFilterPad avfilter_af_channelmap_inputs[]
Definition: af_channelmap.c:437
MAP_ONE_STR
@ MAP_ONE_STR
Definition: af_channelmap.c:51
MAP_ONE_INT
@ MAP_ONE_INT
Definition: af_channelmap.c:50
MAP_PAIR_INT_STR
@ MAP_PAIR_INT_STR
Definition: af_channelmap.c:53
channelmap_config_input
static int channelmap_config_input(AVFilterLink *inlink)
Definition: af_channelmap.c:410
split
static char * split(char *message, char delim)
Definition: af_channelmap.c:89
ChannelMapContext::map
struct ChannelMap * map
Definition: af_channelmap.c:62
av_isdigit
static av_const int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
Definition: avstring.h:202
ChannelMap::in_channel_idx
int in_channel_idx
index of in_channel in the input stream data
Definition: af_channelmap.c:44
ChannelMapContext::mapping_str
char * mapping_str
Definition: af_channelmap.c:60
av_channel_layout_default
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
Definition: channel_layout.c:834
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
av_channel_name
int av_channel_name(char *buf, size_t buf_size, enum AVChannel channel_id)
Get a human readable string in an abbreviated form describing a given channel.
Definition: channel_layout.c:102
AVFrame::extended_data
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:450
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
common.h
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
ff_planar_sample_fmts
AVFilterFormats * ff_planar_sample_fmts(void)
Construct a formats list containing all planar sample formats.
Definition: formats.c:593
len
int len
Definition: vorbis_enc_data.h:426
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:44
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:264
ChannelMap::out_channel
int out_channel
Definition: af_channelmap.c:43
AVFilter
Filter definition.
Definition: avfilter.h:201
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
ChannelMap::out_channel_idx
int out_channel_idx
Definition: af_channelmap.c:45
channel_layout.h
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(channelmap)
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
mode
mode
Definition: ebur128.h:83
avfilter.h
ChannelMap
Definition: parse.h:48
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
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
OFFSET
#define OFFSET(x)
Definition: af_channelmap.c:69
mem.h
audio.h
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:71
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
check_idx_and_id
static int check_idx_and_id(AVFilterContext *ctx, int channel_idx, int channel, AVChannelLayout *ch_layout, const char *io)
Definition: af_channelmap.c:128
channel_layouts
static const uint16_t channel_layouts[7]
Definition: dca_lbr.c:112
ChannelMap::channel_idx
int channel_idx
Definition: parse.h:50
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
avstring.h
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
channel
channel
Definition: ebur128.h:39