FFmpeg
mov_chan.h
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 #ifndef AVFORMAT_MOV_CHAN_H
27 #define AVFORMAT_MOV_CHAN_H
28 
29 #include <stdint.h>
30 
32 #include "libavcodec/codec_id.h"
33 #include "libavcodec/codec_par.h"
34 #include "avformat.h"
35 
36 /**
37  * Channel Layout Tag
38  * This tells which channels are present in the audio stream and the order in
39  * which they appear.
40  *
41  * @note We're using the channel layout tag to indicate channel order
42  * when the value is greater than 0x10000. The Apple documentation has
43  * some contradictions as to how this is actually supposed to be handled.
44  *
45  * Core Audio File Format Spec:
46  * "The high 16 bits indicates a specific ordering of the channels."
47  * Core Audio Data Types Reference:
48  * "These identifiers specify the channels included in a layout but
49  * do not specify a particular ordering of those channels."
50  */
52 #define MOV_CH_LAYOUT_UNKNOWN 0xFFFF0000
54  MOV_CH_LAYOUT_USE_BITMAP = ( 1 << 16) | 0,
55  MOV_CH_LAYOUT_DISCRETEINORDER = (147 << 16) | 0,
56  MOV_CH_LAYOUT_MONO = (100 << 16) | 1,
57  MOV_CH_LAYOUT_STEREO = (101 << 16) | 2,
58  MOV_CH_LAYOUT_STEREOHEADPHONES = (102 << 16) | 2,
59  MOV_CH_LAYOUT_MATRIXSTEREO = (103 << 16) | 2,
60  MOV_CH_LAYOUT_MIDSIDE = (104 << 16) | 2,
61  MOV_CH_LAYOUT_XY = (105 << 16) | 2,
62  MOV_CH_LAYOUT_BINAURAL = (106 << 16) | 2,
64  MOV_CH_LAYOUT_QUADRAPHONIC = (108 << 16) | 4,
65  MOV_CH_LAYOUT_PENTAGONAL = (109 << 16) | 5,
66  MOV_CH_LAYOUT_HEXAGONAL = (110 << 16) | 6,
67  MOV_CH_LAYOUT_OCTAGONAL = (111 << 16) | 8,
68  MOV_CH_LAYOUT_CUBE = (112 << 16) | 8,
69  MOV_CH_LAYOUT_MPEG_3_0_A = (113 << 16) | 3,
70  MOV_CH_LAYOUT_MPEG_3_0_B = (114 << 16) | 3,
71  MOV_CH_LAYOUT_MPEG_4_0_A = (115 << 16) | 4,
72  MOV_CH_LAYOUT_MPEG_4_0_B = (116 << 16) | 4,
73  MOV_CH_LAYOUT_MPEG_5_0_A = (117 << 16) | 5,
74  MOV_CH_LAYOUT_MPEG_5_0_B = (118 << 16) | 5,
75  MOV_CH_LAYOUT_MPEG_5_0_C = (119 << 16) | 5,
76  MOV_CH_LAYOUT_MPEG_5_0_D = (120 << 16) | 5,
77  MOV_CH_LAYOUT_MPEG_5_1_A = (121 << 16) | 6,
78  MOV_CH_LAYOUT_MPEG_5_1_B = (122 << 16) | 6,
79  MOV_CH_LAYOUT_MPEG_5_1_C = (123 << 16) | 6,
80  MOV_CH_LAYOUT_MPEG_5_1_D = (124 << 16) | 6,
81  MOV_CH_LAYOUT_MPEG_6_1_A = (125 << 16) | 7,
82  MOV_CH_LAYOUT_MPEG_7_1_A = (126 << 16) | 8,
83  MOV_CH_LAYOUT_MPEG_7_1_B = (127 << 16) | 8,
84  MOV_CH_LAYOUT_MPEG_7_1_C = (128 << 16) | 8,
86  MOV_CH_LAYOUT_SMPTE_DTV = (130 << 16) | 8,
87  MOV_CH_LAYOUT_ITU_2_1 = (131 << 16) | 3,
88  MOV_CH_LAYOUT_ITU_2_2 = (132 << 16) | 4,
89  MOV_CH_LAYOUT_DVD_4 = (133 << 16) | 3,
90  MOV_CH_LAYOUT_DVD_5 = (134 << 16) | 4,
91  MOV_CH_LAYOUT_DVD_6 = (135 << 16) | 5,
92  MOV_CH_LAYOUT_DVD_10 = (136 << 16) | 4,
93  MOV_CH_LAYOUT_DVD_11 = (137 << 16) | 5,
94  MOV_CH_LAYOUT_DVD_18 = (138 << 16) | 5,
95  MOV_CH_LAYOUT_AUDIOUNIT_6_0 = (139 << 16) | 6,
96  MOV_CH_LAYOUT_AUDIOUNIT_7_0 = (140 << 16) | 7,
98  MOV_CH_LAYOUT_AAC_6_0 = (141 << 16) | 6,
99  MOV_CH_LAYOUT_AAC_6_1 = (142 << 16) | 7,
100  MOV_CH_LAYOUT_AAC_7_0 = (143 << 16) | 7,
101  MOV_CH_LAYOUT_AAC_OCTAGONAL = (144 << 16) | 8,
102  MOV_CH_LAYOUT_TMH_10_2_STD = (145 << 16) | 16,
103  MOV_CH_LAYOUT_TMH_10_2_FULL = (146 << 16) | 21,
104  MOV_CH_LAYOUT_AC3_1_0_1 = (149 << 16) | 2,
105  MOV_CH_LAYOUT_AC3_3_0 = (150 << 16) | 3,
106  MOV_CH_LAYOUT_AC3_3_1 = (151 << 16) | 4,
107  MOV_CH_LAYOUT_AC3_3_0_1 = (152 << 16) | 4,
108  MOV_CH_LAYOUT_AC3_2_1_1 = (153 << 16) | 4,
109  MOV_CH_LAYOUT_AC3_3_1_1 = (154 << 16) | 5,
110  MOV_CH_LAYOUT_EAC3_6_0_A = (155 << 16) | 6,
111  MOV_CH_LAYOUT_EAC3_7_0_A = (156 << 16) | 7,
112  MOV_CH_LAYOUT_EAC3_6_1_A = (157 << 16) | 7,
113  MOV_CH_LAYOUT_EAC3_6_1_B = (158 << 16) | 7,
114  MOV_CH_LAYOUT_EAC3_6_1_C = (159 << 16) | 7,
115  MOV_CH_LAYOUT_EAC3_7_1_A = (160 << 16) | 8,
116  MOV_CH_LAYOUT_EAC3_7_1_B = (161 << 16) | 8,
117  MOV_CH_LAYOUT_EAC3_7_1_C = (162 << 16) | 8,
118  MOV_CH_LAYOUT_EAC3_7_1_D = (163 << 16) | 8,
119  MOV_CH_LAYOUT_EAC3_7_1_E = (164 << 16) | 8,
120  MOV_CH_LAYOUT_EAC3_7_1_F = (165 << 16) | 8,
121  MOV_CH_LAYOUT_EAC3_7_1_G = (166 << 16) | 8,
122  MOV_CH_LAYOUT_EAC3_7_1_H = (167 << 16) | 8,
123  MOV_CH_LAYOUT_DTS_3_1 = (168 << 16) | 4,
124  MOV_CH_LAYOUT_DTS_4_1 = (169 << 16) | 5,
125  MOV_CH_LAYOUT_DTS_6_0_A = (170 << 16) | 6,
126  MOV_CH_LAYOUT_DTS_6_0_B = (171 << 16) | 6,
127  MOV_CH_LAYOUT_DTS_6_0_C = (172 << 16) | 6,
128  MOV_CH_LAYOUT_DTS_6_1_A = (173 << 16) | 7,
129  MOV_CH_LAYOUT_DTS_6_1_B = (174 << 16) | 7,
130  MOV_CH_LAYOUT_DTS_6_1_C = (175 << 16) | 7,
131  MOV_CH_LAYOUT_DTS_6_1_D = (182 << 16) | 7,
132  MOV_CH_LAYOUT_DTS_7_0 = (176 << 16) | 7,
133  MOV_CH_LAYOUT_DTS_7_1 = (177 << 16) | 8,
134  MOV_CH_LAYOUT_DTS_8_0_A = (178 << 16) | 8,
135  MOV_CH_LAYOUT_DTS_8_0_B = (179 << 16) | 8,
136  MOV_CH_LAYOUT_DTS_8_1_A = (180 << 16) | 9,
137  MOV_CH_LAYOUT_DTS_8_1_B = (181 << 16) | 9,
138 };
139 
140 /**
141  * Get the channel layout tag for the specified codec id and channel layout.
142  * If the layout tag was not found, use a channel bitmap if possible.
143  *
144  * @param[in] codec_id codec id
145  * @param[in] channel_layout channel layout
146  * @param[out] bitmap channel bitmap
147  * @return channel layout tag
148  */
150  uint32_t *layout,
151  uint32_t *bitmap,
152  uint32_t **pchannel_desc);
153 
154 /**
155  * Read 'chan' tag from the input stream.
156  *
157  * @param s AVFormatContext
158  * @param pb AVIOContext
159  * @param st The stream to set codec values for
160  * @param size Remaining size in the 'chan' tag
161  * @return 0 if ok, or negative AVERROR code on failure
162  */
164  int64_t size);
165 
166 #endif /* AVFORMAT_MOV_CHAN_H */
MOV_CH_LAYOUT_QUADRAPHONIC
@ MOV_CH_LAYOUT_QUADRAPHONIC
Definition: mov_chan.h:64
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
MOV_CH_LAYOUT_DVD_6
@ MOV_CH_LAYOUT_DVD_6
Definition: mov_chan.h:91
MOV_CH_LAYOUT_EAC3_7_1_H
@ MOV_CH_LAYOUT_EAC3_7_1_H
Definition: mov_chan.h:122
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
MOV_CH_LAYOUT_MPEG_5_1_A
@ MOV_CH_LAYOUT_MPEG_5_1_A
Definition: mov_chan.h:77
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:54
MOV_CH_LAYOUT_DTS_6_1_D
@ MOV_CH_LAYOUT_DTS_6_1_D
Definition: mov_chan.h:131
MOV_CH_LAYOUT_DTS_8_0_A
@ MOV_CH_LAYOUT_DTS_8_0_A
Definition: mov_chan.h:134
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
MOV_CH_LAYOUT_AUDIOUNIT_7_0
@ MOV_CH_LAYOUT_AUDIOUNIT_7_0
Definition: mov_chan.h:96
MOV_CH_LAYOUT_EAC3_7_1_B
@ MOV_CH_LAYOUT_EAC3_7_1_B
Definition: mov_chan.h:116
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
MOV_CH_LAYOUT_AAC_7_0
@ MOV_CH_LAYOUT_AAC_7_0
Definition: mov_chan.h:100
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
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
MOV_CH_LAYOUT_MPEG_5_1_D
@ MOV_CH_LAYOUT_MPEG_5_1_D
Definition: mov_chan.h:80
MOV_CH_LAYOUT_DTS_6_0_B
@ MOV_CH_LAYOUT_DTS_6_0_B
Definition: mov_chan.h:126
MOV_CH_LAYOUT_MONO
@ MOV_CH_LAYOUT_MONO
Definition: mov_chan.h:56
MOV_CH_LAYOUT_ITU_2_2
@ MOV_CH_LAYOUT_ITU_2_2
Definition: mov_chan.h:88
MOV_CH_LAYOUT_DTS_8_0_B
@ MOV_CH_LAYOUT_DTS_8_0_B
Definition: mov_chan.h:135
MOV_CH_LAYOUT_EAC3_7_1_G
@ MOV_CH_LAYOUT_EAC3_7_1_G
Definition: mov_chan.h:121
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
MOV_CH_LAYOUT_AAC_6_0
@ MOV_CH_LAYOUT_AAC_6_0
Definition: mov_chan.h:98
s
#define s(width, name)
Definition: cbs_vp9.c:256
MOV_CH_LAYOUT_EAC3_6_1_A
@ MOV_CH_LAYOUT_EAC3_6_1_A
Definition: mov_chan.h:112
MOV_CH_LAYOUT_DTS_8_1_A
@ MOV_CH_LAYOUT_DTS_8_1_A
Definition: mov_chan.h:136
MOV_CH_LAYOUT_AC3_3_1
@ MOV_CH_LAYOUT_AC3_3_1
Definition: mov_chan.h:106
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
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
AVFormatContext
Format I/O context.
Definition: avformat.h:1216
MOV_CH_LAYOUT_SMPTE_DTV
@ MOV_CH_LAYOUT_SMPTE_DTV
Definition: mov_chan.h:86
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
MOV_CH_LAYOUT_DTS_4_1
@ MOV_CH_LAYOUT_DTS_4_1
Definition: mov_chan.h:124
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_CH_LAYOUT_MPEG_3_0_B
@ MOV_CH_LAYOUT_MPEG_3_0_B
Definition: mov_chan.h:70
MOV_CH_LAYOUT_CUBE
@ MOV_CH_LAYOUT_CUBE
Definition: mov_chan.h:68
MOV_CH_LAYOUT_EAC3_6_1_C
@ MOV_CH_LAYOUT_EAC3_6_1_C
Definition: mov_chan.h:114
AVIOContext
Bytestream IO Context.
Definition: avio.h:166
MOV_CH_LAYOUT_AAC_6_1
@ MOV_CH_LAYOUT_AAC_6_1
Definition: mov_chan.h:99
MOV_CH_LAYOUT_DVD_5
@ MOV_CH_LAYOUT_DVD_5
Definition: mov_chan.h:90
size
int size
Definition: twinvq_data.h:10344
MOV_CH_LAYOUT_STEREOHEADPHONES
@ MOV_CH_LAYOUT_STEREOHEADPHONES
Definition: mov_chan.h:58
MOV_CH_LAYOUT_DISCRETEINORDER
@ MOV_CH_LAYOUT_DISCRETEINORDER
Definition: mov_chan.h:55
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
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
MOV_CH_LAYOUT_DVD_18
@ MOV_CH_LAYOUT_DVD_18
Definition: mov_chan.h:94
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
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_MPEG_6_1_A
@ MOV_CH_LAYOUT_MPEG_6_1_A
Definition: mov_chan.h:81
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
MOV_CH_LAYOUT_MPEG_4_0_B
@ MOV_CH_LAYOUT_MPEG_4_0_B
Definition: mov_chan.h:72
MOV_CH_LAYOUT_MPEG_5_0_C
@ MOV_CH_LAYOUT_MPEG_5_0_C
Definition: mov_chan.h:75
AVStream
Stream structure.
Definition: avformat.h:948
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
avformat.h
channel_layout.h
MOV_CH_LAYOUT_OCTAGONAL
@ MOV_CH_LAYOUT_OCTAGONAL
Definition: mov_chan.h:67
MOV_CH_LAYOUT_EAC3_7_1_A
@ MOV_CH_LAYOUT_EAC3_7_1_A
Definition: mov_chan.h:115
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
MOV_CH_LAYOUT_MPEG_7_1_C
@ MOV_CH_LAYOUT_MPEG_7_1_C
Definition: mov_chan.h:84
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
MOV_CH_LAYOUT_DTS_3_1
@ MOV_CH_LAYOUT_DTS_3_1
Definition: mov_chan.h:123
MOV_CH_LAYOUT_EAC3_7_1_E
@ MOV_CH_LAYOUT_EAC3_7_1_E
Definition: mov_chan.h:119
MOV_CH_LAYOUT_AC3_3_1_1
@ MOV_CH_LAYOUT_AC3_3_1_1
Definition: mov_chan.h:109
codec_par.h
MOV_CH_LAYOUT_DTS_7_0
@ MOV_CH_LAYOUT_DTS_7_0
Definition: mov_chan.h:132
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
MOV_CH_LAYOUT_MIDSIDE
@ MOV_CH_LAYOUT_MIDSIDE
Definition: mov_chan.h:60
MOV_CH_LAYOUT_TMH_10_2_STD
@ MOV_CH_LAYOUT_TMH_10_2_STD
Definition: mov_chan.h:102
MOV_CH_LAYOUT_EAC3_7_1_F
@ MOV_CH_LAYOUT_EAC3_7_1_F
Definition: mov_chan.h:120
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_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