FFmpeg
mov_chan.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Justin Ruggles
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  * mov 'chan' tag reading/writing.
23  * @author Justin Ruggles
24  */
25 
26 #include <stdint.h>
27 
28 #include "libavutil/avassert.h"
30 #include "libavcodec/codec_id.h"
31 #include "mov_chan.h"
32 
33 enum {
50  // = AV_CHAN_TOP_BACK_CENTER,
59  // = AV_CHAN_TOP_SIDE_LEFT,
60  // = AV_CHAN_TOP_SIDE_RIGHT,
61  // = AV_CHAN_BOTTOM_FRONT_CENTER,
62  // = AV_CHAN_BOTTOM_FRONT_LEFT,
63  // = AV_CHAN_BOTTOM_FRONT_RIGHT,
68  /* The following have no exact counterparts */
74 };
75 
77  union {
78  uint32_t tag;
79  enum AVChannel id;
80  };
81 };
82 
83 #define TAG(_0) {.tag = _0}
84 #define ID(_0) {.id = c_##_0}
85 #define CHLIST(_0, ...) TAG(_0), __VA_ARGS__
86 #define CHLIST01(_0, _1) CHLIST(_0, ID(_1))
87 #define CHLIST02(_0, _1, _2) CHLIST(_0, ID(_1), ID(_2))
88 #define CHLIST03(_0, _1, _2, _3) CHLIST(_0, ID(_1), ID(_2), ID(_3))
89 #define CHLIST04(_0, _1, _2, _3, _4) CHLIST(_0, ID(_1), ID(_2), ID(_3), ID(_4))
90 #define CHLIST05(_0, _1, _2, _3, _4, _5) CHLIST(_0, ID(_1), ID(_2), ID(_3), ID(_4), ID(_5))
91 #define CHLIST06(_0, _1, _2, _3, _4, _5, _6) CHLIST(_0, ID(_1), ID(_2), ID(_3), ID(_4), ID(_5), ID(_6))
92 #define CHLIST07(_0, _1, _2, _3, _4, _5, _6, _7) CHLIST(_0, ID(_1), ID(_2), ID(_3), ID(_4), ID(_5), ID(_6), ID(_7))
93 #define CHLIST08(_0, _1, _2, _3, _4, _5, _6, _7, _8) CHLIST(_0, ID(_1), ID(_2), ID(_3), ID(_4), ID(_5), ID(_6), ID(_7), ID(_8))
94 #define CHLIST09(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) CHLIST(_0, ID(_1), ID(_2), ID(_3), ID(_4), ID(_5), ID(_6), ID(_7), ID(_8), ID(_9))
95 #define CHLIST16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \
96  CHLIST(_0, ID(_1), ID(_2), ID(_3), ID(_4), ID(_5), ID(_6), ID(_7), ID(_8), ID(_9), ID(_10), \
97  ID(_11), ID(_12), ID(_13), ID(_14), ID(_15), ID(_16))
98 #define CHLIST21(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21) \
99  CHLIST(_0, ID(_1), ID(_2), ID(_3), ID(_4), ID(_5), ID(_6), ID(_7), ID(_8), ID(_9), ID(_10), \
100  ID(_11), ID(_12), ID(_13), ID(_14), ID(_15), ID(_16), ID(_17), ID(_18), ID(_19), ID(_20), ID(_21))
101 
102 static const struct MovChannelLayoutMap mov_ch_layout_map[] = {
107  CHLIST02( MOV_CH_LAYOUT_MIDSIDE, L, R ), //C, sides
108  CHLIST02( MOV_CH_LAYOUT_XY, L, R ), //X (left ), Y (right )
115  CHLIST03( MOV_CH_LAYOUT_DVD_4, L, R, LFE ),
117  CHLIST04( MOV_CH_LAYOUT_QUADRAPHONIC, L, R, Rls, Rrs ),
120  CHLIST04( MOV_CH_LAYOUT_AC3_3_1, L, C, R, Cs ),
121  CHLIST04( MOV_CH_LAYOUT_ITU_2_2, L, R, Ls, Rs ),
122  CHLIST04( MOV_CH_LAYOUT_DVD_5, L, R, LFE, Cs ),
123  CHLIST04( MOV_CH_LAYOUT_AC3_2_1_1, L, R, Cs, LFE ),
124  CHLIST04( MOV_CH_LAYOUT_DVD_10, L, R, C, LFE ),
125  CHLIST04( MOV_CH_LAYOUT_AC3_3_0_1, L, C, R, LFE ),
126  CHLIST04( MOV_CH_LAYOUT_DTS_3_1, C, L, R, LFE ),
127  CHLIST05( MOV_CH_LAYOUT_PENTAGONAL, L, R, Rls, Rrs, C ),
128  CHLIST05( MOV_CH_LAYOUT_MPEG_5_0_A, L, R, C, Ls, Rs ),
129  CHLIST05( MOV_CH_LAYOUT_MPEG_5_0_B, L, R, Ls, Rs, C ),
130  CHLIST05( MOV_CH_LAYOUT_MPEG_5_0_C, L, C, R, Ls, Rs ),
131  CHLIST05( MOV_CH_LAYOUT_MPEG_5_0_D, C, L, R, Ls, Rs ),
132  CHLIST05( MOV_CH_LAYOUT_DVD_6, L, R, LFE, Ls, Rs ),
133  CHLIST05( MOV_CH_LAYOUT_DVD_18, L, R, Ls, Rs, LFE ),
134  CHLIST05( MOV_CH_LAYOUT_DVD_11, L, R, C, LFE, Cs ),
135  CHLIST05( MOV_CH_LAYOUT_AC3_3_1_1, L, C, R, Cs, LFE ),
136  CHLIST05( MOV_CH_LAYOUT_DTS_4_1, C, L, R, Cs, LFE ),
137  CHLIST06( MOV_CH_LAYOUT_HEXAGONAL, L, R, Rls, Rrs, C, Cs ),
138  CHLIST06( MOV_CH_LAYOUT_DTS_6_0_C, C, Cs, L, R, Rls, Rrs ),
139  CHLIST06( MOV_CH_LAYOUT_MPEG_5_1_A, L, R, C, LFE, Ls, Rs ),
140  CHLIST06( MOV_CH_LAYOUT_MPEG_5_1_B, L, R, Ls, Rs, C, LFE ),
141  CHLIST06( MOV_CH_LAYOUT_MPEG_5_1_C, L, C, R, Ls, Rs, LFE ),
142  CHLIST06( MOV_CH_LAYOUT_MPEG_5_1_D, C, L, R, Ls, Rs, LFE ),
143  CHLIST06( MOV_CH_LAYOUT_AUDIOUNIT_6_0, L, R, Ls, Rs, C, Cs ),
144  CHLIST06( MOV_CH_LAYOUT_AAC_6_0, C, L, R, Ls, Rs, Cs ),
145  CHLIST06( MOV_CH_LAYOUT_EAC3_6_0_A, L, C, R, Ls, Rs, Cs ),
146  CHLIST06( MOV_CH_LAYOUT_DTS_6_0_A, Lc, Rc, L, R, Ls, Rs ),
147  CHLIST06( MOV_CH_LAYOUT_DTS_6_0_B, C, L, R, Rls, Rrs, Ts ),
148  CHLIST07( MOV_CH_LAYOUT_MPEG_6_1_A, L, R, C, LFE, Ls, Rs, Cs ),
149  CHLIST07( MOV_CH_LAYOUT_AAC_6_1, C, L, R, Ls, Rs, Cs, LFE ),
150  CHLIST07( MOV_CH_LAYOUT_EAC3_6_1_A, L, C, R, Ls, Rs, LFE, Cs ),
151  CHLIST07( MOV_CH_LAYOUT_DTS_6_1_D, C, L, R, Ls, Rs, LFE, Cs ),
152  CHLIST07( MOV_CH_LAYOUT_AUDIOUNIT_7_0, L, R, Ls, Rs, C, Rls, Rrs ),
153  CHLIST07( MOV_CH_LAYOUT_AAC_7_0, C, L, R, Ls, Rs, Rls, Rrs ),
154  CHLIST07( MOV_CH_LAYOUT_EAC3_7_0_A, L, C, R, Ls, Rs, Rls, Rrs ),
155  CHLIST07( MOV_CH_LAYOUT_AUDIOUNIT_7_0_FRONT, L, R, Ls, Rs, C, Lc, Rc ),
156  CHLIST07( MOV_CH_LAYOUT_DTS_7_0, Lc, C, Rc, L, R, Ls, Rs ),
157  CHLIST07( MOV_CH_LAYOUT_EAC3_6_1_B, L, C, R, Ls, Rs, LFE, Ts ),
158  CHLIST07( MOV_CH_LAYOUT_EAC3_6_1_C, L, C, R, Ls, Rs, LFE, Vhc ),
159  CHLIST07( MOV_CH_LAYOUT_DTS_6_1_A, Lc, Rc, L, R, Ls, Rs, LFE ),
160  CHLIST07( MOV_CH_LAYOUT_DTS_6_1_B, C, L, R, Rls, Rrs, Ts, LFE ),
161  CHLIST07( MOV_CH_LAYOUT_DTS_6_1_C, C, Cs, L, R, Rls, Rrs, LFE ),
162  CHLIST08( MOV_CH_LAYOUT_OCTAGONAL, L, R, Rls, Rrs, C, Cs, Ls, Rs ),
163  CHLIST08( MOV_CH_LAYOUT_AAC_OCTAGONAL, C, L, R, Ls, Rs, Rls, Rrs, Cs ),
164  CHLIST08( MOV_CH_LAYOUT_CUBE, L, R, Rls, Rrs, Vhl, Vhr, Rlt, Rrt ),
165  CHLIST08( MOV_CH_LAYOUT_MPEG_7_1_A, L, R, C, LFE, Ls, Rs, Lc, Rc ),
166  CHLIST08( MOV_CH_LAYOUT_MPEG_7_1_B, C, Lc, Rc, L, R, Ls, Rs, LFE ),
167  CHLIST08( MOV_CH_LAYOUT_EMAGIC_DEFAULT_7_1, L, R, Ls, Rs, C, LFE, Lc, Rc ),
168  CHLIST08( MOV_CH_LAYOUT_EAC3_7_1_B, L, C, R, Ls, Rs, LFE, Lc, Rc ),
169  CHLIST08( MOV_CH_LAYOUT_DTS_7_1, Lc, C, Rc, L, R, Ls, Rs, LFE ),
170  CHLIST08( MOV_CH_LAYOUT_MPEG_7_1_C, L, R, C, LFE, Ls, Rs, Rls, Rrs ),
171  CHLIST08( MOV_CH_LAYOUT_EAC3_7_1_A, L, C, R, Ls, Rs, LFE, Rls, Rrs ),
172  CHLIST08( MOV_CH_LAYOUT_SMPTE_DTV, L, R, C, LFE, Ls, Rs, Lt, Rt ),
173  CHLIST08( MOV_CH_LAYOUT_EAC3_7_1_C, L, C, R, Ls, Rs, LFE, Lsd, Rsd ),
174  CHLIST08( MOV_CH_LAYOUT_EAC3_7_1_D, L, C, R, Ls, Rs, LFE, Lw, Rw ),
175  CHLIST08( MOV_CH_LAYOUT_EAC3_7_1_E, L, C, R, Ls, Rs, LFE, Vhl, Vhr ),
176  CHLIST08( MOV_CH_LAYOUT_EAC3_7_1_F, L, C, R, Ls, Rs, LFE, Cs, Ts ),
177  CHLIST08( MOV_CH_LAYOUT_EAC3_7_1_G, L, C, R, Ls, Rs, LFE, Cs, Vhc ),
178  CHLIST08( MOV_CH_LAYOUT_EAC3_7_1_H, L, C, R, Ls, Rs, LFE, Ts, Vhc ),
179  CHLIST08( MOV_CH_LAYOUT_DTS_8_0_A, Lc, Rc, L, R, Ls, Rs, Rls, Rrs ),
180  CHLIST08( MOV_CH_LAYOUT_DTS_8_0_B, Lc, C, Rc, L, R, Ls, Cs, Rs ),
181  CHLIST09( MOV_CH_LAYOUT_DTS_8_1_A, Lc, Rc, L, R, Ls, Rs, Rls, Rrs, LFE ),
182  CHLIST09( MOV_CH_LAYOUT_DTS_8_1_B, Lc, C, Rc, L, R, Ls, Cs, Rs, LFE ),
183  CHLIST16( MOV_CH_LAYOUT_TMH_10_2_STD, L, R, C, Vhc, Lsd, Rsd, Ls, Rs, Vhl, Vhr, Lw, Rw, Csd, Cs, LFE1, LFE2),
184  CHLIST21( MOV_CH_LAYOUT_TMH_10_2_FULL, L, R, C, Vhc, Lsd, Rsd, Ls, Rs, Vhl, Vhr, Lw, Rw, Csd, Cs, LFE1, LFE2, Lc, Rc, HI, VI, Haptic),
185 };
186 
211  0,
212 };
213 
229  0,
230 };
231 
241  0,
242 };
243 
256  0,
257 };
258 
259 static const struct {
262 } mov_codec_ch_layouts[] = {
278  { AV_CODEC_ID_NONE, NULL },
279 };
280 
281 static const struct MovChannelLayoutMap* find_layout_map(uint32_t tag)
282 {
283 #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1
284  {
285  int i;
286  for (i = 0; i < FF_ARRAY_ELEMS(mov_ch_layout_map); i += 1 + (mov_ch_layout_map[i].tag & 0xffff))
287  av_assert2(mov_ch_layout_map[i].tag & 0xffff0000);
289  }
290 #endif
291  for (int i = 0; i < FF_ARRAY_ELEMS(mov_ch_layout_map); i += 1 + (mov_ch_layout_map[i].tag & 0xffff))
292  if (mov_ch_layout_map[i].tag == tag)
293  return &mov_ch_layout_map[i + 1];
294  return NULL;
295 }
296 
297 /**
298  * Get the channel layout for the specified non-special channel layout tag if
299  * known.
300  *
301  * @param[in,out] ch_layout channel layout
302  * @param[in] tag channel layout tag
303  * @return <0 on error
304  */
305 static int mov_get_channel_layout(AVChannelLayout *ch_layout, uint32_t tag)
306 {
307  int i, channels;
308  const struct MovChannelLayoutMap *layout_map;
309 
310  channels = tag & 0xFFFF;
311 
312  /* find the channel layout for the specified layout tag */
313  layout_map = find_layout_map(tag);
314  if (layout_map) {
315  int ret;
316  av_channel_layout_uninit(ch_layout);
318  if (ret < 0)
319  return ret;
320  for (i = 0; i < channels; i++) {
321  enum AVChannel id = layout_map[i].id;
322  ch_layout->u.map[i].id = (id != AV_CHAN_NONE ? id : AV_CHAN_UNKNOWN);
323  }
325  }
326  return 0;
327 }
328 
329 static enum AVChannel mov_get_channel_id(uint32_t label)
330 {
331  if (label == 0)
332  return AV_CHAN_UNUSED;
333  if (label <= 18)
334  return (label - 1);
335  if (label == 35)
336  return AV_CHAN_WIDE_LEFT;
337  if (label == 36)
338  return AV_CHAN_WIDE_RIGHT;
339  if (label == 37)
341  if (label == 38)
342  return AV_CHAN_STEREO_LEFT;
343  if (label == 39)
344  return AV_CHAN_STEREO_RIGHT;
345  return AV_CHAN_UNKNOWN;
346 }
347 
349 {
350  if (channel < 0)
351  return 0;
353  return channel + 1;
354  if (channel == AV_CHAN_WIDE_LEFT)
355  return 35;
357  return 36;
359  return 37;
361  return 38;
363  return 39;
364  return 0;
365 }
366 
368  uint32_t *layout,
369  uint32_t *bitmap,
370  uint32_t **pchannel_desc)
371 {
372  int i, j;
373  uint32_t tag = 0;
374  const enum MovChannelLayoutTag *layouts = NULL;
375 
376  /* find the layout list for the specified codec */
377  for (i = 0; mov_codec_ch_layouts[i].codec_id != AV_CODEC_ID_NONE; i++) {
379  break;
380  }
382  layouts = mov_codec_ch_layouts[i].layouts;
383 
384  if (layouts) {
385  int channels;
386  const struct MovChannelLayoutMap *layout_map;
387 
388  /* get the layout map based on the channel count */
390 
391  /* find the layout tag for the specified channel layout */
392  for (i = 0; layouts[i] != 0; i++) {
393  if ((layouts[i] & 0xFFFF) != channels)
394  continue;
395  layout_map = find_layout_map(layouts[i]);
396  if (layout_map) {
397  for (j = 0; j < channels; j++) {
398  if (av_channel_layout_channel_from_index(&par->ch_layout, j) != layout_map[j].id)
399  break;
400  }
401  if (j == channels)
402  break;
403  }
404  }
405  tag = layouts[i];
406  }
407 
408  *layout = tag;
409  *bitmap = 0;
410  *pchannel_desc = NULL;
411 
412  /* if no tag was found, use channel bitmap or description as a backup if possible */
413  if (tag == 0) {
414  uint32_t *channel_desc;
416  par->ch_layout.u.mask < 0x40000) {
418  *bitmap = (uint32_t)par->ch_layout.u.mask;
419  return 0;
420  } else if (par->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
421  return AVERROR(ENOSYS);
422 
423  channel_desc = av_malloc_array(par->ch_layout.nb_channels, sizeof(*channel_desc));
424  if (!channel_desc)
425  return AVERROR(ENOMEM);
426 
427  for (i = 0; i < par->ch_layout.nb_channels; i++) {
428  channel_desc[i] =
430 
431  if (channel_desc[i] == 0) {
432  av_free(channel_desc);
433  return AVERROR(ENOSYS);
434  }
435  }
436 
437  *pchannel_desc = channel_desc;
438  }
439 
440  return 0;
441 }
442 
444  int64_t size)
445 {
446  uint32_t layout_tag, bitmap, num_descr;
447  int ret;
448  AVChannelLayout *ch_layout = &st->codecpar->ch_layout;
449 
450  if (size < 12)
451  return AVERROR_INVALIDDATA;
452 
453  layout_tag = avio_rb32(pb);
454  bitmap = avio_rb32(pb);
455  num_descr = avio_rb32(pb);
456 
457  av_log(s, AV_LOG_DEBUG, "chan: layout=%"PRIu32" "
458  "bitmap=%"PRIu32" num_descr=%"PRIu32"\n",
459  layout_tag, bitmap, num_descr);
460 
461  if (size < 12ULL + num_descr * 20ULL)
462  return 0;
463 
464  if (layout_tag == MOV_CH_LAYOUT_USE_DESCRIPTIONS) {
465  int nb_channels = ch_layout->nb_channels ? ch_layout->nb_channels : num_descr;
466  if (num_descr > nb_channels) {
467  av_log(s, AV_LOG_WARNING, "got %d channel descriptions, capping to the number of channels %d\n",
468  num_descr, nb_channels);
469  num_descr = nb_channels;
470  }
471 
472  av_channel_layout_uninit(ch_layout);
473  ret = av_channel_layout_custom_init(ch_layout, nb_channels);
474  if (ret < 0)
475  goto out;
476 
477  for (int i = 0; i < num_descr; i++) {
478  uint32_t label;
479  if (pb->eof_reached) {
481  "reached EOF while reading channel layout\n");
482  return AVERROR_INVALIDDATA;
483  }
484  label = avio_rb32(pb); // mChannelLabel
485  avio_rb32(pb); // mChannelFlags
486  avio_rl32(pb); // mCoordinates[0]
487  avio_rl32(pb); // mCoordinates[1]
488  avio_rl32(pb); // mCoordinates[2]
489  size -= 20;
490  ch_layout->u.map[i].id = mov_get_channel_id(label);
491  }
492 
494  if (ret < 0)
495  goto out;
496  } else if (layout_tag == MOV_CH_LAYOUT_USE_BITMAP) {
497  if (!ch_layout->nb_channels || av_popcount(bitmap) == ch_layout->nb_channels) {
498  if (bitmap < 0x40000) {
499  av_channel_layout_uninit(ch_layout);
500  av_channel_layout_from_mask(ch_layout, bitmap);
501  }
502  } else {
503  av_log(s, AV_LOG_WARNING, "ignoring channel layout bitmap with %d channels because number of channels is %d\n",
504  av_popcount64(bitmap), ch_layout->nb_channels);
505  }
506  } else if (layout_tag & 0xFFFF) {
507  int nb_channels = layout_tag & 0xFFFF;
508  if (!ch_layout->nb_channels)
509  ch_layout->nb_channels = nb_channels;
510  if (nb_channels == ch_layout->nb_channels) {
511  ret = mov_get_channel_layout(ch_layout, layout_tag);
512  if (ret < 0)
513  return ret;
514  } else {
515  av_log(s, AV_LOG_WARNING, "ignoring layout tag with %d channels because number of channels is %d\n",
516  nb_channels, ch_layout->nb_channels);
517  }
518  }
519  ret = 0;
520 
521 out:
522  avio_skip(pb, size - 12);
523 
524  return ret;
525 }
526 
527 /* ISO/IEC 23001-8, 8.2 */
529  // 0: any setup
530  {0},
531 
532  // 1: centre front
534 
535  // 2: left front, right front
537 
538  // 3: centre front, left front, right front
540 
541  // 4: centre front, left front, right front, rear centre
543 
544  // 5: centre front, left front, right front, left surround, right surround
546 
547  // 6: 5 + LFE
549 
550  // 7: centre front, left front centre, right front centre,
551  // left front, right front, left surround, right surround, LFE
553 
554  // 8: channel1, channel2
556 
557  // 9: left front, right front, rear centre
559 
560  // 10: left front, right front, left surround, right surround
562 
563  // 11: centre front, left front, right front, left surround, right surround, rear centre, LFE
565 
566  // 12: centre front, left front, right front
567  // left surround, right surround
568  // rear surround left, rear surround right
569  // LFE
571 
572  // 13:
574 
575  // 14:
577 
578  // TODO: 15 - 20
579 };
580 
581 /* ISO/IEC 23001-8, table 8 */
582 static const enum AVChannel iso_channel_position[] = {
583  // 0: left front
585 
586  // 1: right front
588 
589  // 2: centre front
591 
592  // 3: low frequence enhancement
594 
595  // 4: left surround
596  // TODO
597  AV_CHAN_NONE,
598 
599  // 5: right surround
600  // TODO
601  AV_CHAN_NONE,
602 
603  // 6: left front centre
605 
606  // 7: right front centre
608 
609  // 8: rear surround left
611 
612  // 9: rear surround right
614 
615  // 10: rear centre
617 
618  // 11: left surround direct
620 
621  // 12: right surround direct
623 
624  // 13: left side surround
626 
627  // 14: right side surround
629 
630  // 15: left wide front
632 
633  // 16: right wide front
635 
636  // 17: left front vertical height
638 
639  // 18: right front vertical height
641 
642  // 19: centre front vertical height
644 
645  // 20: left surround vertical height rear
647 
648  // 21: right surround vertical height rear
650 
651  // 22: centre vertical height rear
653 
654  // 23: left vertical height side surround
656 
657  // 24: right vertical height side surround
659 
660  // 25: top centre surround
662 
663  // 26: low frequency enhancement 2
665 
666  // 27: left front vertical bottom
668 
669  // 28: right front vertical bottom
671 
672  // 29: centre front vertical bottom
674 
675  // 30: left vertical height surround
676  // TODO
677  AV_CHAN_NONE,
678 
679  // 31: right vertical height surround
680  // TODO
681  AV_CHAN_NONE,
682 
683  // 32, 33, 34, 35, reserved
684  AV_CHAN_NONE,
685  AV_CHAN_NONE,
686  AV_CHAN_NONE,
687  AV_CHAN_NONE,
688 
689  // 36: low frequency enhancement 3
690  AV_CHAN_NONE,
691 
692  // 37: left edge of screen
693  AV_CHAN_NONE,
694  // 38: right edge of screen
695  AV_CHAN_NONE,
696  // 39: half-way between centre of screen and left edge of screen
697  AV_CHAN_NONE,
698  // 40: half-way between centre of screen and right edge of screen
699  AV_CHAN_NONE,
700 
701  // 41: left back surround
702  AV_CHAN_NONE,
703 
704  // 42: right back surround
705  AV_CHAN_NONE,
706 
707  // 43 - 125: reserved
708  // 126: explicit position
709  // 127: unknown /undefined
710 };
711 
713 {
714  // Set default value which means any setup in 23001-8
715  *config = 0;
716  for (int i = 0; i < FF_ARRAY_ELEMS(iso_channel_configuration); i++) {
718  *config = i;
719  break;
720  }
721  }
722 
723  return 0;
724 }
725 
727 {
730  return 0;
731  }
732 
733  return -1;
734 }
735 
737  uint8_t *position, int position_num)
738 {
739  enum AVChannel channel;
740 
741  if (position_num < layout->nb_channels)
742  return AVERROR(EINVAL);
743 
744  for (int i = 0; i < layout->nb_channels; i++) {
745  position[i] = 127;
747  if (channel == AV_CHAN_NONE)
748  return AVERROR(EINVAL);
749 
750  for (int j = 0; j < FF_ARRAY_ELEMS(iso_channel_position); j++) {
751  if (iso_channel_position[j] == channel) {
752  position[i] = j;
753  break;
754  }
755  }
756  if (position[i] == 127)
757  return AVERROR(EINVAL);
758  }
759 
760  return 0;
761 }
762 
764 {
765  int stream_structure = avio_r8(pb);
766  int ret;
767 
768  // stream carries channels
769  if (stream_structure & 1) {
770  int layout = avio_r8(pb);
771 
772  av_log(s, AV_LOG_TRACE, "'chnl' layout %d\n", layout);
773  if (!layout) {
774  AVChannelLayout *ch_layout = &st->codecpar->ch_layout;
775  int nb_channels = ch_layout->nb_channels;
776 
777  av_channel_layout_uninit(ch_layout);
778  ret = av_channel_layout_custom_init(ch_layout, nb_channels);
779  if (ret < 0)
780  return ret;
781 
782  for (int i = 0; i < nb_channels; i++) {
783  int speaker_pos = avio_r8(pb);
784  enum AVChannel channel;
785 
786  if (speaker_pos == 126) // explicit position
787  avio_skip(pb, 3); // azimuth, elevation
788 
789  if (speaker_pos >= FF_ARRAY_ELEMS(iso_channel_position))
791  else
792  channel = iso_channel_position[speaker_pos];
793 
794  if (channel == AV_CHAN_NONE) {
795  av_log(s, AV_LOG_WARNING, "speaker position %d is not implemented\n", speaker_pos);
797  }
798 
799  ch_layout->u.map[i].id = channel;
800  }
801 
803  if (ret < 0)
804  return ret;
805  } else {
806  uint64_t omitted_channel_map = avio_rb64(pb);
807 
808  if (omitted_channel_map) {
809  avpriv_request_sample(s, "omitted_channel_map 0x%" PRIx64 " != 0",
810  omitted_channel_map);
811  return AVERROR_PATCHWELCOME;
812  }
814  }
815  }
816 
817  // stream carries objects
818  if (stream_structure & 2) {
819  int obj_count = avio_r8(pb);
820  av_log(s, AV_LOG_TRACE, "'chnl' with object_count %d\n", obj_count);
821  }
822 
823  return 0;
824 }
MOV_CH_LAYOUT_QUADRAPHONIC
@ MOV_CH_LAYOUT_QUADRAPHONIC
Definition: mov_chan.h:64
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:328
MOV_CH_LAYOUT_EAC3_7_1_D
@ MOV_CH_LAYOUT_EAC3_7_1_D
Definition: mov_chan.h:118
MOV_CH_LAYOUT_MPEG_4_0_A
@ MOV_CH_LAYOUT_MPEG_4_0_A
Definition: mov_chan.h:71
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AV_CODEC_ID_PCM_F32BE
@ AV_CODEC_ID_PCM_F32BE
Definition: codec_id.h:348
MOV_CH_LAYOUT_DVD_6
@ MOV_CH_LAYOUT_DVD_6
Definition: mov_chan.h:91
AV_CHANNEL_LAYOUT_STEREO_DOWNMIX
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX
Definition: channel_layout.h:413
MOV_CH_LAYOUT_EAC3_7_1_H
@ MOV_CH_LAYOUT_EAC3_7_1_H
Definition: mov_chan.h:122
CHLIST04
#define CHLIST04(_0, _1, _2, _3, _4)
Definition: mov_chan.c:89
AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: codec_id.h:443
c_LFE2
@ c_LFE2
Definition: mov_chan.c:58
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
MOV_CH_LAYOUT_MPEG_5_1_A
@ MOV_CH_LAYOUT_MPEG_5_1_A
Definition: mov_chan.h:77
c_Rrt
@ c_Rrt
Definition: mov_chan.c:51
out
FILE * out
Definition: movenc.c:54
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:379
codec_id
enum AVCodecID codec_id
Definition: mov_chan.c:260
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
av_popcount64
#define av_popcount64
Definition: common.h:155
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:261
MOV_CH_LAYOUT_DTS_6_1_D
@ MOV_CH_LAYOUT_DTS_6_1_D
Definition: mov_chan.h:131
AV_CHAN_WIDE_LEFT
@ AV_CHAN_WIDE_LEFT
Definition: channel_layout.h:72
MOV_CH_LAYOUT_DTS_8_0_A
@ MOV_CH_LAYOUT_DTS_8_0_A
Definition: mov_chan.h:134
AVChannelLayout::map
AVChannelCustom * map
This member must be used when the channel order is AV_CHANNEL_ORDER_CUSTOM.
Definition: channel_layout.h:354
AV_CHANNEL_LAYOUT_2_2
#define AV_CHANNEL_LAYOUT_2_2
Definition: channel_layout.h:386
MOV_CH_LAYOUT_AUDIOUNIT_7_0_FRONT
@ MOV_CH_LAYOUT_AUDIOUNIT_7_0_FRONT
Definition: mov_chan.h:97
MOV_CH_LAYOUT_AC3_3_0_1
@ MOV_CH_LAYOUT_AC3_3_0_1
Definition: mov_chan.h:107
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:664
MOV_CH_LAYOUT_AUDIOUNIT_7_0
@ MOV_CH_LAYOUT_AUDIOUNIT_7_0
Definition: mov_chan.h:96
c_HI
@ c_HI
Definition: mov_chan.c:71
c_Z
@ c_Z
Definition: mov_chan.c:66
CHLIST02
#define CHLIST02(_0, _1, _2)
Definition: mov_chan.c:87
c_Vhc
@ c_Vhc
Definition: mov_chan.c:47
R
#define R
Definition: huffyuv.h:44
MOV_CH_LAYOUT_EAC3_7_1_B
@ MOV_CH_LAYOUT_EAC3_7_1_B
Definition: mov_chan.h:116
AV_CODEC_ID_ALAC
@ AV_CODEC_ID_ALAC
Definition: codec_id.h:456
mov_ch_layout_map
static const struct MovChannelLayoutMap mov_ch_layout_map[]
Definition: mov_chan.c:102
c_Lw
@ c_Lw
Definition: mov_chan.c:54
CHLIST05
#define CHLIST05(_0, _1, _2, _3, _4, _5)
Definition: mov_chan.c:90
MOV_CH_LAYOUT_AMBISONIC_B_FORMAT
@ MOV_CH_LAYOUT_AMBISONIC_B_FORMAT
Definition: mov_chan.h:63
c_LFE1
@ c_LFE1
Definition: mov_chan.c:69
MOV_CH_LAYOUT_ITU_2_1
@ MOV_CH_LAYOUT_ITU_2_1
Definition: mov_chan.h:87
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:308
MOV_CH_LAYOUT_AAC_7_0
@ MOV_CH_LAYOUT_AAC_7_0
Definition: mov_chan.h:100
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:335
av_popcount
#define av_popcount
Definition: common.h:152
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:313
ff_mov_get_channel_layout_tag
int ff_mov_get_channel_layout_tag(const AVCodecParameters *par, uint32_t *layout, uint32_t *bitmap, uint32_t **pchannel_desc)
Get the channel layout tag for the specified codec id and channel layout.
Definition: mov_chan.c:367
tf_sess_config.config
config
Definition: tf_sess_config.py:33
MOV_CH_LAYOUT_AC3_3_0
@ MOV_CH_LAYOUT_AC3_3_0
Definition: mov_chan.h:105
MOV_CH_LAYOUT_DTS_6_0_A
@ MOV_CH_LAYOUT_DTS_6_0_A
Definition: mov_chan.h:125
MOV_CH_LAYOUT_MATRIXSTEREO
@ MOV_CH_LAYOUT_MATRIXSTEREO
Definition: mov_chan.h:59
AV_CHANNEL_LAYOUT_7POINT1_WIDE
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE
Definition: channel_layout.h:402
ff_mov_get_channel_layout_from_config
int ff_mov_get_channel_layout_from_config(int config, AVChannelLayout *layout)
Get AVChannelLayout from ISO/IEC 23001-8 ChannelConfiguration.
Definition: mov_chan.c:726
AV_CHAN_SURROUND_DIRECT_LEFT
@ AV_CHAN_SURROUND_DIRECT_LEFT
Definition: channel_layout.h:74
c_Rrs
@ c_Rrs
Definition: mov_chan.c:39
MOV_CH_LAYOUT_MPEG_5_0_A
@ MOV_CH_LAYOUT_MPEG_5_0_A
Definition: mov_chan.h:73
MOV_CH_LAYOUT_EAC3_7_1_C
@ MOV_CH_LAYOUT_EAC3_7_1_C
Definition: mov_chan.h:117
AV_CODEC_ID_PCM_S16BE
@ AV_CODEC_ID_PCM_S16BE
Definition: codec_id.h:329
AV_CHAN_TOP_BACK_RIGHT
@ AV_CHAN_TOP_BACK_RIGHT
Definition: channel_layout.h:67
MOV_CH_LAYOUT_MPEG_5_1_D
@ MOV_CH_LAYOUT_MPEG_5_1_D
Definition: mov_chan.h:80
AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK
#define AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK
Definition: channel_layout.h:416
mov_ch_layouts_alac
static enum MovChannelLayoutTag mov_ch_layouts_alac[]
Definition: mov_chan.c:232
MOV_CH_LAYOUT_DTS_6_0_B
@ MOV_CH_LAYOUT_DTS_6_0_B
Definition: mov_chan.h:126
c_Ts
@ c_Ts
Definition: mov_chan.c:45
c_C
@ c_C
Definition: mov_chan.c:36
MOV_CH_LAYOUT_MONO
@ MOV_CH_LAYOUT_MONO
Definition: mov_chan.h:56
AV_CHANNEL_LAYOUT_SURROUND
#define AV_CHANNEL_LAYOUT_SURROUND
Definition: channel_layout.h:382
AV_CHAN_STEREO_RIGHT
@ AV_CHAN_STEREO_RIGHT
See above.
Definition: channel_layout.h:71
MOV_CH_LAYOUT_ITU_2_2
@ MOV_CH_LAYOUT_ITU_2_2
Definition: mov_chan.h:88
C
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
Definition: writing_filters.txt:58
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:332
avassert.h
MOV_CH_LAYOUT_DTS_8_0_B
@ MOV_CH_LAYOUT_DTS_8_0_B
Definition: mov_chan.h:135
AV_CHAN_BOTTOM_FRONT_LEFT
@ AV_CHAN_BOTTOM_FRONT_LEFT
Definition: channel_layout.h:80
MOV_CH_LAYOUT_EAC3_7_1_G
@ MOV_CH_LAYOUT_EAC3_7_1_G
Definition: mov_chan.h:121
avio_rb32
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:760
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:206
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
MOV_CH_LAYOUT_AC3_1_0_1
@ MOV_CH_LAYOUT_AC3_1_0_1
Definition: mov_chan.h:104
codec_id.h
MOV_CH_LAYOUT_HEXAGONAL
@ MOV_CH_LAYOUT_HEXAGONAL
Definition: mov_chan.h:66
MOV_CH_LAYOUT_MPEG_5_1_C
@ MOV_CH_LAYOUT_MPEG_5_1_C
Definition: mov_chan.h:79
AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_4POINT0
Definition: channel_layout.h:384
MOV_CH_LAYOUT_AAC_6_0
@ MOV_CH_LAYOUT_AAC_6_0
Definition: mov_chan.h:98
AV_CHANNEL_LAYOUT_7POINT1
#define AV_CHANNEL_LAYOUT_7POINT1
Definition: channel_layout.h:401
s
#define s(width, name)
Definition: cbs_vp9.c:198
X
@ X
Definition: vf_addroi.c:27
AV_CHAN_UNKNOWN
@ AV_CHAN_UNKNOWN
Channel contains data, but its position is unknown.
Definition: channel_layout.h:87
MOV_CH_LAYOUT_EAC3_6_1_A
@ MOV_CH_LAYOUT_EAC3_6_1_A
Definition: mov_chan.h:112
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:112
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:242
MOV_CH_LAYOUT_DTS_8_1_A
@ MOV_CH_LAYOUT_DTS_8_1_A
Definition: mov_chan.h:136
AV_CHAN_SIDE_RIGHT
@ AV_CHAN_SIDE_RIGHT
Definition: channel_layout.h:60
c_Rc
@ c_Rc
Definition: mov_chan.c:41
MOV_CH_LAYOUT_AC3_3_1
@ MOV_CH_LAYOUT_AC3_3_1
Definition: mov_chan.h:106
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
channels
channels
Definition: aptx.h:31
MOV_CH_LAYOUT_BINAURAL
@ MOV_CH_LAYOUT_BINAURAL
Definition: mov_chan.h:62
MOV_CH_LAYOUT_DTS_8_1_B
@ MOV_CH_LAYOUT_DTS_8_1_B
Definition: mov_chan.h:137
MOV_CH_LAYOUT_MPEG_7_1_B
@ MOV_CH_LAYOUT_MPEG_7_1_B
Definition: mov_chan.h:83
c_Y
@ c_Y
Definition: mov_chan.c:65
W
@ W
Definition: vf_addroi.c:27
MOV_CH_LAYOUT_PENTAGONAL
@ MOV_CH_LAYOUT_PENTAGONAL
Definition: mov_chan.h:65
c_Lt
@ c_Lt
Definition: mov_chan.c:52
iso_channel_configuration
static const AVChannelLayout iso_channel_configuration[]
Definition: mov_chan.c:528
AV_CHAN_TOP_SIDE_LEFT
@ AV_CHAN_TOP_SIDE_LEFT
Definition: channel_layout.h:77
CHLIST06
#define CHLIST06(_0, _1, _2, _3, _4, _5, _6)
Definition: mov_chan.c:91
AV_CHAN_TOP_SIDE_RIGHT
@ AV_CHAN_TOP_SIDE_RIGHT
Definition: channel_layout.h:78
AVFormatContext
Format I/O context.
Definition: avformat.h:1255
MOV_CH_LAYOUT_SMPTE_DTV
@ MOV_CH_LAYOUT_SMPTE_DTV
Definition: mov_chan.h:86
c_Vhl
@ c_Vhl
Definition: mov_chan.c:46
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:766
MOV_CH_LAYOUT_DTS_7_1
@ MOV_CH_LAYOUT_DTS_7_1
Definition: mov_chan.h:133
MovChannelLayoutTag
MovChannelLayoutTag
mov 'chan' tag reading/writing.
Definition: mov_chan.h:51
MOV_CH_LAYOUT_STEREO
@ MOV_CH_LAYOUT_STEREO
Definition: mov_chan.h:57
MOV_CH_LAYOUT_DVD_10
@ MOV_CH_LAYOUT_DVD_10
Definition: mov_chan.h:92
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
MOV_CH_LAYOUT_DTS_4_1
@ MOV_CH_LAYOUT_DTS_4_1
Definition: mov_chan.h:124
AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL
#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL
The specified retype target order is ignored and the simplest possible (canonical) order is used for ...
Definition: channel_layout.h:692
AV_CHAN_TOP_BACK_CENTER
@ AV_CHAN_TOP_BACK_CENTER
Definition: channel_layout.h:66
avio_rb64
uint64_t avio_rb64(AVIOContext *s)
Definition: aviobuf.c:907
MOV_CH_LAYOUT_EAC3_6_0_A
@ MOV_CH_LAYOUT_EAC3_6_0_A
Definition: mov_chan.h:110
MOV_CH_LAYOUT_DTS_6_1_C
@ MOV_CH_LAYOUT_DTS_6_1_C
Definition: mov_chan.h:130
mov_get_channel_id
static enum AVChannel mov_get_channel_id(uint32_t label)
Definition: mov_chan.c:329
AV_CHAN_BOTTOM_FRONT_RIGHT
@ AV_CHAN_BOTTOM_FRONT_RIGHT
Definition: channel_layout.h:81
c_Cs
@ c_Cs
Definition: mov_chan.c:42
MOV_CH_LAYOUT_MPEG_3_0_B
@ MOV_CH_LAYOUT_MPEG_3_0_B
Definition: mov_chan.h:70
ff_mov_get_channel_positions_from_layout
int ff_mov_get_channel_positions_from_layout(const AVChannelLayout *layout, uint8_t *position, int position_num)
Get ISO/IEC 23001-8 OutputChannelPosition from AVChannelLayout.
Definition: mov_chan.c:736
c_Vhr
@ c_Vhr
Definition: mov_chan.c:48
AV_CHAN_TOP_CENTER
@ AV_CHAN_TOP_CENTER
Definition: channel_layout.h:61
mov_get_channel_layout
static int mov_get_channel_layout(AVChannelLayout *ch_layout, uint32_t tag)
Get the channel layout for the specified non-special channel layout tag if known.
Definition: mov_chan.c:305
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:180
MOV_CH_LAYOUT_CUBE
@ MOV_CH_LAYOUT_CUBE
Definition: mov_chan.h:68
MovChannelLayoutMap
Definition: mov_chan.c:76
AV_CHAN_FRONT_RIGHT_OF_CENTER
@ AV_CHAN_FRONT_RIGHT_OF_CENTER
Definition: channel_layout.h:57
AV_CHANNEL_LAYOUT_22POINT2
#define AV_CHANNEL_LAYOUT_22POINT2
Definition: channel_layout.h:414
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
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
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:442
ff_mov_get_channel_config_from_layout
int ff_mov_get_channel_config_from_layout(const AVChannelLayout *layout, int *config)
Get ISO/IEC 23001-8 ChannelConfiguration from AVChannelLayout.
Definition: mov_chan.c:712
c_Rw
@ c_Rw
Definition: mov_chan.c:55
MOV_CH_LAYOUT_EAC3_6_1_C
@ MOV_CH_LAYOUT_EAC3_6_1_C
Definition: mov_chan.h:114
CHLIST07
#define CHLIST07(_0, _1, _2, _3, _4, _5, _6, _7)
Definition: mov_chan.c:92
avio_rl32
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:729
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:340
MOV_CH_LAYOUT_AAC_6_1
@ MOV_CH_LAYOUT_AAC_6_1
Definition: mov_chan.h:99
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:303
c_Rls
@ c_Rls
Definition: mov_chan.c:38
MOV_CH_LAYOUT_DVD_5
@ MOV_CH_LAYOUT_DVD_5
Definition: mov_chan.h:90
AV_CHAN_LOW_FREQUENCY
@ AV_CHAN_LOW_FREQUENCY
Definition: channel_layout.h:53
size
int size
Definition: twinvq_data.h:10344
MOV_CH_LAYOUT_STEREOHEADPHONES
@ MOV_CH_LAYOUT_STEREOHEADPHONES
Definition: mov_chan.h:58
AV_CHAN_BACK_RIGHT
@ AV_CHAN_BACK_RIGHT
Definition: channel_layout.h:55
CHLIST09
#define CHLIST09(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9)
Definition: mov_chan.c:94
c_Ls
@ c_Ls
Definition: mov_chan.c:43
AV_CHAN_SIDE_LEFT
@ AV_CHAN_SIDE_LEFT
Definition: channel_layout.h:59
MOV_CH_LAYOUT_MPEG_5_1_B
@ MOV_CH_LAYOUT_MPEG_5_1_B
Definition: mov_chan.h:78
MOV_CH_LAYOUT_MPEG_7_1_A
@ MOV_CH_LAYOUT_MPEG_7_1_A
Definition: mov_chan.h:82
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:602
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:876
MOV_CH_LAYOUT_DTS_6_1_A
@ MOV_CH_LAYOUT_DTS_6_1_A
Definition: mov_chan.h:128
MOV_CH_LAYOUT_MPEG_3_0_A
@ MOV_CH_LAYOUT_MPEG_3_0_A
Definition: mov_chan.h:69
AV_CHAN_TOP_FRONT_RIGHT
@ AV_CHAN_TOP_FRONT_RIGHT
Definition: channel_layout.h:64
AV_CHANNEL_ORDER_NATIVE
@ AV_CHANNEL_ORDER_NATIVE
The native channel order, i.e.
Definition: channel_layout.h:118
AV_CHAN_FRONT_LEFT_OF_CENTER
@ AV_CHAN_FRONT_LEFT_OF_CENTER
Definition: channel_layout.h:56
MOV_CH_LAYOUT_DVD_18
@ MOV_CH_LAYOUT_DVD_18
Definition: mov_chan.h:94
AV_CHAN_UNUSED
@ AV_CHAN_UNUSED
Channel is empty can be safely skipped.
Definition: channel_layout.h:84
Y
#define Y
Definition: boxblur.h:37
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:800
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:222
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 layout
Definition: filter_design.txt:18
AVChannel
AVChannel
Definition: channel_layout.h:47
MOV_CH_LAYOUT_MPEG_5_0_D
@ MOV_CH_LAYOUT_MPEG_5_0_D
Definition: mov_chan.h:76
MOV_CH_LAYOUT_EMAGIC_DEFAULT_7_1
@ MOV_CH_LAYOUT_EMAGIC_DEFAULT_7_1
Definition: mov_chan.h:85
c_VI
@ c_VI
Definition: mov_chan.c:72
av_assert2
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition: avassert.h:67
AV_CHAN_SURROUND_DIRECT_RIGHT
@ AV_CHAN_SURROUND_DIRECT_RIGHT
Definition: channel_layout.h:75
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
find_layout_map
static const struct MovChannelLayoutMap * find_layout_map(uint32_t tag)
Definition: mov_chan.c:281
CHLIST01
#define CHLIST01(_0, _1)
Definition: mov_chan.c:86
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
AV_CODEC_ID_PCM_F64BE
@ AV_CODEC_ID_PCM_F64BE
Definition: codec_id.h:350
MOV_CH_LAYOUT_MPEG_6_1_A
@ MOV_CH_LAYOUT_MPEG_6_1_A
Definition: mov_chan.h:81
AV_CODEC_ID_PCM_S32BE
@ AV_CODEC_ID_PCM_S32BE
Definition: codec_id.h:337
MOV_CH_LAYOUT_AUDIOUNIT_6_0
@ MOV_CH_LAYOUT_AUDIOUNIT_6_0
Definition: mov_chan.h:95
MOV_CH_LAYOUT_AC3_2_1_1
@ MOV_CH_LAYOUT_AC3_2_1_1
Definition: mov_chan.h:108
AV_CHAN_STEREO_LEFT
@ AV_CHAN_STEREO_LEFT
Stereo downmix.
Definition: channel_layout.h:69
MOV_CH_LAYOUT_MPEG_4_0_B
@ MOV_CH_LAYOUT_MPEG_4_0_B
Definition: mov_chan.h:72
MovChannelLayoutMap::tag
uint32_t tag
Definition: mov_chan.c:78
MOV_CH_LAYOUT_MPEG_5_0_C
@ MOV_CH_LAYOUT_MPEG_5_0_C
Definition: mov_chan.h:75
CHLIST16
#define CHLIST16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16)
Definition: mov_chan.c:95
mov_chan.h
tag
uint32_t tag
Definition: movenc.c:1786
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:743
MOV_CH_LAYOUT_DVD_4
@ MOV_CH_LAYOUT_DVD_4
Definition: mov_chan.h:89
MOV_CH_LAYOUT_TMH_10_2_FULL
@ MOV_CH_LAYOUT_TMH_10_2_FULL
Definition: mov_chan.h:103
id
enum AVCodecID id
Definition: dts2pts.c:364
AV_CHAN_BACK_CENTER
@ AV_CHAN_BACK_CENTER
Definition: channel_layout.h:58
AV_CHANNEL_LAYOUT_2_1
#define AV_CHANNEL_LAYOUT_2_1
Definition: channel_layout.h:381
AV_CHAN_NONE
@ AV_CHAN_NONE
Invalid channel index.
Definition: channel_layout.h:49
c_X
@ c_X
Definition: mov_chan.c:67
channel_layout.h
AV_CHAN_LOW_FREQUENCY_2
@ AV_CHAN_LOW_FREQUENCY_2
Definition: channel_layout.h:76
MOV_CH_LAYOUT_OCTAGONAL
@ MOV_CH_LAYOUT_OCTAGONAL
Definition: mov_chan.h:67
AV_CHAN_TOP_BACK_LEFT
@ AV_CHAN_TOP_BACK_LEFT
Definition: channel_layout.h:65
MOV_CH_LAYOUT_EAC3_7_1_A
@ MOV_CH_LAYOUT_EAC3_7_1_A
Definition: mov_chan.h:115
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:432
c_Rt
@ c_Rt
Definition: mov_chan.c:53
MOV_CH_LAYOUT_DVD_11
@ MOV_CH_LAYOUT_DVD_11
Definition: mov_chan.h:93
MOV_CH_LAYOUT_EAC3_7_0_A
@ MOV_CH_LAYOUT_EAC3_7_0_A
Definition: mov_chan.h:111
AV_CHAN_BACK_LEFT
@ AV_CHAN_BACK_LEFT
Definition: channel_layout.h:54
L
#define L(x)
Definition: vpx_arith.h:36
AVIOContext::eof_reached
int eof_reached
true if was unable to read due to error or eof
Definition: avio.h:238
mov_codec_ch_layouts
static const struct @326 mov_codec_ch_layouts[]
MOV_CH_LAYOUT_MPEG_7_1_C
@ MOV_CH_LAYOUT_MPEG_7_1_C
Definition: mov_chan.h:84
AV_CHAN_BOTTOM_FRONT_CENTER
@ AV_CHAN_BOTTOM_FRONT_CENTER
Definition: channel_layout.h:79
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:317
MovChannelLayoutMap::id
enum AVChannel id
Definition: mov_chan.c: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:439
c_Haptic
@ c_Haptic
Definition: mov_chan.c:73
mov_ch_layouts_aac
static enum MovChannelLayoutTag mov_ch_layouts_aac[]
Definition: mov_chan.c:187
MOV_CH_LAYOUT_AAC_OCTAGONAL
@ MOV_CH_LAYOUT_AAC_OCTAGONAL
Definition: mov_chan.h:101
MOV_CH_LAYOUT_DTS_6_0_C
@ MOV_CH_LAYOUT_DTS_6_0_C
Definition: mov_chan.h:127
CHLIST21
#define CHLIST21(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21)
Definition: mov_chan.c:98
iso_channel_position
static enum AVChannel iso_channel_position[]
Definition: mov_chan.c:582
AV_CHAN_TOP_FRONT_CENTER
@ AV_CHAN_TOP_FRONT_CENTER
Definition: channel_layout.h:63
AV_CODEC_ID_PCM_S32LE
@ AV_CODEC_ID_PCM_S32LE
Definition: codec_id.h:336
MOV_CH_LAYOUT_DTS_3_1
@ MOV_CH_LAYOUT_DTS_3_1
Definition: mov_chan.h:123
mov_get_channel_label
static uint32_t mov_get_channel_label(enum AVChannel channel)
Definition: mov_chan.c:348
AV_CHAN_WIDE_RIGHT
@ AV_CHAN_WIDE_RIGHT
Definition: channel_layout.h:73
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:333
MOV_CH_LAYOUT_EAC3_7_1_E
@ MOV_CH_LAYOUT_EAC3_7_1_E
Definition: mov_chan.h:119
c_Lsd
@ c_Lsd
Definition: mov_chan.c:56
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:36
AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_MONO
Definition: channel_layout.h:378
MOV_CH_LAYOUT_AC3_3_1_1
@ MOV_CH_LAYOUT_AC3_3_1_1
Definition: mov_chan.h:109
AV_CODEC_ID_PCM_F64LE
@ AV_CODEC_ID_PCM_F64LE
Definition: codec_id.h:351
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
MOV_CH_LAYOUT_DTS_7_0
@ MOV_CH_LAYOUT_DTS_7_0
Definition: mov_chan.h:132
AV_CHAN_TOP_FRONT_LEFT
@ AV_CHAN_TOP_FRONT_LEFT
Definition: channel_layout.h:62
MOV_CH_LAYOUT_MPEG_5_0_B
@ MOV_CH_LAYOUT_MPEG_5_0_B
Definition: mov_chan.h:74
c_Csd
@ c_Csd
Definition: mov_chan.c:70
MOV_CH_LAYOUT_DTS_6_1_B
@ MOV_CH_LAYOUT_DTS_6_1_B
Definition: mov_chan.h:129
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:101
c_R
@ c_R
Definition: mov_chan.c:35
c_Rlt
@ c_Rlt
Definition: mov_chan.c:49
ff_mov_read_chnl
int ff_mov_read_chnl(AVFormatContext *s, AVIOContext *pb, AVStream *st)
Read 'chnl' tag from the input stream.
Definition: mov_chan.c:763
AV_CODEC_ID_PCM_F32LE
@ AV_CODEC_ID_PCM_F32LE
Definition: codec_id.h:349
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AV_CHANNEL_LAYOUT_6POINT1
#define AV_CHANNEL_LAYOUT_6POINT1
Definition: channel_layout.h:396
c_W
@ c_W
Definition: mov_chan.c:64
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
c_Rsd
@ c_Rsd
Definition: mov_chan.c:57
AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_5POINT0
Definition: channel_layout.h:388
AV_CHAN_FRONT_LEFT
@ AV_CHAN_FRONT_LEFT
Definition: channel_layout.h:50
MOV_CH_LAYOUT_MIDSIDE
@ MOV_CH_LAYOUT_MIDSIDE
Definition: mov_chan.h:60
c_Lc
@ c_Lc
Definition: mov_chan.c:40
AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_5POINT1
Definition: channel_layout.h:389
MOV_CH_LAYOUT_TMH_10_2_STD
@ MOV_CH_LAYOUT_TMH_10_2_STD
Definition: mov_chan.h:102
c_L
@ c_L
Definition: mov_chan.c:34
c_LFE
@ c_LFE
Definition: mov_chan.c:37
mov_ch_layouts_wav
static enum MovChannelLayoutTag mov_ch_layouts_wav[]
Definition: mov_chan.c:244
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:341
MOV_CH_LAYOUT_EAC3_7_1_F
@ MOV_CH_LAYOUT_EAC3_7_1_F
Definition: mov_chan.h:120
c_Rs
@ c_Rs
Definition: mov_chan.c:44
mov_ch_layouts_ac3
static enum MovChannelLayoutTag mov_ch_layouts_ac3[]
Definition: mov_chan.c:214
AVChannelCustom::id
enum AVChannel id
Definition: channel_layout.h:268
AVChannelLayout::u
union AVChannelLayout::@351 u
Details about which channels are present in this layout.
CHLIST03
#define CHLIST03(_0, _1, _2, _3)
Definition: mov_chan.c:88
channel
channel
Definition: ebur128.h:39
MOV_CH_LAYOUT_XY
@ MOV_CH_LAYOUT_XY
Definition: mov_chan.h:61
CHLIST08
#define CHLIST08(_0, _1, _2, _3, _4, _5, _6, _7, _8)
Definition: mov_chan.c:93
MOV_CH_LAYOUT_EAC3_6_1_B
@ MOV_CH_LAYOUT_EAC3_6_1_B
Definition: mov_chan.h:113
MOV_CH_LAYOUT_USE_BITMAP
@ MOV_CH_LAYOUT_USE_BITMAP
Definition: mov_chan.h:54
MOV_CH_LAYOUT_USE_DESCRIPTIONS
@ MOV_CH_LAYOUT_USE_DESCRIPTIONS
Definition: mov_chan.h:53
ff_mov_read_chan
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int64_t size)
Read 'chan' tag from the input stream.
Definition: mov_chan.c:443