OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ | 5 #ifndef MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ |
6 #define MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ | 6 #define MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
13 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
14 #include "media/base/media_log.h" | 13 #include "media/base/media_log.h" |
15 #include "media/base/video_codecs.h" | 14 #include "media/base/video_codecs.h" |
16 #include "media/formats/mp4/aac.h" | 15 #include "media/formats/mp4/aac.h" |
17 #include "media/formats/mp4/avc.h" | 16 #include "media/formats/mp4/avc.h" |
18 #include "media/formats/mp4/box_reader.h" | 17 #include "media/formats/mp4/box_reader.h" |
19 #include "media/formats/mp4/fourccs.h" | 18 #include "media/formats/mp4/fourccs.h" |
20 | 19 |
21 namespace media { | 20 namespace media { |
(...skipping 13 matching lines...) Expand all Loading... |
35 #define DECLARE_BOX_METHODS(T) \ | 34 #define DECLARE_BOX_METHODS(T) \ |
36 T(); \ | 35 T(); \ |
37 ~T() override; \ | 36 ~T() override; \ |
38 bool Parse(BoxReader* reader) override; \ | 37 bool Parse(BoxReader* reader) override; \ |
39 FourCC BoxType() const override; | 38 FourCC BoxType() const override; |
40 | 39 |
41 struct MEDIA_EXPORT FileType : Box { | 40 struct MEDIA_EXPORT FileType : Box { |
42 DECLARE_BOX_METHODS(FileType); | 41 DECLARE_BOX_METHODS(FileType); |
43 | 42 |
44 FourCC major_brand; | 43 FourCC major_brand; |
45 uint32 minor_version; | 44 uint32_t minor_version; |
46 }; | 45 }; |
47 | 46 |
48 // If only copying the 'pssh' boxes, use ProtectionSystemSpecificHeader. | 47 // If only copying the 'pssh' boxes, use ProtectionSystemSpecificHeader. |
49 // If access to the individual fields is needed, use | 48 // If access to the individual fields is needed, use |
50 // FullProtectionSystemSpecificHeader. | 49 // FullProtectionSystemSpecificHeader. |
51 struct MEDIA_EXPORT ProtectionSystemSpecificHeader : Box { | 50 struct MEDIA_EXPORT ProtectionSystemSpecificHeader : Box { |
52 DECLARE_BOX_METHODS(ProtectionSystemSpecificHeader); | 51 DECLARE_BOX_METHODS(ProtectionSystemSpecificHeader); |
53 | 52 |
54 std::vector<uint8> raw_box; | 53 std::vector<uint8_t> raw_box; |
55 }; | 54 }; |
56 | 55 |
57 struct MEDIA_EXPORT FullProtectionSystemSpecificHeader : Box { | 56 struct MEDIA_EXPORT FullProtectionSystemSpecificHeader : Box { |
58 DECLARE_BOX_METHODS(FullProtectionSystemSpecificHeader); | 57 DECLARE_BOX_METHODS(FullProtectionSystemSpecificHeader); |
59 | 58 |
60 std::vector<uint8> system_id; | 59 std::vector<uint8_t> system_id; |
61 std::vector<std::vector<uint8>> key_ids; | 60 std::vector<std::vector<uint8_t>> key_ids; |
62 std::vector<uint8> data; | 61 std::vector<uint8_t> data; |
63 }; | 62 }; |
64 | 63 |
65 struct MEDIA_EXPORT SampleAuxiliaryInformationOffset : Box { | 64 struct MEDIA_EXPORT SampleAuxiliaryInformationOffset : Box { |
66 DECLARE_BOX_METHODS(SampleAuxiliaryInformationOffset); | 65 DECLARE_BOX_METHODS(SampleAuxiliaryInformationOffset); |
67 | 66 |
68 std::vector<uint64> offsets; | 67 std::vector<uint64_t> offsets; |
69 }; | 68 }; |
70 | 69 |
71 struct MEDIA_EXPORT SampleAuxiliaryInformationSize : Box { | 70 struct MEDIA_EXPORT SampleAuxiliaryInformationSize : Box { |
72 DECLARE_BOX_METHODS(SampleAuxiliaryInformationSize); | 71 DECLARE_BOX_METHODS(SampleAuxiliaryInformationSize); |
73 | 72 |
74 uint8 default_sample_info_size; | 73 uint8_t default_sample_info_size; |
75 uint32 sample_count; | 74 uint32_t sample_count; |
76 std::vector<uint8> sample_info_sizes; | 75 std::vector<uint8_t> sample_info_sizes; |
77 }; | 76 }; |
78 | 77 |
79 struct MEDIA_EXPORT OriginalFormat : Box { | 78 struct MEDIA_EXPORT OriginalFormat : Box { |
80 DECLARE_BOX_METHODS(OriginalFormat); | 79 DECLARE_BOX_METHODS(OriginalFormat); |
81 | 80 |
82 FourCC format; | 81 FourCC format; |
83 }; | 82 }; |
84 | 83 |
85 struct MEDIA_EXPORT SchemeType : Box { | 84 struct MEDIA_EXPORT SchemeType : Box { |
86 DECLARE_BOX_METHODS(SchemeType); | 85 DECLARE_BOX_METHODS(SchemeType); |
87 | 86 |
88 FourCC type; | 87 FourCC type; |
89 uint32 version; | 88 uint32_t version; |
90 }; | 89 }; |
91 | 90 |
92 struct MEDIA_EXPORT TrackEncryption : Box { | 91 struct MEDIA_EXPORT TrackEncryption : Box { |
93 DECLARE_BOX_METHODS(TrackEncryption); | 92 DECLARE_BOX_METHODS(TrackEncryption); |
94 | 93 |
95 // Note: this definition is specific to the CENC protection type. | 94 // Note: this definition is specific to the CENC protection type. |
96 bool is_encrypted; | 95 bool is_encrypted; |
97 uint8 default_iv_size; | 96 uint8_t default_iv_size; |
98 std::vector<uint8> default_kid; | 97 std::vector<uint8_t> default_kid; |
99 }; | 98 }; |
100 | 99 |
101 struct MEDIA_EXPORT SchemeInfo : Box { | 100 struct MEDIA_EXPORT SchemeInfo : Box { |
102 DECLARE_BOX_METHODS(SchemeInfo); | 101 DECLARE_BOX_METHODS(SchemeInfo); |
103 | 102 |
104 TrackEncryption track_encryption; | 103 TrackEncryption track_encryption; |
105 }; | 104 }; |
106 | 105 |
107 struct MEDIA_EXPORT ProtectionSchemeInfo : Box { | 106 struct MEDIA_EXPORT ProtectionSchemeInfo : Box { |
108 DECLARE_BOX_METHODS(ProtectionSchemeInfo); | 107 DECLARE_BOX_METHODS(ProtectionSchemeInfo); |
109 | 108 |
110 OriginalFormat format; | 109 OriginalFormat format; |
111 SchemeType type; | 110 SchemeType type; |
112 SchemeInfo info; | 111 SchemeInfo info; |
113 }; | 112 }; |
114 | 113 |
115 struct MEDIA_EXPORT MovieHeader : Box { | 114 struct MEDIA_EXPORT MovieHeader : Box { |
116 DECLARE_BOX_METHODS(MovieHeader); | 115 DECLARE_BOX_METHODS(MovieHeader); |
117 | 116 |
118 uint64 creation_time; | 117 uint64_t creation_time; |
119 uint64 modification_time; | 118 uint64_t modification_time; |
120 uint32 timescale; | 119 uint32_t timescale; |
121 uint64 duration; | 120 uint64_t duration; |
122 int32 rate; | 121 int32_t rate; |
123 int16 volume; | 122 int16_t volume; |
124 uint32 next_track_id; | 123 uint32_t next_track_id; |
125 }; | 124 }; |
126 | 125 |
127 struct MEDIA_EXPORT TrackHeader : Box { | 126 struct MEDIA_EXPORT TrackHeader : Box { |
128 DECLARE_BOX_METHODS(TrackHeader); | 127 DECLARE_BOX_METHODS(TrackHeader); |
129 | 128 |
130 uint64 creation_time; | 129 uint64_t creation_time; |
131 uint64 modification_time; | 130 uint64_t modification_time; |
132 uint32 track_id; | 131 uint32_t track_id; |
133 uint64 duration; | 132 uint64_t duration; |
134 int16 layer; | 133 int16_t layer; |
135 int16 alternate_group; | 134 int16_t alternate_group; |
136 int16 volume; | 135 int16_t volume; |
137 uint32 width; | 136 uint32_t width; |
138 uint32 height; | 137 uint32_t height; |
139 }; | 138 }; |
140 | 139 |
141 struct MEDIA_EXPORT EditListEntry { | 140 struct MEDIA_EXPORT EditListEntry { |
142 uint64 segment_duration; | 141 uint64_t segment_duration; |
143 int64 media_time; | 142 int64_t media_time; |
144 int16 media_rate_integer; | 143 int16_t media_rate_integer; |
145 int16 media_rate_fraction; | 144 int16_t media_rate_fraction; |
146 }; | 145 }; |
147 | 146 |
148 struct MEDIA_EXPORT EditList : Box { | 147 struct MEDIA_EXPORT EditList : Box { |
149 DECLARE_BOX_METHODS(EditList); | 148 DECLARE_BOX_METHODS(EditList); |
150 | 149 |
151 std::vector<EditListEntry> edits; | 150 std::vector<EditListEntry> edits; |
152 }; | 151 }; |
153 | 152 |
154 struct MEDIA_EXPORT Edit : Box { | 153 struct MEDIA_EXPORT Edit : Box { |
155 DECLARE_BOX_METHODS(Edit); | 154 DECLARE_BOX_METHODS(Edit); |
156 | 155 |
157 EditList list; | 156 EditList list; |
158 }; | 157 }; |
159 | 158 |
160 struct MEDIA_EXPORT HandlerReference : Box { | 159 struct MEDIA_EXPORT HandlerReference : Box { |
161 DECLARE_BOX_METHODS(HandlerReference); | 160 DECLARE_BOX_METHODS(HandlerReference); |
162 | 161 |
163 TrackType type; | 162 TrackType type; |
164 }; | 163 }; |
165 | 164 |
166 struct MEDIA_EXPORT AVCDecoderConfigurationRecord : Box { | 165 struct MEDIA_EXPORT AVCDecoderConfigurationRecord : Box { |
167 DECLARE_BOX_METHODS(AVCDecoderConfigurationRecord); | 166 DECLARE_BOX_METHODS(AVCDecoderConfigurationRecord); |
168 | 167 |
169 // Parses AVCDecoderConfigurationRecord data encoded in |data|. | 168 // Parses AVCDecoderConfigurationRecord data encoded in |data|. |
170 // Note: This method is intended to parse data outside the MP4StreamParser | 169 // Note: This method is intended to parse data outside the MP4StreamParser |
171 // context and therefore the box header is not expected to be present | 170 // context and therefore the box header is not expected to be present |
172 // in |data|. | 171 // in |data|. |
173 // Returns true if |data| was successfully parsed. | 172 // Returns true if |data| was successfully parsed. |
174 bool Parse(const uint8* data, int data_size); | 173 bool Parse(const uint8_t* data, int data_size); |
175 | 174 |
176 uint8 version; | 175 uint8_t version; |
177 uint8 profile_indication; | 176 uint8_t profile_indication; |
178 uint8 profile_compatibility; | 177 uint8_t profile_compatibility; |
179 uint8 avc_level; | 178 uint8_t avc_level; |
180 uint8 length_size; | 179 uint8_t length_size; |
181 | 180 |
182 typedef std::vector<uint8> SPS; | 181 typedef std::vector<uint8_t> SPS; |
183 typedef std::vector<uint8> PPS; | 182 typedef std::vector<uint8_t> PPS; |
184 | 183 |
185 std::vector<SPS> sps_list; | 184 std::vector<SPS> sps_list; |
186 std::vector<PPS> pps_list; | 185 std::vector<PPS> pps_list; |
187 | 186 |
188 private: | 187 private: |
189 bool ParseInternal(BufferReader* reader, | 188 bool ParseInternal(BufferReader* reader, |
190 const scoped_refptr<MediaLog>& media_log); | 189 const scoped_refptr<MediaLog>& media_log); |
191 }; | 190 }; |
192 | 191 |
193 struct MEDIA_EXPORT PixelAspectRatioBox : Box { | 192 struct MEDIA_EXPORT PixelAspectRatioBox : Box { |
194 DECLARE_BOX_METHODS(PixelAspectRatioBox); | 193 DECLARE_BOX_METHODS(PixelAspectRatioBox); |
195 | 194 |
196 uint32 h_spacing; | 195 uint32_t h_spacing; |
197 uint32 v_spacing; | 196 uint32_t v_spacing; |
198 }; | 197 }; |
199 | 198 |
200 struct MEDIA_EXPORT VideoSampleEntry : Box { | 199 struct MEDIA_EXPORT VideoSampleEntry : Box { |
201 DECLARE_BOX_METHODS(VideoSampleEntry); | 200 DECLARE_BOX_METHODS(VideoSampleEntry); |
202 | 201 |
203 FourCC format; | 202 FourCC format; |
204 uint16 data_reference_index; | 203 uint16_t data_reference_index; |
205 uint16 width; | 204 uint16_t width; |
206 uint16 height; | 205 uint16_t height; |
207 | 206 |
208 PixelAspectRatioBox pixel_aspect; | 207 PixelAspectRatioBox pixel_aspect; |
209 ProtectionSchemeInfo sinf; | 208 ProtectionSchemeInfo sinf; |
210 | 209 |
211 VideoCodec video_codec; | 210 VideoCodec video_codec; |
212 VideoCodecProfile video_codec_profile; | 211 VideoCodecProfile video_codec_profile; |
213 | 212 |
214 bool IsFormatValid() const; | 213 bool IsFormatValid() const; |
215 | 214 |
216 scoped_refptr<BitstreamConverter> frame_bitstream_converter; | 215 scoped_refptr<BitstreamConverter> frame_bitstream_converter; |
217 }; | 216 }; |
218 | 217 |
219 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { | 218 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { |
220 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); | 219 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); |
221 | 220 |
222 uint8 object_type; | 221 uint8_t object_type; |
223 AAC aac; | 222 AAC aac; |
224 }; | 223 }; |
225 | 224 |
226 struct MEDIA_EXPORT AudioSampleEntry : Box { | 225 struct MEDIA_EXPORT AudioSampleEntry : Box { |
227 DECLARE_BOX_METHODS(AudioSampleEntry); | 226 DECLARE_BOX_METHODS(AudioSampleEntry); |
228 | 227 |
229 FourCC format; | 228 FourCC format; |
230 uint16 data_reference_index; | 229 uint16_t data_reference_index; |
231 uint16 channelcount; | 230 uint16_t channelcount; |
232 uint16 samplesize; | 231 uint16_t samplesize; |
233 uint32 samplerate; | 232 uint32_t samplerate; |
234 | 233 |
235 ProtectionSchemeInfo sinf; | 234 ProtectionSchemeInfo sinf; |
236 ElementaryStreamDescriptor esds; | 235 ElementaryStreamDescriptor esds; |
237 }; | 236 }; |
238 | 237 |
239 struct MEDIA_EXPORT SampleDescription : Box { | 238 struct MEDIA_EXPORT SampleDescription : Box { |
240 DECLARE_BOX_METHODS(SampleDescription); | 239 DECLARE_BOX_METHODS(SampleDescription); |
241 | 240 |
242 TrackType type; | 241 TrackType type; |
243 std::vector<VideoSampleEntry> video_entries; | 242 std::vector<VideoSampleEntry> video_entries; |
244 std::vector<AudioSampleEntry> audio_entries; | 243 std::vector<AudioSampleEntry> audio_entries; |
245 }; | 244 }; |
246 | 245 |
247 struct MEDIA_EXPORT CencSampleEncryptionInfoEntry { | 246 struct MEDIA_EXPORT CencSampleEncryptionInfoEntry { |
248 CencSampleEncryptionInfoEntry(); | 247 CencSampleEncryptionInfoEntry(); |
249 ~CencSampleEncryptionInfoEntry(); | 248 ~CencSampleEncryptionInfoEntry(); |
250 | 249 |
251 bool is_encrypted; | 250 bool is_encrypted; |
252 uint8 iv_size; | 251 uint8_t iv_size; |
253 std::vector<uint8> key_id; | 252 std::vector<uint8_t> key_id; |
254 }; | 253 }; |
255 | 254 |
256 struct MEDIA_EXPORT SampleGroupDescription : Box { // 'sgpd'. | 255 struct MEDIA_EXPORT SampleGroupDescription : Box { // 'sgpd'. |
257 DECLARE_BOX_METHODS(SampleGroupDescription); | 256 DECLARE_BOX_METHODS(SampleGroupDescription); |
258 | 257 |
259 uint32 grouping_type; | 258 uint32_t grouping_type; |
260 std::vector<CencSampleEncryptionInfoEntry> entries; | 259 std::vector<CencSampleEncryptionInfoEntry> entries; |
261 }; | 260 }; |
262 | 261 |
263 struct MEDIA_EXPORT SampleTable : Box { | 262 struct MEDIA_EXPORT SampleTable : Box { |
264 DECLARE_BOX_METHODS(SampleTable); | 263 DECLARE_BOX_METHODS(SampleTable); |
265 | 264 |
266 // Media Source specific: we ignore many of the sub-boxes in this box, | 265 // Media Source specific: we ignore many of the sub-boxes in this box, |
267 // including some that are required to be present in the BMFF spec. This | 266 // including some that are required to be present in the BMFF spec. This |
268 // includes the 'stts', 'stsc', and 'stco' boxes, which must contain no | 267 // includes the 'stts', 'stsc', and 'stco' boxes, which must contain no |
269 // samples in order to be compliant files. | 268 // samples in order to be compliant files. |
270 SampleDescription description; | 269 SampleDescription description; |
271 SampleGroupDescription sample_group_description; | 270 SampleGroupDescription sample_group_description; |
272 }; | 271 }; |
273 | 272 |
274 struct MEDIA_EXPORT MediaHeader : Box { | 273 struct MEDIA_EXPORT MediaHeader : Box { |
275 DECLARE_BOX_METHODS(MediaHeader); | 274 DECLARE_BOX_METHODS(MediaHeader); |
276 | 275 |
277 uint64 creation_time; | 276 uint64_t creation_time; |
278 uint64 modification_time; | 277 uint64_t modification_time; |
279 uint32 timescale; | 278 uint32_t timescale; |
280 uint64 duration; | 279 uint64_t duration; |
281 }; | 280 }; |
282 | 281 |
283 struct MEDIA_EXPORT MediaInformation : Box { | 282 struct MEDIA_EXPORT MediaInformation : Box { |
284 DECLARE_BOX_METHODS(MediaInformation); | 283 DECLARE_BOX_METHODS(MediaInformation); |
285 | 284 |
286 SampleTable sample_table; | 285 SampleTable sample_table; |
287 }; | 286 }; |
288 | 287 |
289 struct MEDIA_EXPORT Media : Box { | 288 struct MEDIA_EXPORT Media : Box { |
290 DECLARE_BOX_METHODS(Media); | 289 DECLARE_BOX_METHODS(Media); |
291 | 290 |
292 MediaHeader header; | 291 MediaHeader header; |
293 HandlerReference handler; | 292 HandlerReference handler; |
294 MediaInformation information; | 293 MediaInformation information; |
295 }; | 294 }; |
296 | 295 |
297 struct MEDIA_EXPORT Track : Box { | 296 struct MEDIA_EXPORT Track : Box { |
298 DECLARE_BOX_METHODS(Track); | 297 DECLARE_BOX_METHODS(Track); |
299 | 298 |
300 TrackHeader header; | 299 TrackHeader header; |
301 Media media; | 300 Media media; |
302 Edit edit; | 301 Edit edit; |
303 }; | 302 }; |
304 | 303 |
305 struct MEDIA_EXPORT MovieExtendsHeader : Box { | 304 struct MEDIA_EXPORT MovieExtendsHeader : Box { |
306 DECLARE_BOX_METHODS(MovieExtendsHeader); | 305 DECLARE_BOX_METHODS(MovieExtendsHeader); |
307 | 306 |
308 uint64 fragment_duration; | 307 uint64_t fragment_duration; |
309 }; | 308 }; |
310 | 309 |
311 struct MEDIA_EXPORT TrackExtends : Box { | 310 struct MEDIA_EXPORT TrackExtends : Box { |
312 DECLARE_BOX_METHODS(TrackExtends); | 311 DECLARE_BOX_METHODS(TrackExtends); |
313 | 312 |
314 uint32 track_id; | 313 uint32_t track_id; |
315 uint32 default_sample_description_index; | 314 uint32_t default_sample_description_index; |
316 uint32 default_sample_duration; | 315 uint32_t default_sample_duration; |
317 uint32 default_sample_size; | 316 uint32_t default_sample_size; |
318 uint32 default_sample_flags; | 317 uint32_t default_sample_flags; |
319 }; | 318 }; |
320 | 319 |
321 struct MEDIA_EXPORT MovieExtends : Box { | 320 struct MEDIA_EXPORT MovieExtends : Box { |
322 DECLARE_BOX_METHODS(MovieExtends); | 321 DECLARE_BOX_METHODS(MovieExtends); |
323 | 322 |
324 MovieExtendsHeader header; | 323 MovieExtendsHeader header; |
325 std::vector<TrackExtends> tracks; | 324 std::vector<TrackExtends> tracks; |
326 }; | 325 }; |
327 | 326 |
328 struct MEDIA_EXPORT Movie : Box { | 327 struct MEDIA_EXPORT Movie : Box { |
329 DECLARE_BOX_METHODS(Movie); | 328 DECLARE_BOX_METHODS(Movie); |
330 | 329 |
331 bool fragmented; | 330 bool fragmented; |
332 MovieHeader header; | 331 MovieHeader header; |
333 MovieExtends extends; | 332 MovieExtends extends; |
334 std::vector<Track> tracks; | 333 std::vector<Track> tracks; |
335 std::vector<ProtectionSystemSpecificHeader> pssh; | 334 std::vector<ProtectionSystemSpecificHeader> pssh; |
336 }; | 335 }; |
337 | 336 |
338 struct MEDIA_EXPORT TrackFragmentDecodeTime : Box { | 337 struct MEDIA_EXPORT TrackFragmentDecodeTime : Box { |
339 DECLARE_BOX_METHODS(TrackFragmentDecodeTime); | 338 DECLARE_BOX_METHODS(TrackFragmentDecodeTime); |
340 | 339 |
341 uint64 decode_time; | 340 uint64_t decode_time; |
342 }; | 341 }; |
343 | 342 |
344 struct MEDIA_EXPORT MovieFragmentHeader : Box { | 343 struct MEDIA_EXPORT MovieFragmentHeader : Box { |
345 DECLARE_BOX_METHODS(MovieFragmentHeader); | 344 DECLARE_BOX_METHODS(MovieFragmentHeader); |
346 | 345 |
347 uint32 sequence_number; | 346 uint32_t sequence_number; |
348 }; | 347 }; |
349 | 348 |
350 struct MEDIA_EXPORT TrackFragmentHeader : Box { | 349 struct MEDIA_EXPORT TrackFragmentHeader : Box { |
351 DECLARE_BOX_METHODS(TrackFragmentHeader); | 350 DECLARE_BOX_METHODS(TrackFragmentHeader); |
352 | 351 |
353 uint32 track_id; | 352 uint32_t track_id; |
354 | 353 |
355 uint32 sample_description_index; | 354 uint32_t sample_description_index; |
356 uint32 default_sample_duration; | 355 uint32_t default_sample_duration; |
357 uint32 default_sample_size; | 356 uint32_t default_sample_size; |
358 uint32 default_sample_flags; | 357 uint32_t default_sample_flags; |
359 | 358 |
360 // As 'flags' might be all zero, we cannot use zeroness alone to identify | 359 // As 'flags' might be all zero, we cannot use zeroness alone to identify |
361 // when default_sample_flags wasn't specified, unlike the other values. | 360 // when default_sample_flags wasn't specified, unlike the other values. |
362 bool has_default_sample_flags; | 361 bool has_default_sample_flags; |
363 }; | 362 }; |
364 | 363 |
365 struct MEDIA_EXPORT TrackFragmentRun : Box { | 364 struct MEDIA_EXPORT TrackFragmentRun : Box { |
366 DECLARE_BOX_METHODS(TrackFragmentRun); | 365 DECLARE_BOX_METHODS(TrackFragmentRun); |
367 | 366 |
368 uint32 sample_count; | 367 uint32_t sample_count; |
369 uint32 data_offset; | 368 uint32_t data_offset; |
370 std::vector<uint32> sample_flags; | 369 std::vector<uint32_t> sample_flags; |
371 std::vector<uint32> sample_sizes; | 370 std::vector<uint32_t> sample_sizes; |
372 std::vector<uint32> sample_durations; | 371 std::vector<uint32_t> sample_durations; |
373 std::vector<int32> sample_composition_time_offsets; | 372 std::vector<int32_t> sample_composition_time_offsets; |
374 }; | 373 }; |
375 | 374 |
376 // sample_depends_on values in ISO/IEC 14496-12 Section 8.40.2.3. | 375 // sample_depends_on values in ISO/IEC 14496-12 Section 8.40.2.3. |
377 enum SampleDependsOn { | 376 enum SampleDependsOn { |
378 kSampleDependsOnUnknown = 0, | 377 kSampleDependsOnUnknown = 0, |
379 kSampleDependsOnOthers = 1, | 378 kSampleDependsOnOthers = 1, |
380 kSampleDependsOnNoOther = 2, | 379 kSampleDependsOnNoOther = 2, |
381 kSampleDependsOnReserved = 3, | 380 kSampleDependsOnReserved = 3, |
382 }; | 381 }; |
383 | 382 |
384 class MEDIA_EXPORT IndependentAndDisposableSamples : public Box { | 383 class MEDIA_EXPORT IndependentAndDisposableSamples : public Box { |
385 public: | 384 public: |
386 DECLARE_BOX_METHODS(IndependentAndDisposableSamples); | 385 DECLARE_BOX_METHODS(IndependentAndDisposableSamples); |
387 | 386 |
388 // Returns the SampleDependsOn value for the |i|'th value | 387 // Returns the SampleDependsOn value for the |i|'th value |
389 // in the track. If no data was parsed for the |i|'th sample, | 388 // in the track. If no data was parsed for the |i|'th sample, |
390 // then |kSampleDependsOnUnknown| is returned. | 389 // then |kSampleDependsOnUnknown| is returned. |
391 SampleDependsOn sample_depends_on(size_t i) const; | 390 SampleDependsOn sample_depends_on(size_t i) const; |
392 | 391 |
393 private: | 392 private: |
394 std::vector<SampleDependsOn> sample_depends_on_; | 393 std::vector<SampleDependsOn> sample_depends_on_; |
395 }; | 394 }; |
396 | 395 |
397 struct MEDIA_EXPORT SampleToGroupEntry { | 396 struct MEDIA_EXPORT SampleToGroupEntry { |
398 enum GroupDescriptionIndexBase { | 397 enum GroupDescriptionIndexBase { |
399 kTrackGroupDescriptionIndexBase = 0, | 398 kTrackGroupDescriptionIndexBase = 0, |
400 kFragmentGroupDescriptionIndexBase = 0x10000, | 399 kFragmentGroupDescriptionIndexBase = 0x10000, |
401 }; | 400 }; |
402 | 401 |
403 uint32 sample_count; | 402 uint32_t sample_count; |
404 uint32 group_description_index; | 403 uint32_t group_description_index; |
405 }; | 404 }; |
406 | 405 |
407 struct MEDIA_EXPORT SampleToGroup : Box { // 'sbgp'. | 406 struct MEDIA_EXPORT SampleToGroup : Box { // 'sbgp'. |
408 DECLARE_BOX_METHODS(SampleToGroup); | 407 DECLARE_BOX_METHODS(SampleToGroup); |
409 | 408 |
410 uint32 grouping_type; | 409 uint32_t grouping_type; |
411 uint32 grouping_type_parameter; // Version 1 only. | 410 uint32_t grouping_type_parameter; // Version 1 only. |
412 std::vector<SampleToGroupEntry> entries; | 411 std::vector<SampleToGroupEntry> entries; |
413 }; | 412 }; |
414 | 413 |
415 struct MEDIA_EXPORT TrackFragment : Box { | 414 struct MEDIA_EXPORT TrackFragment : Box { |
416 DECLARE_BOX_METHODS(TrackFragment); | 415 DECLARE_BOX_METHODS(TrackFragment); |
417 | 416 |
418 TrackFragmentHeader header; | 417 TrackFragmentHeader header; |
419 std::vector<TrackFragmentRun> runs; | 418 std::vector<TrackFragmentRun> runs; |
420 TrackFragmentDecodeTime decode_time; | 419 TrackFragmentDecodeTime decode_time; |
421 SampleAuxiliaryInformationOffset auxiliary_offset; | 420 SampleAuxiliaryInformationOffset auxiliary_offset; |
(...skipping 10 matching lines...) Expand all Loading... |
432 std::vector<TrackFragment> tracks; | 431 std::vector<TrackFragment> tracks; |
433 std::vector<ProtectionSystemSpecificHeader> pssh; | 432 std::vector<ProtectionSystemSpecificHeader> pssh; |
434 }; | 433 }; |
435 | 434 |
436 #undef DECLARE_BOX | 435 #undef DECLARE_BOX |
437 | 436 |
438 } // namespace mp4 | 437 } // namespace mp4 |
439 } // namespace media | 438 } // namespace media |
440 | 439 |
441 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ | 440 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ |
OLD | NEW |