FFmpeg
channel_layout.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
3  * Copyright (c) 2008 Peter Ross
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVUTIL_CHANNEL_LAYOUT_H
23 #define AVUTIL_CHANNEL_LAYOUT_H
24 
25 #include <stdint.h>
26 #include <stdlib.h>
27 
28 #include "version.h"
29 #include "attributes.h"
30 
31 /**
32  * @file
33  * @ingroup lavu_audio_channels
34  * Public libavutil channel layout APIs header.
35  */
36 
37 
38 /**
39  * @defgroup lavu_audio_channels Audio channels
40  * @ingroup lavu_audio
41  *
42  * Audio channel layout utility functions
43  *
44  * @{
45  */
46 
47 enum AVChannel {
48  ///< Invalid channel index
68  /** Stereo downmix. */
70  /** See above. */
82  AV_CHAN_SIDE_SURROUND_LEFT, ///< +90 degrees, Lss, SiL
83  AV_CHAN_SIDE_SURROUND_RIGHT, ///< -90 degrees, Rss, SiR
84  AV_CHAN_TOP_SURROUND_LEFT, ///< +110 degrees, Lvs, TpLS
85  AV_CHAN_TOP_SURROUND_RIGHT, ///< -110 degrees, Rvs, TpRS
86 
89 
90  /** Channel is empty can be safely skipped. */
91  AV_CHAN_UNUSED = 0x200,
92 
93  /** Channel contains data, but its position is unknown. */
94  AV_CHAN_UNKNOWN = 0x300,
95 
96  /**
97  * Range of channels between AV_CHAN_AMBISONIC_BASE and
98  * AV_CHAN_AMBISONIC_END represent Ambisonic components using the ACN system.
99  *
100  * Given a channel id `<i>` between AV_CHAN_AMBISONIC_BASE and
101  * AV_CHAN_AMBISONIC_END (inclusive), the ACN index of the channel `<n>` is
102  * `<n> = <i> - AV_CHAN_AMBISONIC_BASE`.
103  *
104  * @note these values are only used for AV_CHANNEL_ORDER_CUSTOM channel
105  * orderings, the AV_CHANNEL_ORDER_AMBISONIC ordering orders the channels
106  * implicitly by their position in the stream.
107  */
109  // leave space for 1024 ids, which correspond to maximum order-32 harmonics,
110  // which should be enough for the foreseeable use cases
112 };
113 
115  /**
116  * Only the channel count is specified, without any further information
117  * about the channel order.
118  */
120  /**
121  * The native channel order, i.e. the channels are in the same order in
122  * which they are defined in the AVChannel enum. This supports up to 63
123  * different channels.
124  */
126  /**
127  * The channel order does not correspond to any other predefined order and
128  * is stored as an explicit map. For example, this could be used to support
129  * layouts with 64 or more channels, or with empty/skipped (AV_CHAN_UNUSED)
130  * channels at arbitrary positions.
131  */
133  /**
134  * The audio is represented as the decomposition of the sound field into
135  * spherical harmonics. Each channel corresponds to a single expansion
136  * component. Channels are ordered according to ACN (Ambisonic Channel
137  * Number).
138  *
139  * The channel with the index n in the stream contains the spherical
140  * harmonic of degree l and order m given by
141  * @code{.unparsed}
142  * l = floor(sqrt(n)),
143  * m = n - l * (l + 1).
144  * @endcode
145  *
146  * Conversely given a spherical harmonic of degree l and order m, the
147  * corresponding channel index n is given by
148  * @code{.unparsed}
149  * n = l * (l + 1) + m.
150  * @endcode
151  *
152  * Normalization is assumed to be SN3D (Schmidt Semi-Normalization)
153  * as defined in AmbiX format $ 2.1.
154  */
156  /**
157  * Number of channel orders, not part of ABI/API
158  */
160 };
161 
162 
163 /**
164  * @defgroup channel_masks Audio channel masks
165  *
166  * A channel layout is a 64-bits integer with a bit set for every channel.
167  * The number of bits set must be equal to the number of channels.
168  * The value 0 means that the channel layout is not known.
169  * @note this data structure is not powerful enough to handle channels
170  * combinations that have the same channel multiple times, such as
171  * dual-mono.
172  *
173  * @{
174  */
175 #define AV_CH_FRONT_LEFT (1ULL << AV_CHAN_FRONT_LEFT )
176 #define AV_CH_FRONT_RIGHT (1ULL << AV_CHAN_FRONT_RIGHT )
177 #define AV_CH_FRONT_CENTER (1ULL << AV_CHAN_FRONT_CENTER )
178 #define AV_CH_LOW_FREQUENCY (1ULL << AV_CHAN_LOW_FREQUENCY )
179 #define AV_CH_BACK_LEFT (1ULL << AV_CHAN_BACK_LEFT )
180 #define AV_CH_BACK_RIGHT (1ULL << AV_CHAN_BACK_RIGHT )
181 #define AV_CH_FRONT_LEFT_OF_CENTER (1ULL << AV_CHAN_FRONT_LEFT_OF_CENTER )
182 #define AV_CH_FRONT_RIGHT_OF_CENTER (1ULL << AV_CHAN_FRONT_RIGHT_OF_CENTER)
183 #define AV_CH_BACK_CENTER (1ULL << AV_CHAN_BACK_CENTER )
184 #define AV_CH_SIDE_LEFT (1ULL << AV_CHAN_SIDE_LEFT )
185 #define AV_CH_SIDE_RIGHT (1ULL << AV_CHAN_SIDE_RIGHT )
186 #define AV_CH_TOP_CENTER (1ULL << AV_CHAN_TOP_CENTER )
187 #define AV_CH_TOP_FRONT_LEFT (1ULL << AV_CHAN_TOP_FRONT_LEFT )
188 #define AV_CH_TOP_FRONT_CENTER (1ULL << AV_CHAN_TOP_FRONT_CENTER )
189 #define AV_CH_TOP_FRONT_RIGHT (1ULL << AV_CHAN_TOP_FRONT_RIGHT )
190 #define AV_CH_TOP_BACK_LEFT (1ULL << AV_CHAN_TOP_BACK_LEFT )
191 #define AV_CH_TOP_BACK_CENTER (1ULL << AV_CHAN_TOP_BACK_CENTER )
192 #define AV_CH_TOP_BACK_RIGHT (1ULL << AV_CHAN_TOP_BACK_RIGHT )
193 #define AV_CH_STEREO_LEFT (1ULL << AV_CHAN_STEREO_LEFT )
194 #define AV_CH_STEREO_RIGHT (1ULL << AV_CHAN_STEREO_RIGHT )
195 #define AV_CH_WIDE_LEFT (1ULL << AV_CHAN_WIDE_LEFT )
196 #define AV_CH_WIDE_RIGHT (1ULL << AV_CHAN_WIDE_RIGHT )
197 #define AV_CH_SURROUND_DIRECT_LEFT (1ULL << AV_CHAN_SURROUND_DIRECT_LEFT )
198 #define AV_CH_SURROUND_DIRECT_RIGHT (1ULL << AV_CHAN_SURROUND_DIRECT_RIGHT)
199 #define AV_CH_LOW_FREQUENCY_2 (1ULL << AV_CHAN_LOW_FREQUENCY_2 )
200 #define AV_CH_TOP_SIDE_LEFT (1ULL << AV_CHAN_TOP_SIDE_LEFT )
201 #define AV_CH_TOP_SIDE_RIGHT (1ULL << AV_CHAN_TOP_SIDE_RIGHT )
202 #define AV_CH_BOTTOM_FRONT_CENTER (1ULL << AV_CHAN_BOTTOM_FRONT_CENTER )
203 #define AV_CH_BOTTOM_FRONT_LEFT (1ULL << AV_CHAN_BOTTOM_FRONT_LEFT )
204 #define AV_CH_BOTTOM_FRONT_RIGHT (1ULL << AV_CHAN_BOTTOM_FRONT_RIGHT )
205 #define AV_CH_SIDE_SURROUND_LEFT (1ULL << AV_CHAN_SIDE_SURROUND_LEFT )
206 #define AV_CH_SIDE_SURROUND_RIGHT (1ULL << AV_CHAN_SIDE_SURROUND_RIGHT )
207 #define AV_CH_TOP_SURROUND_LEFT (1ULL << AV_CHAN_TOP_SURROUND_LEFT )
208 #define AV_CH_TOP_SURROUND_RIGHT (1ULL << AV_CHAN_TOP_SURROUND_RIGHT )
209 #define AV_CH_BINAURAL_LEFT (1ULL << AV_CHAN_BINAURAL_LEFT )
210 #define AV_CH_BINAURAL_RIGHT (1ULL << AV_CHAN_BINAURAL_RIGHT )
211 
212 /**
213  * @}
214  * @defgroup channel_mask_c Audio channel layouts
215  * @{
216  * */
217 #define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER)
218 #define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT)
219 #define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY)
220 #define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER)
221 #define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER)
222 #define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY)
223 #define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER)
224 #define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY)
225 #define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
226 #define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
227 #define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT)
228 #define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY)
229 #define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
230 #define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY)
231 #define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER)
232 #define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
233 #define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER)
234 #define AV_CH_LAYOUT_3POINT1POINT2 (AV_CH_LAYOUT_3POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
235 #define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER)
236 #define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER)
237 #define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY)
238 #define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
239 #define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
240 #define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
241 #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
242 #define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
243 #define AV_CH_LAYOUT_5POINT1POINT2_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
244 #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
245 #define AV_CH_LAYOUT_CUBE (AV_CH_LAYOUT_QUAD|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT)
246 #define AV_CH_LAYOUT_5POINT1POINT4_BACK (AV_CH_LAYOUT_5POINT1POINT2_BACK|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT)
247 #define AV_CH_LAYOUT_7POINT1POINT2 (AV_CH_LAYOUT_7POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
248 #define AV_CH_LAYOUT_7POINT1POINT4_BACK (AV_CH_LAYOUT_7POINT1POINT2|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT)
249 #define AV_CH_LAYOUT_7POINT2POINT3 (AV_CH_LAYOUT_7POINT1POINT2|AV_CH_TOP_BACK_CENTER|AV_CH_LOW_FREQUENCY_2)
250 #define AV_CH_LAYOUT_9POINT1POINT4_BACK (AV_CH_LAYOUT_7POINT1POINT4_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
251 #define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
252 #define AV_CH_LAYOUT_BINAURAL (AV_CH_BINAURAL_LEFT|AV_CH_BINAURAL_RIGHT)
253 #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
254 #define AV_CH_LAYOUT_22POINT2 (AV_CH_LAYOUT_7POINT1POINT4_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER|AV_CH_BACK_CENTER|AV_CH_LOW_FREQUENCY_2|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_CENTER|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_BOTTOM_FRONT_CENTER|AV_CH_BOTTOM_FRONT_LEFT|AV_CH_BOTTOM_FRONT_RIGHT)
255 
256 #define AV_CH_LAYOUT_7POINT1_TOP_BACK AV_CH_LAYOUT_5POINT1POINT2_BACK
257 
267 };
268 
269 /**
270  * @}
271  */
272 
273 /**
274  * An AVChannelCustom defines a single channel within a custom order layout
275  *
276  * Unlike most structures in FFmpeg, sizeof(AVChannelCustom) is a part of the
277  * public ABI.
278  *
279  * No new fields may be added to it without a major version bump.
280  */
281 typedef struct AVChannelCustom {
282  enum AVChannel id;
283  char name[16];
284  void *opaque;
286 
287 /**
288  * An AVChannelLayout holds information about the channel layout of audio data.
289  *
290  * A channel layout here is defined as a set of channels ordered in a specific
291  * way (unless the channel order is AV_CHANNEL_ORDER_UNSPEC, in which case an
292  * AVChannelLayout carries only the channel count).
293  * All orders may be treated as if they were AV_CHANNEL_ORDER_UNSPEC by
294  * ignoring everything but the channel count, as long as av_channel_layout_check()
295  * considers they are valid.
296  *
297  * Unlike most structures in FFmpeg, sizeof(AVChannelLayout) is a part of the
298  * public ABI and may be used by the caller. E.g. it may be allocated on stack
299  * or embedded in caller-defined structs.
300  *
301  * AVChannelLayout can be initialized as follows:
302  * - default initialization with {0}, followed by setting all used fields
303  * correctly;
304  * - by assigning one of the predefined AV_CHANNEL_LAYOUT_* initializers;
305  * - with a constructor function, such as av_channel_layout_default(),
306  * av_channel_layout_from_mask() or av_channel_layout_from_string().
307  *
308  * The channel layout must be unitialized with av_channel_layout_uninit()
309  *
310  * Copying an AVChannelLayout via assigning is forbidden,
311  * av_channel_layout_copy() must be used instead (and its return value should
312  * be checked)
313  *
314  * No new fields may be added to it without a major version bump, except for
315  * new elements of the union fitting in sizeof(uint64_t).
316  */
317 typedef struct AVChannelLayout {
318  /**
319  * Channel order used in this layout.
320  * This is a mandatory field.
321  */
323 
324  /**
325  * Number of channels in this layout. Mandatory field.
326  */
328 
329  /**
330  * Details about which channels are present in this layout.
331  * For AV_CHANNEL_ORDER_UNSPEC, this field is undefined and must not be
332  * used.
333  */
334  union {
335  /**
336  * This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used
337  * for AV_CHANNEL_ORDER_AMBISONIC to signal non-diegetic channels.
338  * It is a bitmask, where the position of each set bit means that the
339  * AVChannel with the corresponding value is present.
340  *
341  * I.e. when (mask & (1 << AV_CHAN_FOO)) is non-zero, then AV_CHAN_FOO
342  * is present in the layout. Otherwise it is not present.
343  *
344  * @note when a channel layout using a bitmask is constructed or
345  * modified manually (i.e. not using any of the av_channel_layout_*
346  * functions), the code doing it must ensure that the number of set bits
347  * is equal to nb_channels.
348  */
349  uint64_t mask;
350  /**
351  * This member must be used when the channel order is
352  * AV_CHANNEL_ORDER_CUSTOM. It is a nb_channels-sized array, with each
353  * element signalling the presence of the AVChannel with the
354  * corresponding value in map[i].id.
355  *
356  * I.e. when map[i].id is equal to AV_CHAN_FOO, then AV_CH_FOO is the
357  * i-th channel in the audio data.
358  *
359  * When map[i].id is in the range between AV_CHAN_AMBISONIC_BASE and
360  * AV_CHAN_AMBISONIC_END (inclusive), the channel contains an ambisonic
361  * component with ACN index (as defined above)
362  * n = map[i].id - AV_CHAN_AMBISONIC_BASE.
363  *
364  * map[i].name may be filled with a 0-terminated string, in which case
365  * it will be used for the purpose of identifying the channel with the
366  * convenience functions below. Otherise it must be zeroed.
367  */
369  } u;
370 
371  /**
372  * For some private data of the user.
373  */
374  void *opaque;
376 
377 /**
378  * Macro to define native channel layouts
379  *
380  * @note This doesn't use designated initializers for compatibility with C++ 17 and older.
381  */
382 #define AV_CHANNEL_LAYOUT_MASK(nb, m) \
383  { /* .order */ AV_CHANNEL_ORDER_NATIVE, \
384  /* .nb_channels */ (nb), \
385  /* .u.mask */ { m }, \
386  /* .opaque */ NULL }
387 
388 /**
389  * @name Common pre-defined channel layouts
390  * @{
391  */
392 #define AV_CHANNEL_LAYOUT_MONO AV_CHANNEL_LAYOUT_MASK(1, AV_CH_LAYOUT_MONO)
393 #define AV_CHANNEL_LAYOUT_STEREO AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO)
394 #define AV_CHANNEL_LAYOUT_2POINT1 AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2POINT1)
395 #define AV_CHANNEL_LAYOUT_2_1 AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2_1)
396 #define AV_CHANNEL_LAYOUT_SURROUND AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_SURROUND)
397 #define AV_CHANNEL_LAYOUT_3POINT1 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_3POINT1)
398 #define AV_CHANNEL_LAYOUT_4POINT0 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_4POINT0)
399 #define AV_CHANNEL_LAYOUT_4POINT1 AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_4POINT1)
400 #define AV_CHANNEL_LAYOUT_2_2 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_2_2)
401 #define AV_CHANNEL_LAYOUT_QUAD AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_QUAD)
402 #define AV_CHANNEL_LAYOUT_5POINT0 AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0)
403 #define AV_CHANNEL_LAYOUT_5POINT1 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1)
404 #define AV_CHANNEL_LAYOUT_5POINT0_BACK AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0_BACK)
405 #define AV_CHANNEL_LAYOUT_5POINT1_BACK AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1_BACK)
406 #define AV_CHANNEL_LAYOUT_6POINT0 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0)
407 #define AV_CHANNEL_LAYOUT_6POINT0_FRONT AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0_FRONT)
408 #define AV_CHANNEL_LAYOUT_3POINT1POINT2 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_3POINT1POINT2)
409 #define AV_CHANNEL_LAYOUT_HEXAGONAL AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_HEXAGONAL)
410 #define AV_CHANNEL_LAYOUT_6POINT1 AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1)
411 #define AV_CHANNEL_LAYOUT_6POINT1_BACK AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_BACK)
412 #define AV_CHANNEL_LAYOUT_6POINT1_FRONT AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_FRONT)
413 #define AV_CHANNEL_LAYOUT_7POINT0 AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0)
414 #define AV_CHANNEL_LAYOUT_7POINT0_FRONT AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0_FRONT)
415 #define AV_CHANNEL_LAYOUT_7POINT1 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1)
416 #define AV_CHANNEL_LAYOUT_7POINT1_WIDE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE)
417 #define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK)
418 #define AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_5POINT1POINT2_BACK)
419 #define AV_CHANNEL_LAYOUT_OCTAGONAL AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)
420 #define AV_CHANNEL_LAYOUT_CUBE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_CUBE)
421 #define AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_5POINT1POINT4_BACK)
422 #define AV_CHANNEL_LAYOUT_7POINT1POINT2 AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_7POINT1POINT2)
423 #define AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT1POINT4_BACK)
424 #define AV_CHANNEL_LAYOUT_7POINT2POINT3 AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT2POINT3)
425 #define AV_CHANNEL_LAYOUT_9POINT1POINT4_BACK AV_CHANNEL_LAYOUT_MASK(14, AV_CH_LAYOUT_9POINT1POINT4_BACK)
426 #define AV_CHANNEL_LAYOUT_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)
427 #define AV_CHANNEL_LAYOUT_BINAURAL AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_BINAURAL)
428 #define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX)
429 #define AV_CHANNEL_LAYOUT_22POINT2 AV_CHANNEL_LAYOUT_MASK(24, AV_CH_LAYOUT_22POINT2)
430 
431 #define AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK
432 
433 #define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER \
434  { /* .order */ AV_CHANNEL_ORDER_AMBISONIC, \
435  /* .nb_channels */ 4, \
436  /* .u.mask */ { 0 }, \
437  /* .opaque */ NULL }
438 /** @} */
439 
440 struct AVBPrint;
441 
442 /**
443  * Get a human readable string in an abbreviated form describing a given channel.
444  * This is the inverse function of @ref av_channel_from_string().
445  *
446  * @param buf pre-allocated buffer where to put the generated string
447  * @param buf_size size in bytes of the buffer.
448  * @param channel the AVChannel whose name to get
449  * @return amount of bytes needed to hold the output string, or a negative AVERROR
450  * on failure. If the returned value is bigger than buf_size, then the
451  * string was truncated.
452  */
453 int av_channel_name(char *buf, size_t buf_size, enum AVChannel channel);
454 
455 /**
456  * bprint variant of av_channel_name().
457  *
458  * @note the string will be appended to the bprint buffer.
459  */
460 void av_channel_name_bprint(struct AVBPrint *bp, enum AVChannel channel_id);
461 
462 /**
463  * Get a human readable string describing a given channel.
464  *
465  * @param buf pre-allocated buffer where to put the generated string
466  * @param buf_size size in bytes of the buffer.
467  * @param channel the AVChannel whose description to get
468  * @return amount of bytes needed to hold the output string, or a negative AVERROR
469  * on failure. If the returned value is bigger than buf_size, then the
470  * string was truncated.
471  */
472 int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel);
473 
474 /**
475  * bprint variant of av_channel_description().
476  *
477  * @note the string will be appended to the bprint buffer.
478  */
479 void av_channel_description_bprint(struct AVBPrint *bp, enum AVChannel channel_id);
480 
481 /**
482  * This is the inverse function of @ref av_channel_name().
483  *
484  * @return the channel with the given name
485  * AV_CHAN_NONE when name does not identify a known channel
486  */
487 enum AVChannel av_channel_from_string(const char *name);
488 
489 /**
490  * Initialize a custom channel layout with the specified number of channels.
491  * The channel map will be allocated and the designation of all channels will
492  * be set to AV_CHAN_UNKNOWN.
493  *
494  * This is only a convenience helper function, a custom channel layout can also
495  * be constructed without using this.
496  *
497  * @param channel_layout the layout structure to be initialized
498  * @param nb_channels the number of channels
499  *
500  * @return 0 on success
501  * AVERROR(EINVAL) if the number of channels <= 0
502  * AVERROR(ENOMEM) if the channel map could not be allocated
503  */
504 int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels);
505 
506 /**
507  * Initialize a native channel layout from a bitmask indicating which channels
508  * are present.
509  *
510  * @param channel_layout the layout structure to be initialized
511  * @param mask bitmask describing the channel layout
512  *
513  * @return 0 on success
514  * AVERROR(EINVAL) for invalid mask values
515  */
516 int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask);
517 
518 /**
519  * Initialize a channel layout from a given string description.
520  * The input string can be represented by:
521  * - the formal channel layout name (returned by av_channel_layout_describe())
522  * - single or multiple channel names (returned by av_channel_name(), eg. "FL",
523  * or concatenated with "+", each optionally containing a custom name after
524  * a "@", eg. "FL@Left+FR@Right+LFE")
525  * - a decimal or hexadecimal value of a native channel layout (eg. "4" or "0x4")
526  * - the number of channels with default layout (eg. "4c")
527  * - the number of unordered channels (eg. "4C" or "4 channels")
528  * - the ambisonic order followed by optional non-diegetic channels (eg.
529  * "ambisonic 2+stereo")
530  * On error, the channel layout will remain uninitialized, but not necessarily
531  * untouched.
532  *
533  * @param channel_layout uninitialized channel layout for the result
534  * @param str string describing the channel layout
535  * @return 0 on success parsing the channel layout
536  * AVERROR(EINVAL) if an invalid channel layout string was provided
537  * AVERROR(ENOMEM) if there was not enough memory
538  */
540  const char *str);
541 
542 /**
543  * Get the default channel layout for a given number of channels.
544  *
545  * @param ch_layout the layout structure to be initialized
546  * @param nb_channels number of channels
547  */
548 void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels);
549 
550 /**
551  * Iterate over all standard channel layouts.
552  *
553  * @param opaque a pointer where libavutil will store the iteration state. Must
554  * point to NULL to start the iteration.
555  *
556  * @return the standard channel layout or NULL when the iteration is
557  * finished
558  */
559 const AVChannelLayout *av_channel_layout_standard(void **opaque);
560 
561 /**
562  * Free any allocated data in the channel layout and reset the channel
563  * count to 0.
564  *
565  * @param channel_layout the layout structure to be uninitialized
566  */
567 void av_channel_layout_uninit(AVChannelLayout *channel_layout);
568 
569 /**
570  * Make a copy of a channel layout. This differs from just assigning src to dst
571  * in that it allocates and copies the map for AV_CHANNEL_ORDER_CUSTOM.
572  *
573  * @note the destination channel_layout will be always uninitialized before copy.
574  *
575  * @param dst destination channel layout
576  * @param src source channel layout
577  * @return 0 on success, a negative AVERROR on error.
578  */
580 
581 /**
582  * Get a human-readable string describing the channel layout properties.
583  * The string will be in the same format that is accepted by
584  * @ref av_channel_layout_from_string(), allowing to rebuild the same
585  * channel layout, except for opaque pointers.
586  *
587  * @param channel_layout channel layout to be described
588  * @param buf pre-allocated buffer where to put the generated string
589  * @param buf_size size in bytes of the buffer.
590  * @return amount of bytes needed to hold the output string, or a negative AVERROR
591  * on failure. If the returned value is bigger than buf_size, then the
592  * string was truncated.
593  */
594 int av_channel_layout_describe(const AVChannelLayout *channel_layout,
595  char *buf, size_t buf_size);
596 
597 /**
598  * bprint variant of av_channel_layout_describe().
599  *
600  * @note the string will be appended to the bprint buffer.
601  * @return 0 on success, or a negative AVERROR value on failure.
602  */
603 int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout,
604  struct AVBPrint *bp);
605 
606 /**
607  * Get the channel with the given index in a channel layout.
608  *
609  * @param channel_layout input channel layout
610  * @param idx index of the channel
611  * @return channel with the index idx in channel_layout on success or
612  * AV_CHAN_NONE on failure (if idx is not valid or the channel order is
613  * unspecified)
614  */
615 enum AVChannel
616 av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx);
617 
618 /**
619  * Get the index of a given channel in a channel layout. In case multiple
620  * channels are found, only the first match will be returned.
621  *
622  * @param channel_layout input channel layout
623  * @param channel the channel whose index to obtain
624  * @return index of channel in channel_layout on success or a negative number if
625  * channel is not present in channel_layout.
626  */
627 int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout,
628  enum AVChannel channel);
629 
630 /**
631  * Get the index in a channel layout of a channel described by the given string.
632  * In case multiple channels are found, only the first match will be returned.
633  *
634  * This function accepts channel names in the same format as
635  * @ref av_channel_from_string().
636  *
637  * @param channel_layout input channel layout
638  * @param name string describing the channel whose index to obtain
639  * @return a channel index described by the given string, or a negative AVERROR
640  * value.
641  */
642 int av_channel_layout_index_from_string(const AVChannelLayout *channel_layout,
643  const char *name);
644 
645 /**
646  * Get a channel described by the given string.
647  *
648  * This function accepts channel names in the same format as
649  * @ref av_channel_from_string().
650  *
651  * @param channel_layout input channel layout
652  * @param name string describing the channel to obtain
653  * @return a channel described by the given string in channel_layout on success
654  * or AV_CHAN_NONE on failure (if the string is not valid or the channel
655  * order is unspecified)
656  */
657 enum AVChannel
659  const char *name);
660 
661 /**
662  * Find out what channels from a given set are present in a channel layout,
663  * without regard for their positions.
664  *
665  * @param channel_layout input channel layout
666  * @param mask a combination of AV_CH_* representing a set of channels
667  * @return a bitfield representing all the channels from mask that are present
668  * in channel_layout
669  */
670 uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout,
671  uint64_t mask);
672 
673 /**
674  * Check whether a channel layout is valid, i.e. can possibly describe audio
675  * data.
676  *
677  * @param channel_layout input channel layout
678  * @return 1 if channel_layout is valid, 0 otherwise.
679  */
680 int av_channel_layout_check(const AVChannelLayout *channel_layout);
681 
682 /**
683  * Check whether two channel layouts are semantically the same, i.e. the same
684  * channels are present on the same positions in both.
685  *
686  * If one of the channel layouts is AV_CHANNEL_ORDER_UNSPEC, while the other is
687  * not, they are considered to be unequal. If both are AV_CHANNEL_ORDER_UNSPEC,
688  * they are considered equal iff the channel counts are the same in both.
689  *
690  * @param chl input channel layout
691  * @param chl1 input channel layout
692  * @return 0 if chl and chl1 are equal, 1 if they are not equal. A negative
693  * AVERROR code if one or both are invalid.
694  */
695 int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1);
696 
697 /**
698  * Return the order if the layout is n-th order standard-order ambisonic.
699  * The presence of optional extra non-diegetic channels at the end is not taken
700  * into account.
701  *
702  * @param channel_layout input channel layout
703  * @return the order of the layout, a negative error code otherwise.
704  */
705 int av_channel_layout_ambisonic_order(const AVChannelLayout *channel_layout);
706 
707 /**
708  * The conversion must be lossless.
709  */
710 #define AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS (1 << 0)
711 
712 /**
713  * The specified retype target order is ignored and the simplest possible
714  * (canonical) order is used for which the input layout can be losslessy
715  * represented.
716  */
717 #define AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL (1 << 1)
718 
719 /**
720  * Change the AVChannelOrder of a channel layout.
721  *
722  * Change of AVChannelOrder can be either lossless or lossy. In case of a
723  * lossless conversion all the channel designations and the associated channel
724  * names (if any) are kept. On a lossy conversion the channel names and channel
725  * designations might be lost depending on the capabilities of the desired
726  * AVChannelOrder. Note that some conversions are simply not possible in which
727  * case this function returns AVERROR(ENOSYS).
728  *
729  * The following conversions are supported:
730  *
731  * Any -> Custom : Always possible, always lossless.
732  * Any -> Unspecified: Always possible, lossless if channel designations
733  * are all unknown and channel names are not used, lossy otherwise.
734  * Custom -> Ambisonic : Possible if it contains ambisonic channels with
735  * optional non-diegetic channels in the end. Lossy if the channels have
736  * custom names, lossless otherwise.
737  * Custom -> Native : Possible if it contains native channels in native
738  * order. Lossy if the channels have custom names, lossless otherwise.
739  *
740  * On error this function keeps the original channel layout untouched.
741  *
742  * @param channel_layout channel layout which will be changed
743  * @param order the desired channel layout order
744  * @param flags a combination of AV_CHANNEL_LAYOUT_RETYPE_FLAG_* constants
745  * @return 0 if the conversion was successful and lossless or if the channel
746  * layout was already in the desired order
747  * >0 if the conversion was successful but lossy
748  * AVERROR(ENOSYS) if the conversion was not possible (or would be
749  * lossy and AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS was specified)
750  * AVERROR(EINVAL), AVERROR(ENOMEM) on error
751  */
752 int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags);
753 
754 /**
755  * @}
756  */
757 
758 #endif /* AVUTIL_CHANNEL_LAYOUT_H */
AVChannelOrder
AVChannelOrder
Definition: channel_layout.h:114
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
FF_CHANNEL_ORDER_NB
@ FF_CHANNEL_ORDER_NB
Number of channel orders, not part of ABI/API.
Definition: channel_layout.h:159
AV_CHAN_BINAURAL_RIGHT
@ AV_CHAN_BINAURAL_RIGHT
Definition: channel_layout.h:88
AV_CHAN_WIDE_LEFT
@ AV_CHAN_WIDE_LEFT
Definition: channel_layout.h:72
AVChannelLayout::map
AVChannelCustom * map
This member must be used when the channel order is AV_CHANNEL_ORDER_CUSTOM.
Definition: channel_layout.h:368
mask
int mask
Definition: mediacodecdec_common.c:154
AV_CHAN_TOP_SURROUND_LEFT
@ AV_CHAN_TOP_SURROUND_LEFT
+110 degrees, Lvs, TpLS
Definition: channel_layout.h:84
av_channel_layout_ambisonic_order
int av_channel_layout_ambisonic_order(const AVChannelLayout *channel_layout)
Return the order if the layout is n-th order standard-order ambisonic.
Definition: channel_layout.c:483
av_channel_layout_channel_from_index
enum AVChannel av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx)
Get the channel with the given index in a channel layout.
Definition: channel_layout.c:671
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:322
AVChannelLayout::mask
uint64_t mask
This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used for AV_CHANNEL_ORDER_AMBISONIC ...
Definition: channel_layout.h:349
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:327
av_channel_layout_describe_bprint
int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, struct AVBPrint *bp)
bprint variant of av_channel_layout_describe().
Definition: channel_layout.c:597
AV_CHAN_SURROUND_DIRECT_LEFT
@ AV_CHAN_SURROUND_DIRECT_LEFT
Definition: channel_layout.h:74
av_channel_description_bprint
void av_channel_description_bprint(struct AVBPrint *bp, enum AVChannel channel_id)
bprint variant of av_channel_description().
Definition: channel_layout.c:119
AV_CHAN_TOP_BACK_RIGHT
@ AV_CHAN_TOP_BACK_RIGHT
Definition: channel_layout.h:67
AV_CHAN_STEREO_RIGHT
@ AV_CHAN_STEREO_RIGHT
See above.
Definition: channel_layout.h:71
AV_CHAN_BOTTOM_FRONT_LEFT
@ AV_CHAN_BOTTOM_FRONT_LEFT
Definition: channel_layout.h:80
AV_MATRIX_ENCODING_DOLBY
@ AV_MATRIX_ENCODING_DOLBY
Definition: channel_layout.h:260
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:651
AVChannelCustom
An AVChannelCustom defines a single channel within a custom order layout.
Definition: channel_layout.h:281
AV_MATRIX_ENCODING_NB
@ AV_MATRIX_ENCODING_NB
Definition: channel_layout.h:266
AV_CHAN_UNKNOWN
@ AV_CHAN_UNKNOWN
Channel contains data, but its position is unknown.
Definition: channel_layout.h:94
AVChannelLayout::u
union AVChannelLayout::@428 u
Details about which channels are present in this layout.
AV_CHANNEL_ORDER_UNSPEC
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
Definition: channel_layout.h:119
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:250
AV_CHAN_SIDE_RIGHT
@ AV_CHAN_SIDE_RIGHT
Definition: channel_layout.h:60
av_channel_layout_index_from_string
int av_channel_layout_index_from_string(const AVChannelLayout *channel_layout, const char *name)
Get the index in a channel layout of a channel described by the given string.
Definition: channel_layout.c:745
av_channel_layout_standard
const AVChannelLayout * av_channel_layout_standard(void **opaque)
Iterate over all standard channel layouts.
Definition: channel_layout.c:850
AV_MATRIX_ENCODING_DPLIIX
@ AV_MATRIX_ENCODING_DPLIIX
Definition: channel_layout.h:262
AV_CHAN_TOP_SIDE_LEFT
@ AV_CHAN_TOP_SIDE_LEFT
Definition: channel_layout.h:77
AV_CHAN_TOP_SIDE_RIGHT
@ AV_CHAN_TOP_SIDE_RIGHT
Definition: channel_layout.h:78
AVMatrixEncoding
AVMatrixEncoding
Definition: channel_layout.h:258
AV_CHAN_SIDE_SURROUND_LEFT
@ AV_CHAN_SIDE_SURROUND_LEFT
+90 degrees, Lss, SiL
Definition: channel_layout.h:82
AV_MATRIX_ENCODING_DOLBYHEADPHONE
@ AV_MATRIX_ENCODING_DOLBYHEADPHONE
Definition: channel_layout.h:265
AV_CHANNEL_ORDER_AMBISONIC
@ AV_CHANNEL_ORDER_AMBISONIC
The audio is represented as the decomposition of the sound field into spherical harmonics.
Definition: channel_layout.h:155
AV_CHAN_TOP_BACK_CENTER
@ AV_CHAN_TOP_BACK_CENTER
Definition: channel_layout.h:66
AV_CHAN_BOTTOM_FRONT_RIGHT
@ AV_CHAN_BOTTOM_FRONT_RIGHT
Definition: channel_layout.h:81
AV_CHAN_TOP_CENTER
@ AV_CHAN_TOP_CENTER
Definition: channel_layout.h:61
AV_CHAN_FRONT_RIGHT_OF_CENTER
@ AV_CHAN_FRONT_RIGHT_OF_CENTER
Definition: channel_layout.h:57
AV_CHAN_FRONT_RIGHT
@ AV_CHAN_FRONT_RIGHT
Definition: channel_layout.h:51
AV_CHAN_FRONT_CENTER
@ AV_CHAN_FRONT_CENTER
Definition: channel_layout.h:52
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:317
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
AV_MATRIX_ENCODING_NONE
@ AV_MATRIX_ENCODING_NONE
Definition: channel_layout.h:259
AV_CHAN_LOW_FREQUENCY
@ AV_CHAN_LOW_FREQUENCY
Definition: channel_layout.h:53
AV_CHAN_BACK_RIGHT
@ AV_CHAN_BACK_RIGHT
Definition: channel_layout.h:55
AV_CHAN_SIDE_LEFT
@ AV_CHAN_SIDE_LEFT
Definition: channel_layout.h:59
AV_CHAN_AMBISONIC_END
@ AV_CHAN_AMBISONIC_END
Definition: channel_layout.h:111
av_channel_description
int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel)
Get a human readable string describing a given channel.
Definition: channel_layout.c:137
av_channel_layout_retype
int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags)
Change the AVChannelOrder of a channel layout.
Definition: channel_layout.c:883
AV_CHAN_TOP_FRONT_RIGHT
@ AV_CHAN_TOP_FRONT_RIGHT
Definition: channel_layout.h:64
attributes.h
AV_CHANNEL_ORDER_NATIVE
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
Definition: channel_layout.h:125
AV_CHAN_FRONT_LEFT_OF_CENTER
@ AV_CHAN_FRONT_LEFT_OF_CENTER
Definition: channel_layout.h:56
AV_CHAN_UNUSED
@ AV_CHAN_UNUSED
Channel is empty can be safely skipped.
Definition: channel_layout.h:91
av_channel_layout_compare
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
Definition: channel_layout.c:807
av_channel_layout_custom_init
int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels)
Initialize a custom channel layout with the specified number of channels.
Definition: channel_layout.c:230
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:837
AVChannel
AVChannel
Definition: channel_layout.h:47
AV_CHAN_TOP_SURROUND_RIGHT
@ AV_CHAN_TOP_SURROUND_RIGHT
-110 degrees, Rvs, TpRS
Definition: channel_layout.h:85
av_channel_layout_from_string
int av_channel_layout_from_string(AVChannelLayout *channel_layout, const char *str)
Initialize a channel layout from a given string description.
Definition: channel_layout.c:310
AV_CHAN_SURROUND_DIRECT_RIGHT
@ AV_CHAN_SURROUND_DIRECT_RIGHT
Definition: channel_layout.h:75
av_channel_name
int av_channel_name(char *buf, size_t buf_size, enum AVChannel channel)
Get a human readable string in an abbreviated form describing a given channel.
Definition: channel_layout.c:104
AVChannelCustom::name
char name[16]
Definition: channel_layout.h:283
AV_CHAN_STEREO_LEFT
@ AV_CHAN_STEREO_LEFT
Stereo downmix.
Definition: channel_layout.h:69
version.h
av_channel_layout_check
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
Definition: channel_layout.c:781
AV_CHAN_BACK_CENTER
@ AV_CHAN_BACK_CENTER
Definition: channel_layout.h:58
av_channel_from_string
enum AVChannel av_channel_from_string(const char *name)
This is the inverse function of av_channel_name().
Definition: channel_layout.c:152
AV_CHAN_BINAURAL_LEFT
@ AV_CHAN_BINAURAL_LEFT
Definition: channel_layout.h:87
AV_CHAN_NONE
@ AV_CHAN_NONE
Invalid channel index.
Definition: channel_layout.h:49
AVChannelCustom::opaque
void * opaque
Definition: channel_layout.h:284
AV_CHANNEL_ORDER_CUSTOM
@ AV_CHANNEL_ORDER_CUSTOM
The channel order does not correspond to any other predefined order and is stored as an explicit map.
Definition: channel_layout.h:132
AVChannelLayout::opaque
void * opaque
For some private data of the user.
Definition: channel_layout.h:374
AV_CHAN_LOW_FREQUENCY_2
@ AV_CHAN_LOW_FREQUENCY_2
Definition: channel_layout.h:76
av_channel_layout_subset
uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout, uint64_t mask)
Find out what channels from a given set are present in a channel layout, without regard for their pos...
Definition: channel_layout.c:863
AV_CHAN_TOP_BACK_LEFT
@ AV_CHAN_TOP_BACK_LEFT
Definition: channel_layout.h:65
AV_MATRIX_ENCODING_DOLBYEX
@ AV_MATRIX_ENCODING_DOLBYEX
Definition: channel_layout.h:264
av_channel_layout_channel_from_string
enum AVChannel av_channel_layout_channel_from_string(const AVChannelLayout *channel_layout, const char *name)
Get a channel described by the given string.
Definition: channel_layout.c:700
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:711
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:440
AV_CHAN_BACK_LEFT
@ AV_CHAN_BACK_LEFT
Definition: channel_layout.h:54
AV_CHAN_BOTTOM_FRONT_CENTER
@ AV_CHAN_BOTTOM_FRONT_CENTER
Definition: channel_layout.h:79
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:447
AV_CHAN_TOP_FRONT_CENTER
@ AV_CHAN_TOP_FRONT_CENTER
Definition: channel_layout.h:63
AV_CHAN_SIDE_SURROUND_RIGHT
@ AV_CHAN_SIDE_SURROUND_RIGHT
-90 degrees, Rss, SiR
Definition: channel_layout.h:83
AV_CHAN_WIDE_RIGHT
@ AV_CHAN_WIDE_RIGHT
Definition: channel_layout.h:73
AV_CHAN_TOP_FRONT_LEFT
@ AV_CHAN_TOP_FRONT_LEFT
Definition: channel_layout.h:62
AV_MATRIX_ENCODING_DPLIIZ
@ AV_MATRIX_ENCODING_DPLIIZ
Definition: channel_layout.h:263
AV_CHAN_AMBISONIC_BASE
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
Definition: channel_layout.h:108
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
AV_CHAN_FRONT_LEFT
@ AV_CHAN_FRONT_LEFT
Definition: channel_layout.h:50
av_channel_name_bprint
void av_channel_name_bprint(struct AVBPrint *bp, enum AVChannel channel_id)
bprint variant of av_channel_name().
Definition: channel_layout.c:86
AVChannelCustom::id
enum AVChannel id
Definition: channel_layout.h:282
src
#define src
Definition: vp8dsp.c:248
channel
channel
Definition: ebur128.h:39
AV_MATRIX_ENCODING_DPLII
@ AV_MATRIX_ENCODING_DPLII
Definition: channel_layout.h:261