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 
29 #include "libavcodec/codec_id.h"
30 #include "mov_chan.h"
31 
33  uint32_t tag;
34  uint64_t layout;
35 };
36 
41  { MOV_CH_LAYOUT_UNKNOWN, 0 },
42  { MOV_CH_LAYOUT_TMH_10_2_STD, 0 }, // L, R, C, Vhc, Lsd, Rsd,
43  // Ls, Rs, Vhl, Vhr, Lw, Rw,
44  // Csd, Cs, LFE1, LFE2
45  { MOV_CH_LAYOUT_TMH_10_2_FULL, 0 }, // L, R, C, Vhc, Lsd, Rsd,
46  // Ls, Rs, Vhl, Vhr, Lw, Rw,
47  // Csd, Cs, LFE1, LFE2, Lc, Rc,
48  // HI, VI, Haptic
49  { 0, 0 },
50 };
51 
52 static const struct MovChannelLayoutMap mov_ch_layout_map_1ch[] = {
54  { 0, 0 },
55 };
56 
57 static const struct MovChannelLayoutMap mov_ch_layout_map_2ch[] = {
62  { MOV_CH_LAYOUT_XY, AV_CH_LAYOUT_STEREO }, // X (left), Y (right)
63 
65 
68  { 0, 0 },
69 };
70 
71 static const struct MovChannelLayoutMap mov_ch_layout_map_3ch[] = {
75 
76  { MOV_CH_LAYOUT_ITU_2_1, AV_CH_LAYOUT_2_1 }, // L, R, Cs
77 
78  { MOV_CH_LAYOUT_DVD_4, AV_CH_LAYOUT_2POINT1 }, // L, R, LFE
79  { 0, 0 },
80 };
81 
82 static const struct MovChannelLayoutMap mov_ch_layout_map_4ch[] = {
83  { MOV_CH_LAYOUT_AMBISONIC_B_FORMAT, 0 }, // W, X, Y, Z
84 
85  { MOV_CH_LAYOUT_QUADRAPHONIC, AV_CH_LAYOUT_QUAD }, // L, R, Rls, Rrs
86 
89  { MOV_CH_LAYOUT_AC3_3_1, AV_CH_LAYOUT_4POINT0 }, // L, C, R, Cs
90 
91  { MOV_CH_LAYOUT_ITU_2_2, AV_CH_LAYOUT_2_2 }, // L, R, Ls, Rs
92 
93  { MOV_CH_LAYOUT_DVD_5, AV_CH_LAYOUT_2_1 | // L, R, LFE, Cs
95  { MOV_CH_LAYOUT_AC3_2_1_1, AV_CH_LAYOUT_2_1 | // L, R, Cs, LFE
97 
98  { MOV_CH_LAYOUT_DVD_10, AV_CH_LAYOUT_3POINT1 }, // L, R, C, LFE
99  { MOV_CH_LAYOUT_AC3_3_0_1, AV_CH_LAYOUT_3POINT1 }, // L, C, R, LFE
100  { MOV_CH_LAYOUT_DTS_3_1, AV_CH_LAYOUT_3POINT1 }, // C, L, R, LFE
101  { 0, 0 },
102 };
103 
105  { MOV_CH_LAYOUT_PENTAGONAL, AV_CH_LAYOUT_5POINT0_BACK }, // L, R, Rls, Rrs, C
106 
107  { MOV_CH_LAYOUT_MPEG_5_0_A, AV_CH_LAYOUT_5POINT0 }, // L, R, C, Ls, Rs
108  { MOV_CH_LAYOUT_MPEG_5_0_B, AV_CH_LAYOUT_5POINT0 }, // L, R, Ls, Rs, C
109  { MOV_CH_LAYOUT_MPEG_5_0_C, AV_CH_LAYOUT_5POINT0 }, // L, C, R, Ls, Rs
110  { MOV_CH_LAYOUT_MPEG_5_0_D, AV_CH_LAYOUT_5POINT0 }, // C, L, R, Ls, Rs
111 
112  { MOV_CH_LAYOUT_DVD_6, AV_CH_LAYOUT_2_2 | // L, R, LFE, Ls, Rs
114  { MOV_CH_LAYOUT_DVD_18, AV_CH_LAYOUT_2_2 | // L, R, Ls, Rs, LFE
116 
117  { MOV_CH_LAYOUT_DVD_11, AV_CH_LAYOUT_4POINT1 }, // L, R, C, LFE, Cs
118  { MOV_CH_LAYOUT_AC3_3_1_1, AV_CH_LAYOUT_4POINT1 }, // L, C, R, Cs, LFE
119  { MOV_CH_LAYOUT_DTS_4_1, AV_CH_LAYOUT_4POINT1 }, // C, L, R, Cs, LFE
120  { 0, 0 },
121 };
122 
124  { MOV_CH_LAYOUT_HEXAGONAL, AV_CH_LAYOUT_HEXAGONAL }, // L, R, Rls, Rrs, C, Cs
125  { MOV_CH_LAYOUT_DTS_6_0_C, AV_CH_LAYOUT_HEXAGONAL }, // C, Cs, L, R, Rls, Rrs
126 
127  { MOV_CH_LAYOUT_MPEG_5_1_A, AV_CH_LAYOUT_5POINT1 }, // L, R, C, LFE, Ls, Rs
128  { MOV_CH_LAYOUT_MPEG_5_1_B, AV_CH_LAYOUT_5POINT1 }, // L, R, Ls, Rs, C, LFE
129  { MOV_CH_LAYOUT_MPEG_5_1_C, AV_CH_LAYOUT_5POINT1 }, // L, C, R, Ls, Rs, LFE
130  { MOV_CH_LAYOUT_MPEG_5_1_D, AV_CH_LAYOUT_5POINT1 }, // C, L, R, Ls, Rs, LFE
131 
132  { MOV_CH_LAYOUT_AUDIOUNIT_6_0, AV_CH_LAYOUT_6POINT0 }, // L, R, Ls, Rs, C, Cs
133  { MOV_CH_LAYOUT_AAC_6_0, AV_CH_LAYOUT_6POINT0 }, // C, L, R, Ls, Rs, Cs
134  { MOV_CH_LAYOUT_EAC3_6_0_A, AV_CH_LAYOUT_6POINT0 }, // L, C, R, Ls, Rs, Cs
135 
136  { MOV_CH_LAYOUT_DTS_6_0_A, AV_CH_LAYOUT_6POINT0_FRONT }, // Lc, Rc, L, R, Ls, Rs
137 
138  { MOV_CH_LAYOUT_DTS_6_0_B, AV_CH_LAYOUT_5POINT0_BACK | // C, L, R, Rls, Rrs, Ts
140  { 0, 0 },
141 };
142 
144  { MOV_CH_LAYOUT_MPEG_6_1_A, AV_CH_LAYOUT_6POINT1 }, // L, R, C, LFE, Ls, Rs, Cs
145  { MOV_CH_LAYOUT_AAC_6_1, AV_CH_LAYOUT_6POINT1 }, // C, L, R, Ls, Rs, Cs, LFE
146  { MOV_CH_LAYOUT_EAC3_6_1_A, AV_CH_LAYOUT_6POINT1 }, // L, C, R, Ls, Rs, LFE, Cs
147  { MOV_CH_LAYOUT_DTS_6_1_D, AV_CH_LAYOUT_6POINT1 }, // C, L, R, Ls, Rs, LFE, Cs
148 
149  { MOV_CH_LAYOUT_AUDIOUNIT_7_0, AV_CH_LAYOUT_7POINT0 }, // L, R, Ls, Rs, C, Rls, Rrs
150  { MOV_CH_LAYOUT_AAC_7_0, AV_CH_LAYOUT_7POINT0 }, // C, L, R, Ls, Rs, Rls, Rrs
151  { MOV_CH_LAYOUT_EAC3_7_0_A, AV_CH_LAYOUT_7POINT0 }, // L, C, R, Ls, Rs, Rls, Rrs
152 
153  { MOV_CH_LAYOUT_AUDIOUNIT_7_0_FRONT, AV_CH_LAYOUT_7POINT0_FRONT }, // L, R, Ls, Rs, C, Lc, Rc
154  { MOV_CH_LAYOUT_DTS_7_0, AV_CH_LAYOUT_7POINT0_FRONT }, // Lc, C, Rc, L, R, Ls, Rs
155 
156  { MOV_CH_LAYOUT_EAC3_6_1_B, AV_CH_LAYOUT_5POINT1 | // L, C, R, Ls, Rs, LFE, Ts
158 
159  { MOV_CH_LAYOUT_EAC3_6_1_C, AV_CH_LAYOUT_5POINT1 | // L, C, R, Ls, Rs, LFE, Vhc
161 
162  { MOV_CH_LAYOUT_DTS_6_1_A, AV_CH_LAYOUT_6POINT1_FRONT }, // Lc, Rc, L, R, Ls, Rs, LFE
163 
164  { MOV_CH_LAYOUT_DTS_6_1_B, AV_CH_LAYOUT_5POINT1_BACK | // C, L, R, Rls, Rrs, Ts, LFE
166 
167  { MOV_CH_LAYOUT_DTS_6_1_C, AV_CH_LAYOUT_6POINT1_BACK }, // C, Cs, L, R, Rls, Rrs, LFE
168  { 0, 0 },
169 };
170 
172  { MOV_CH_LAYOUT_OCTAGONAL, AV_CH_LAYOUT_OCTAGONAL }, // L, R, Rls, Rrs, C, Cs, Ls, Rs
173  { MOV_CH_LAYOUT_AAC_OCTAGONAL, AV_CH_LAYOUT_OCTAGONAL }, // C, L, R, Ls, Rs, Rls, Rrs, Cs
174 
175  { MOV_CH_LAYOUT_CUBE, AV_CH_LAYOUT_CUBE }, // L, R, Rls, Rrs, Vhl, Vhr, Rlt, Rrt
176 
177  { MOV_CH_LAYOUT_MPEG_7_1_A, AV_CH_LAYOUT_7POINT1_WIDE }, // L, R, C, LFE, Ls, Rs, Lc, Rc
178  { MOV_CH_LAYOUT_MPEG_7_1_B, AV_CH_LAYOUT_7POINT1_WIDE }, // C, Lc, Rc, L, R, Ls, Rs, LFE
179  { MOV_CH_LAYOUT_EMAGIC_DEFAULT_7_1, AV_CH_LAYOUT_7POINT1_WIDE }, // L, R, Ls, Rs, C, LFE, Lc, Rc
180  { MOV_CH_LAYOUT_EAC3_7_1_B, AV_CH_LAYOUT_7POINT1_WIDE }, // L, C, R, Ls, Rs, LFE, Lc, Rc
181  { MOV_CH_LAYOUT_DTS_7_1, AV_CH_LAYOUT_7POINT1_WIDE }, // Lc, C, Rc, L, R, Ls, Rs, LFE
182 
183  { MOV_CH_LAYOUT_MPEG_7_1_C, AV_CH_LAYOUT_7POINT1 }, // L, R, C, LFE, Ls, Rs, Rls, Rrs
184  { MOV_CH_LAYOUT_EAC3_7_1_A, AV_CH_LAYOUT_7POINT1 }, // L, C, R, Ls, Rs, LFE, Rls, Rrs
185 
186  { MOV_CH_LAYOUT_SMPTE_DTV, AV_CH_LAYOUT_5POINT1 | // L, R, C, LFE, Ls, Rs, Lt, Rt
188 
189  { MOV_CH_LAYOUT_EAC3_7_1_C, AV_CH_LAYOUT_5POINT1 | // L, C, R, Ls, Rs, LFE, Lsd, Rsd
192 
193  { MOV_CH_LAYOUT_EAC3_7_1_D, AV_CH_LAYOUT_5POINT1 | // L, C, R, Ls, Rs, LFE, Lw, Rw
196 
197  { MOV_CH_LAYOUT_EAC3_7_1_E, AV_CH_LAYOUT_5POINT1 | // L, C, R, Ls, Rs, LFE, Vhl, Vhr
200 
201  { MOV_CH_LAYOUT_EAC3_7_1_F, AV_CH_LAYOUT_5POINT1 | // L, C, R, Ls, Rs, LFE, Cs, Ts
204 
205  { MOV_CH_LAYOUT_EAC3_7_1_G, AV_CH_LAYOUT_5POINT1 | // L, C, R, Ls, Rs, LFE, Cs, Vhc
208 
209  { MOV_CH_LAYOUT_EAC3_7_1_H, AV_CH_LAYOUT_5POINT1 | // L, C, R, Ls, Rs, LFE, Ts, Vhc
212 
213  { MOV_CH_LAYOUT_DTS_8_0_A, AV_CH_LAYOUT_2_2 | // Lc, Rc, L, R, Ls, Rs, Rls, Rrs
218 
219  { MOV_CH_LAYOUT_DTS_8_0_B, AV_CH_LAYOUT_5POINT0 | // Lc, C, Rc, L, R, Ls, Cs, Rs
223  { 0, 0 },
224 };
225 
227  { MOV_CH_LAYOUT_DTS_8_1_A, AV_CH_LAYOUT_2_2 | // Lc, Rc, L, R, Ls, Rs, Rls, Rrs, LFE
233 
234  { MOV_CH_LAYOUT_DTS_8_1_B, AV_CH_LAYOUT_7POINT1_WIDE | // Lc, C, Rc, L, R, Ls, Cs, Rs, LFE
236  { 0, 0 },
237 };
238 
239 static const struct MovChannelLayoutMap * const mov_ch_layout_map[] = {
250 };
251 
276  0,
277 };
278 
294  0,
295 };
296 
306  0,
307 };
308 
321  0,
322 };
323 
324 static const struct {
327 } mov_codec_ch_layouts[] = {
343  { AV_CODEC_ID_NONE, NULL },
344 };
345 
346 /**
347  * Get the channel layout for the specified channel layout tag.
348  *
349  * @param[in] tag channel layout tag
350  * @param[out] bitmap channel bitmap (only used if needed)
351  * @return channel layout
352  */
353 static uint64_t mov_get_channel_layout(uint32_t tag, uint32_t bitmap)
354 {
355  int i, channels;
356  const struct MovChannelLayoutMap *layout_map;
357 
358  /* use ff_mov_get_channel_label() to build a layout instead */
360  return 0;
361 
362  /* handle the use of the channel bitmap */
364  return bitmap < 0x40000 ? bitmap : 0;
365 
366  /* get the layout map based on the channel count for the specified layout tag */
367  channels = tag & 0xFFFF;
368  if (channels > 9)
369  channels = 0;
370  layout_map = mov_ch_layout_map[channels];
371 
372  /* find the channel layout for the specified layout tag */
373  for (i = 0; layout_map[i].tag != 0; i++) {
374  if (layout_map[i].tag == tag)
375  break;
376  }
377  return layout_map[i].layout;
378 }
379 
380 static enum AVChannel mov_get_channel_id(uint32_t label)
381 {
382  if (label == 0)
383  return AV_CHAN_UNUSED;
384  if (label <= 18)
385  return (label - 1);
386  if (label == 35)
387  return AV_CHAN_WIDE_LEFT;
388  if (label == 36)
389  return AV_CHAN_WIDE_RIGHT;
390  if (label == 37)
392  if (label == 38)
393  return AV_CHAN_STEREO_LEFT;
394  if (label == 39)
395  return AV_CHAN_STEREO_RIGHT;
396  return AV_CHAN_UNKNOWN;
397 }
398 
400 {
401  if (channel < 0)
402  return 0;
404  return channel + 1;
405  if (channel == AV_CHAN_WIDE_LEFT)
406  return 35;
408  return 36;
410  return 37;
412  return 38;
414  return 39;
415  return 0;
416 }
417 
419  uint32_t *layout,
420  uint32_t *bitmap,
421  uint32_t **pchannel_desc)
422 {
423  int i, j;
424  uint32_t tag = 0;
425  const enum MovChannelLayoutTag *layouts = NULL;
426 
427  /* find the layout list for the specified codec */
428  for (i = 0; mov_codec_ch_layouts[i].codec_id != AV_CODEC_ID_NONE; i++) {
430  break;
431  }
433  layouts = mov_codec_ch_layouts[i].layouts;
434 
435  if (layouts) {
436  int channels;
437  const struct MovChannelLayoutMap *layout_map;
438 
439  /* get the layout map based on the channel count */
441  if (channels > 9)
442  channels = 0;
443  layout_map = mov_ch_layout_map[channels];
444 
445  /* find the layout tag for the specified channel layout */
446  for (i = 0; layouts[i] != 0; i++) {
447  if ((layouts[i] & 0xFFFF) != channels)
448  continue;
449  for (j = 0; layout_map[j].tag != 0; j++) {
450  if (layout_map[j].tag == layouts[i] &&
452  layout_map[j].layout == par->ch_layout.u.mask))
453  break;
454  }
455  if (layout_map[j].tag)
456  break;
457  }
458  tag = layouts[i];
459  }
460 
461  *layout = tag;
462  *bitmap = 0;
463  *pchannel_desc = NULL;
464 
465  /* if no tag was found, use channel bitmap or description as a backup if possible */
466  if (tag == 0) {
467  uint32_t *channel_desc;
469  par->ch_layout.u.mask < 0x40000) {
471  *bitmap = (uint32_t)par->ch_layout.u.mask;
472  return 0;
473  } else if (par->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC)
474  return AVERROR(ENOSYS);
475 
476  channel_desc = av_malloc_array(par->ch_layout.nb_channels, sizeof(*channel_desc));
477  if (!channel_desc)
478  return AVERROR(ENOMEM);
479 
480  for (i = 0; i < par->ch_layout.nb_channels; i++) {
481  channel_desc[i] =
483 
484  if (channel_desc[i] == 0) {
485  av_free(channel_desc);
486  return AVERROR(ENOSYS);
487  }
488  }
489 
490  *pchannel_desc = channel_desc;
491  }
492 
493  return 0;
494 }
495 
497  int64_t size)
498 {
499  uint32_t layout_tag, bitmap, num_descr;
500  int ret;
501  AVChannelLayout *ch_layout = &st->codecpar->ch_layout;
502 
503  if (size < 12)
504  return AVERROR_INVALIDDATA;
505 
506  layout_tag = avio_rb32(pb);
507  bitmap = avio_rb32(pb);
508  num_descr = avio_rb32(pb);
509 
510  av_log(s, AV_LOG_DEBUG, "chan: layout=%"PRIu32" "
511  "bitmap=%"PRIu32" num_descr=%"PRIu32"\n",
512  layout_tag, bitmap, num_descr);
513 
514  if (size < 12ULL + num_descr * 20ULL)
515  return 0;
516 
517  if (layout_tag == 0) {
518  int nb_channels = ch_layout->nb_channels ? ch_layout->nb_channels : num_descr;
519  if (num_descr > nb_channels) {
520  av_log(s, AV_LOG_WARNING, "got %d channel descriptions, capping to the number of channels %d\n",
521  num_descr, nb_channels);
522  num_descr = nb_channels;
523  }
524 
525  av_channel_layout_uninit(ch_layout);
526  ret = av_channel_layout_custom_init(ch_layout, nb_channels);
527  if (ret < 0)
528  goto out;
529 
530  for (int i = 0; i < num_descr; i++) {
531  uint32_t label;
532  if (pb->eof_reached) {
534  "reached EOF while reading channel layout\n");
535  return AVERROR_INVALIDDATA;
536  }
537  label = avio_rb32(pb); // mChannelLabel
538  avio_rb32(pb); // mChannelFlags
539  avio_rl32(pb); // mCoordinates[0]
540  avio_rl32(pb); // mCoordinates[1]
541  avio_rl32(pb); // mCoordinates[2]
542  size -= 20;
543  ch_layout->u.map[i].id = mov_get_channel_id(label);
544  }
545 
547  if (ret == AVERROR(ENOSYS))
549  if (ret < 0 && ret != AVERROR(ENOSYS))
550  goto out;
551  } else {
552  uint64_t mask = mov_get_channel_layout(layout_tag, bitmap);
553  if (mask) {
554  if (!ch_layout->nb_channels || av_popcount64(mask) == ch_layout->nb_channels) {
555  av_channel_layout_uninit(ch_layout);
556  av_channel_layout_from_mask(ch_layout, mask);
557  } else {
558  av_log(s, AV_LOG_WARNING, "ignoring channel layout with %d channels because number of channels is %d\n",
559  av_popcount64(mask), ch_layout->nb_channels);
560  }
561  }
562  }
563  ret = 0;
564 
565 out:
566  avio_skip(pb, size - 12);
567 
568  return ret;
569 }
570 
571 /* ISO/IEC 23001-8, 8.2 */
573  // 0: any setup
574  {0},
575 
576  // 1: centre front
578 
579  // 2: left front, right front
581 
582  // 3: centre front, left front, right front
584 
585  // 4: centre front, left front, right front, rear centre
587 
588  // 5: centre front, left front, right front, left surround, right surround
590 
591  // 6: 5 + LFE
593 
594  // 7: centre front, left front centre, right front centre,
595  // left front, right front, left surround, right surround, LFE
597 
598  // 8: channel1, channel2
600 
601  // 9: left front, right front, rear centre
603 
604  // 10: left front, right front, left surround, right surround
606 
607  // 11: centre front, left front, right front, left surround, right surround, rear centre, LFE
609 
610  // 12: centre front, left front, right front
611  // left surround, right surround
612  // rear surround left, rear surround right
613  // LFE
615 
616  // 13:
618 
619  // 14:
621 
622  // TODO: 15 - 20
623 };
624 
625 /* ISO/IEC 23001-8, table 8 */
626 static const enum AVChannel iso_channel_position[] = {
627  // 0: left front
629 
630  // 1: right front
632 
633  // 2: centre front
635 
636  // 3: low frequence enhancement
638 
639  // 4: left surround
640  // TODO
641  AV_CHAN_NONE,
642 
643  // 5: right surround
644  // TODO
645  AV_CHAN_NONE,
646 
647  // 6: left front centre
649 
650  // 7: right front centre
652 
653  // 8: rear surround left
655 
656  // 9: rear surround right
658 
659  // 10: rear centre
661 
662  // 11: left surround direct
664 
665  // 12: right surround direct
667 
668  // 13: left side surround
670 
671  // 14: right side surround
673 
674  // 15: left wide front
676 
677  // 16: right wide front
679 
680  // 17: left front vertical height
682 
683  // 18: right front vertical height
685 
686  // 19: centre front vertical height
688 
689  // 20: left surround vertical height rear
691 
692  // 21: right surround vertical height rear
694 
695  // 22: centre vertical height rear
697 
698  // 23: left vertical height side surround
700 
701  // 24: right vertical height side surround
703 
704  // 25: top centre surround
706 
707  // 26: low frequency enhancement 2
709 
710  // 27: left front vertical bottom
712 
713  // 28: right front vertical bottom
715 
716  // 29: centre front vertical bottom
718 
719  // 30: left vertical height surround
720  // TODO
721  AV_CHAN_NONE,
722 
723  // 31: right vertical height surround
724  // TODO
725  AV_CHAN_NONE,
726 
727  // 32, 33, 34, 35, reserved
728  AV_CHAN_NONE,
729  AV_CHAN_NONE,
730  AV_CHAN_NONE,
731  AV_CHAN_NONE,
732 
733  // 36: low frequency enhancement 3
734  AV_CHAN_NONE,
735 
736  // 37: left edge of screen
737  AV_CHAN_NONE,
738  // 38: right edge of screen
739  AV_CHAN_NONE,
740  // 39: half-way between centre of screen and left edge of screen
741  AV_CHAN_NONE,
742  // 40: half-way between centre of screen and right edge of screen
743  AV_CHAN_NONE,
744 
745  // 41: left back surround
746  AV_CHAN_NONE,
747 
748  // 42: right back surround
749  AV_CHAN_NONE,
750 
751  // 43 - 125: reserved
752  // 126: explicit position
753  // 127: unknown /undefined
754 };
755 
757 {
758  // Set default value which means any setup in 23001-8
759  *config = 0;
760  for (int i = 0; i < FF_ARRAY_ELEMS(iso_channel_configuration); i++) {
762  *config = i;
763  break;
764  }
765  }
766 
767  return 0;
768 }
769 
771 {
774  return 0;
775  }
776 
777  return -1;
778 }
779 
781  uint8_t *position, int position_num)
782 {
783  enum AVChannel channel;
784 
785  if (position_num < layout->nb_channels)
786  return AVERROR(EINVAL);
787 
788  for (int i = 0; i < layout->nb_channels; i++) {
789  position[i] = 127;
791  if (channel == AV_CHAN_NONE)
792  return AVERROR(EINVAL);
793 
794  for (int j = 0; j < FF_ARRAY_ELEMS(iso_channel_position); j++) {
795  if (iso_channel_position[j] == channel) {
796  position[i] = j;
797  break;
798  }
799  }
800  if (position[i] == 127)
801  return AVERROR(EINVAL);
802  }
803 
804  return 0;
805 }
806 
808 {
809  int stream_structure = avio_r8(pb);
810  int ret;
811 
812  // stream carries channels
813  if (stream_structure & 1) {
814  int layout = avio_r8(pb);
815 
816  av_log(s, AV_LOG_TRACE, "'chnl' layout %d\n", layout);
817  if (!layout) {
818  AVChannelLayout *ch_layout = &st->codecpar->ch_layout;
819  int nb_channels = ch_layout->nb_channels;
820 
821  av_channel_layout_uninit(ch_layout);
822  ret = av_channel_layout_custom_init(ch_layout, nb_channels);
823  if (ret < 0)
824  return ret;
825 
826  for (int i = 0; i < nb_channels; i++) {
827  int speaker_pos = avio_r8(pb);
828  enum AVChannel channel;
829 
830  if (speaker_pos == 126) // explicit position
831  avio_skip(pb, 3); // azimuth, elevation
832 
833  if (speaker_pos >= FF_ARRAY_ELEMS(iso_channel_position))
835  else
836  channel = iso_channel_position[speaker_pos];
837 
838  if (channel == AV_CHAN_NONE) {
839  av_log(s, AV_LOG_WARNING, "speaker position %d is not implemented\n", speaker_pos);
841  }
842 
843  ch_layout->u.map[i].id = channel;
844  }
845 
847  if (ret == AVERROR(ENOSYS))
849  if (ret < 0 && ret != AVERROR(ENOSYS))
850  return ret;
851  } else {
852  uint64_t omitted_channel_map = avio_rb64(pb);
853 
854  if (omitted_channel_map) {
855  avpriv_request_sample(s, "omitted_channel_map 0x%" PRIx64 " != 0",
856  omitted_channel_map);
857  return AVERROR_PATCHWELCOME;
858  }
860  }
861  }
862 
863  // stream carries objects
864  if (stream_structure & 2) {
865  int obj_count = avio_r8(pb);
866  av_log(s, AV_LOG_TRACE, "'chnl' with object_count %d\n", obj_count);
867  }
868 
869  return 0;
870 }
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:331
AV_CH_LAYOUT_7POINT0
#define AV_CH_LAYOUT_7POINT0
Definition: channel_layout.h:235
MOV_CH_LAYOUT_EAC3_7_1_D
@ MOV_CH_LAYOUT_EAC3_7_1_D
Definition: mov_chan.h:118
AV_CH_LAYOUT_6POINT1
#define AV_CH_LAYOUT_6POINT1
Definition: channel_layout.h:232
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:351
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:423
MOV_CH_LAYOUT_EAC3_7_1_H
@ MOV_CH_LAYOUT_EAC3_7_1_H
Definition: mov_chan.h:122
AV_CH_LAYOUT_5POINT0_BACK
#define AV_CH_LAYOUT_5POINT0_BACK
Definition: channel_layout.h:226
AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: codec_id.h:446
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
AV_CH_TOP_FRONT_CENTER
#define AV_CH_TOP_FRONT_CENTER
Definition: channel_layout.h:181
out
FILE * out
Definition: movenc.c:54
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:389
codec_id
enum AVCodecID codec_id
Definition: mov_chan.c:325
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:326
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
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:214
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:364
AV_CHANNEL_LAYOUT_2_2
#define AV_CHANNEL_LAYOUT_2_2
Definition: channel_layout.h:396
AV_CH_TOP_FRONT_RIGHT
#define AV_CH_TOP_FRONT_RIGHT
Definition: channel_layout.h:182
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:867
MOV_CH_LAYOUT_AUDIOUNIT_7_0
@ MOV_CH_LAYOUT_AUDIOUNIT_7_0
Definition: mov_chan.h:96
AV_CH_LAYOUT_HEXAGONAL
#define AV_CH_LAYOUT_HEXAGONAL
Definition: channel_layout.h:230
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:459
AV_CH_LAYOUT_6POINT0_FRONT
#define AV_CH_LAYOUT_6POINT0_FRONT
Definition: channel_layout.h:229
AV_CH_LAYOUT_6POINT1_FRONT
#define AV_CH_LAYOUT_6POINT1_FRONT
Definition: channel_layout.h:234
AV_CH_TOP_FRONT_LEFT
#define AV_CH_TOP_FRONT_LEFT
Definition: channel_layout.h:180
MOV_CH_LAYOUT_AMBISONIC_B_FORMAT
@ MOV_CH_LAYOUT_AMBISONIC_B_FORMAT
Definition: mov_chan.h:63
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:318
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:345
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:323
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:418
AV_CH_WIDE_LEFT
#define AV_CH_WIDE_LEFT
Definition: channel_layout.h:188
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
AV_CH_SURROUND_DIRECT_RIGHT
#define AV_CH_SURROUND_DIRECT_RIGHT
Definition: channel_layout.h:191
AV_CH_WIDE_RIGHT
#define AV_CH_WIDE_RIGHT
Definition: channel_layout.h:189
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_CH_LAYOUT_6POINT0
#define AV_CH_LAYOUT_6POINT0
Definition: channel_layout.h:228
AV_CHANNEL_LAYOUT_7POINT1_WIDE
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE
Definition: channel_layout.h:412
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:770
AV_CHAN_SURROUND_DIRECT_LEFT
@ AV_CHAN_SURROUND_DIRECT_LEFT
Definition: channel_layout.h:74
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:332
AV_CHAN_TOP_BACK_RIGHT
@ AV_CHAN_TOP_BACK_RIGHT
Definition: channel_layout.h:67
AV_CH_BACK_LEFT
#define AV_CH_BACK_LEFT
Definition: channel_layout.h:172
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:426
mov_get_channel_layout
static uint64_t mov_get_channel_layout(uint32_t tag, uint32_t bitmap)
Get the channel layout for the specified channel layout tag.
Definition: mov_chan.c:353
mov_ch_layouts_alac
static enum MovChannelLayoutTag mov_ch_layouts_alac[]
Definition: mov_chan.c:297
MOV_CH_LAYOUT_DTS_6_0_B
@ MOV_CH_LAYOUT_DTS_6_0_B
Definition: mov_chan.h:126
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:215
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:392
AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_QUAD
Definition: channel_layout.h:223
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
AV_CODEC_ID_PCM_S8
@ AV_CODEC_ID_PCM_S8
Definition: codec_id.h:335
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:808
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
AV_CH_LOW_FREQUENCY
#define AV_CH_LOW_FREQUENCY
Definition: channel_layout.h:171
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
mask
static const uint16_t mask[17]
Definition: lzw.c:38
AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_4POINT0
Definition: channel_layout.h:394
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:411
s
#define s(width, name)
Definition: cbs_vp9.c:198
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
mov_ch_layout_map_7ch
static const struct MovChannelLayoutMap mov_ch_layout_map_7ch[]
Definition: mov_chan.c:143
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:421
MOV_CH_LAYOUT_DTS_8_1_A
@ MOV_CH_LAYOUT_DTS_8_1_A
Definition: mov_chan.h:136
AV_CH_LAYOUT_7POINT0_FRONT
#define AV_CH_LAYOUT_7POINT0_FRONT
Definition: channel_layout.h:236
AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_STEREO_DOWNMIX
Definition: channel_layout.h:249
AV_CHAN_SIDE_RIGHT
@ AV_CHAN_SIDE_RIGHT
Definition: channel_layout.h:60
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
MOV_CH_LAYOUT_PENTAGONAL
@ MOV_CH_LAYOUT_PENTAGONAL
Definition: mov_chan.h:65
iso_channel_configuration
static const AVChannelLayout iso_channel_configuration[]
Definition: mov_chan.c:572
AV_CHAN_TOP_SIDE_LEFT
@ AV_CHAN_TOP_SIDE_LEFT
Definition: channel_layout.h:77
AV_CH_LAYOUT_2_1
#define AV_CH_LAYOUT_2_1
Definition: channel_layout.h:217
AV_CHAN_TOP_SIDE_RIGHT
@ AV_CHAN_TOP_SIDE_RIGHT
Definition: channel_layout.h:78
AVFormatContext
Format I/O context.
Definition: avformat.h:1363
MOV_CH_LAYOUT_SMPTE_DTV
@ MOV_CH_LAYOUT_SMPTE_DTV
Definition: mov_chan.h:86
AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS
#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS
The conversion must be lossless.
Definition: channel_layout.h:831
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:864
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
AV_CH_TOP_CENTER
#define AV_CH_TOP_CENTER
Definition: channel_layout.h:179
mov_ch_layout_map_1ch
static const struct MovChannelLayoutMap mov_ch_layout_map_1ch[]
Definition: mov_chan.c:52
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_CHAN_TOP_BACK_CENTER
@ AV_CHAN_TOP_BACK_CENTER
Definition: channel_layout.h:66
MOV_CH_LAYOUT_UNKNOWN
#define MOV_CH_LAYOUT_UNKNOWN
Definition: mov_chan.h:52
avio_rb64
uint64_t avio_rb64(AVIOContext *s)
Definition: aviobuf.c:955
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
AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_5POINT1
Definition: channel_layout.h:225
mov_get_channel_id
static enum AVChannel mov_get_channel_id(uint32_t label)
Definition: mov_chan.c:380
MovChannelLayoutMap::layout
uint64_t layout
Definition: mov_chan.c:34
AV_CHAN_BOTTOM_FRONT_RIGHT
@ AV_CHAN_BOTTOM_FRONT_RIGHT
Definition: channel_layout.h:81
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:780
AV_CHAN_TOP_CENTER
@ AV_CHAN_TOP_CENTER
Definition: channel_layout.h:61
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:206
AV_CH_FRONT_LEFT_OF_CENTER
#define AV_CH_FRONT_LEFT_OF_CENTER
Definition: channel_layout.h:174
MOV_CH_LAYOUT_CUBE
@ MOV_CH_LAYOUT_CUBE
Definition: mov_chan.h:68
MovChannelLayoutMap
mov 'chan' tag reading/writing.
Definition: mov_chan.c:32
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:424
AVChannelLayout::u
union AVChannelLayout::@346 u
Details about which channels are present in this layout.
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:445
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:756
MOV_CH_LAYOUT_EAC3_6_1_C
@ MOV_CH_LAYOUT_EAC3_6_1_C
Definition: mov_chan.h:114
avio_rl32
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:777
AVIOContext
Bytestream IO Context.
Definition: avio.h:166
AV_CODEC_ID_PCM_S24LE
@ AV_CODEC_ID_PCM_S24LE
Definition: codec_id.h:343
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:313
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
MOV_CH_LAYOUT_DISCRETEINORDER
@ MOV_CH_LAYOUT_DISCRETEINORDER
Definition: mov_chan.h:55
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:650
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:1079
MOV_CH_LAYOUT_DTS_6_1_A
@ MOV_CH_LAYOUT_DTS_6_1_A
Definition: mov_chan.h:128
AV_CH_LAYOUT_5POINT1_BACK
#define AV_CH_LAYOUT_5POINT1_BACK
Definition: channel_layout.h:227
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_CH_FRONT_RIGHT_OF_CENTER
#define AV_CH_FRONT_RIGHT_OF_CENTER
Definition: channel_layout.h:175
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
mov_codec_ch_layouts
static const struct @323 mov_codec_ch_layouts[]
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:1003
AV_CH_LAYOUT_3POINT1
#define AV_CH_LAYOUT_3POINT1
Definition: channel_layout.h:219
av_channel_layout_custom_init
FF_ENABLE_DEPRECATION_WARNINGS 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:401
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_map_5ch
static const struct MovChannelLayoutMap mov_ch_layout_map_5ch[]
Definition: mov_chan.c:104
AV_CH_LAYOUT_OCTAGONAL
#define AV_CH_LAYOUT_OCTAGONAL
Definition: channel_layout.h:241
AV_CH_LAYOUT_5POINT0
#define AV_CH_LAYOUT_5POINT0
Definition: channel_layout.h:224
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
mov_ch_layout_map_9ch
static const struct MovChannelLayoutMap mov_ch_layout_map_9ch[]
Definition: mov_chan.c:226
mov_ch_layout_map_8ch
static const struct MovChannelLayoutMap mov_ch_layout_map_8ch[]
Definition: mov_chan.c:171
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
AV_CH_LAYOUT_2POINT1
#define AV_CH_LAYOUT_2POINT1
Definition: channel_layout.h:216
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
AV_CH_LAYOUT_7POINT1
#define AV_CH_LAYOUT_7POINT1
Definition: channel_layout.h:237
AV_CODEC_ID_PCM_F64BE
@ AV_CODEC_ID_PCM_F64BE
Definition: codec_id.h:353
AV_CH_LAYOUT_4POINT1
#define AV_CH_LAYOUT_4POINT1
Definition: channel_layout.h:221
AV_CH_BACK_CENTER
#define AV_CH_BACK_CENTER
Definition: channel_layout.h:176
MOV_CH_LAYOUT_MPEG_6_1_A
@ MOV_CH_LAYOUT_MPEG_6_1_A
Definition: mov_chan.h:81
AV_CH_LAYOUT_7POINT1_WIDE
#define AV_CH_LAYOUT_7POINT1_WIDE
Definition: channel_layout.h:238
AV_CODEC_ID_PCM_S32BE
@ AV_CODEC_ID_PCM_S32BE
Definition: codec_id.h:340
MOV_CH_LAYOUT_AUDIOUNIT_6_0
@ MOV_CH_LAYOUT_AUDIOUNIT_6_0
Definition: mov_chan.h:95
mov_ch_layout_map
static const struct MovChannelLayoutMap *const mov_ch_layout_map[]
Definition: mov_chan.c:239
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:33
MOV_CH_LAYOUT_MPEG_5_0_C
@ MOV_CH_LAYOUT_MPEG_5_0_C
Definition: mov_chan.h:75
mov_chan.h
tag
uint32_t tag
Definition: movenc.c:1786
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:841
AV_CH_LAYOUT_SURROUND
#define AV_CH_LAYOUT_SURROUND
Definition: channel_layout.h:218
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
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:391
AV_CHAN_NONE
@ AV_CHAN_NONE
Invalid channel index.
Definition: channel_layout.h:49
mov_ch_layout_map_6ch
static const struct MovChannelLayoutMap mov_ch_layout_map_6ch[]
Definition: mov_chan.c:123
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:662
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
AVIOContext::eof_reached
int eof_reached
true if was unable to read due to error or eof
Definition: avio.h:248
AV_CH_SURROUND_DIRECT_LEFT
#define AV_CH_SURROUND_DIRECT_LEFT
Definition: channel_layout.h:190
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:365
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:669
mov_ch_layouts_aac
static enum MovChannelLayoutTag mov_ch_layouts_aac[]
Definition: mov_chan.c:252
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
iso_channel_position
static enum AVChannel iso_channel_position[]
Definition: mov_chan.c:626
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:339
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:399
mov_ch_layout_map_2ch
static const struct MovChannelLayoutMap mov_ch_layout_map_2ch[]
Definition: mov_chan.c:57
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:336
MOV_CH_LAYOUT_EAC3_7_1_E
@ MOV_CH_LAYOUT_EAC3_7_1_E
Definition: mov_chan.h:119
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:388
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:354
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
MOV_CH_LAYOUT_DTS_6_1_B
@ MOV_CH_LAYOUT_DTS_6_1_B
Definition: mov_chan.h:129
AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_4POINT0
Definition: channel_layout.h:220
AV_CH_LAYOUT_6POINT1_BACK
#define AV_CH_LAYOUT_6POINT1_BACK
Definition: channel_layout.h:233
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:807
AV_CODEC_ID_PCM_F32LE
@ AV_CODEC_ID_PCM_F32LE
Definition: codec_id.h:352
mov_ch_layout_map_3ch
static const struct MovChannelLayoutMap mov_ch_layout_map_3ch[]
Definition: mov_chan.c:71
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AV_CHANNEL_LAYOUT_6POINT1
#define AV_CHANNEL_LAYOUT_6POINT1
Definition: channel_layout.h:406
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AV_CH_BACK_RIGHT
#define AV_CH_BACK_RIGHT
Definition: channel_layout.h:173
AV_CH_LAYOUT_CUBE
#define AV_CH_LAYOUT_CUBE
Definition: channel_layout.h:242
mov_ch_layout_map_misc
static const struct MovChannelLayoutMap mov_ch_layout_map_misc[]
Definition: mov_chan.c:37
AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_5POINT0
Definition: channel_layout.h:398
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
AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_5POINT1
Definition: channel_layout.h:399
MOV_CH_LAYOUT_TMH_10_2_STD
@ MOV_CH_LAYOUT_TMH_10_2_STD
Definition: mov_chan.h:102
mov_ch_layouts_wav
static enum MovChannelLayoutTag mov_ch_layouts_wav[]
Definition: mov_chan.c:309
AV_CODEC_ID_PCM_S24BE
@ AV_CODEC_ID_PCM_S24BE
Definition: codec_id.h:344
MOV_CH_LAYOUT_EAC3_7_1_F
@ MOV_CH_LAYOUT_EAC3_7_1_F
Definition: mov_chan.h:120
AV_CH_LAYOUT_2_2
#define AV_CH_LAYOUT_2_2
Definition: channel_layout.h:222
mov_ch_layouts_ac3
static enum MovChannelLayoutTag mov_ch_layouts_ac3[]
Definition: mov_chan.c:279
AVChannelCustom::id
enum AVChannel id
Definition: channel_layout.h:278
channel
channel
Definition: ebur128.h:39
MOV_CH_LAYOUT_XY
@ MOV_CH_LAYOUT_XY
Definition: mov_chan.h:61
MOV_CH_LAYOUT_EAC3_6_1_B
@ MOV_CH_LAYOUT_EAC3_6_1_B
Definition: mov_chan.h:113
mov_ch_layout_map_4ch
static const struct MovChannelLayoutMap mov_ch_layout_map_4ch[]
Definition: mov_chan.c:82
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:496