OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "media/webm/webm_parser.h" | 5 #include "media/webm/webm_parser.h" |
6 | 6 |
7 // This file contains code to parse WebM file elements. It was created | 7 // This file contains code to parse WebM file elements. It was created |
8 // from information in the Matroska spec. | 8 // from information in the Matroska spec. |
9 // http://www.matroska.org/technical/specs/index.html | 9 // http://www.matroska.org/technical/specs/index.html |
10 | 10 |
xhwang
2012/06/06 20:54:06
Can we also post the RFC here?
fgalligan1
2012/06/08 21:02:38
Done.
| |
11 #include <iomanip> | 11 #include <iomanip> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "media/webm/webm_constants.h" | 14 #include "media/webm/webm_constants.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
18 enum ElementType { | 18 enum ElementType { |
19 UNKNOWN, | 19 UNKNOWN, |
20 LIST, // Referred to as Master Element in the Matroska spec. | 20 LIST, // Referred to as Master Element in the Matroska spec. |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 {LIST, kWebMIdContentCompression}, | 225 {LIST, kWebMIdContentCompression}, |
226 {LIST, kWebMIdContentEncryption}, | 226 {LIST, kWebMIdContentEncryption}, |
227 }; | 227 }; |
228 | 228 |
229 static const ElementIdInfo kContentCompressionIds[] = { | 229 static const ElementIdInfo kContentCompressionIds[] = { |
230 {UINT, kWebMIdContentCompAlgo}, | 230 {UINT, kWebMIdContentCompAlgo}, |
231 {BINARY, kWebMIdContentCompSettings}, | 231 {BINARY, kWebMIdContentCompSettings}, |
232 }; | 232 }; |
233 | 233 |
234 static const ElementIdInfo kContentEncryptionIds[] = { | 234 static const ElementIdInfo kContentEncryptionIds[] = { |
235 {LIST, kWebMIdContentEncAESSettings}, | |
235 {UINT, kWebMIdContentEncAlgo}, | 236 {UINT, kWebMIdContentEncAlgo}, |
236 {BINARY, kWebMIdContentEncKeyID}, | 237 {BINARY, kWebMIdContentEncKeyID}, |
237 {BINARY, kWebMIdContentSignature}, | 238 {BINARY, kWebMIdContentSignature}, |
238 {BINARY, kWebMIdContentSigKeyID}, | 239 {BINARY, kWebMIdContentSigKeyID}, |
239 {UINT, kWebMIdContentSigAlgo}, | 240 {UINT, kWebMIdContentSigAlgo}, |
240 {UINT, kWebMIdContentSigHashAlgo}, | 241 {UINT, kWebMIdContentSigHashAlgo}, |
241 }; | 242 }; |
242 | 243 |
244 static const ElementIdInfo kContentEncAESSettingsIds[] = { | |
245 {UINT, kWebMIdAESSettingsCipherMode}, | |
246 }; | |
247 | |
243 static const ElementIdInfo kCuesIds[] = { | 248 static const ElementIdInfo kCuesIds[] = { |
244 {LIST, kWebMIdCuePoint}, | 249 {LIST, kWebMIdCuePoint}, |
245 }; | 250 }; |
246 | 251 |
247 static const ElementIdInfo kCuePointIds[] = { | 252 static const ElementIdInfo kCuePointIds[] = { |
248 {UINT, kWebMIdCueTime}, | 253 {UINT, kWebMIdCueTime}, |
249 {LIST, kWebMIdCueTrackPositions}, | 254 {LIST, kWebMIdCueTrackPositions}, |
250 }; | 255 }; |
251 | 256 |
252 static const ElementIdInfo kCueTrackPositionsIds[] = { | 257 static const ElementIdInfo kCueTrackPositionsIds[] = { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
369 LIST_ELEMENT_INFO(kWebMIdVideo, 3, kVideoIds), | 374 LIST_ELEMENT_INFO(kWebMIdVideo, 3, kVideoIds), |
370 LIST_ELEMENT_INFO(kWebMIdAudio, 3, kAudioIds), | 375 LIST_ELEMENT_INFO(kWebMIdAudio, 3, kAudioIds), |
371 LIST_ELEMENT_INFO(kWebMIdTrackOperation, 3, kTrackOperationIds), | 376 LIST_ELEMENT_INFO(kWebMIdTrackOperation, 3, kTrackOperationIds), |
372 LIST_ELEMENT_INFO(kWebMIdTrackCombinePlanes, 4, kTrackCombinePlanesIds), | 377 LIST_ELEMENT_INFO(kWebMIdTrackCombinePlanes, 4, kTrackCombinePlanesIds), |
373 LIST_ELEMENT_INFO(kWebMIdTrackPlane, 5, kTrackPlaneIds), | 378 LIST_ELEMENT_INFO(kWebMIdTrackPlane, 5, kTrackPlaneIds), |
374 LIST_ELEMENT_INFO(kWebMIdJoinBlocks, 4, kJoinBlocksIds), | 379 LIST_ELEMENT_INFO(kWebMIdJoinBlocks, 4, kJoinBlocksIds), |
375 LIST_ELEMENT_INFO(kWebMIdContentEncodings, 3, kContentEncodingsIds), | 380 LIST_ELEMENT_INFO(kWebMIdContentEncodings, 3, kContentEncodingsIds), |
376 LIST_ELEMENT_INFO(kWebMIdContentEncoding, 4, kContentEncodingIds), | 381 LIST_ELEMENT_INFO(kWebMIdContentEncoding, 4, kContentEncodingIds), |
377 LIST_ELEMENT_INFO(kWebMIdContentCompression, 5, kContentCompressionIds), | 382 LIST_ELEMENT_INFO(kWebMIdContentCompression, 5, kContentCompressionIds), |
378 LIST_ELEMENT_INFO(kWebMIdContentEncryption, 5, kContentEncryptionIds), | 383 LIST_ELEMENT_INFO(kWebMIdContentEncryption, 5, kContentEncryptionIds), |
384 LIST_ELEMENT_INFO(kWebMIdContentEncAESSettings, 6, kContentEncAESSettingsIds), | |
379 LIST_ELEMENT_INFO(kWebMIdCues, 1, kCuesIds), | 385 LIST_ELEMENT_INFO(kWebMIdCues, 1, kCuesIds), |
380 LIST_ELEMENT_INFO(kWebMIdCuePoint, 2, kCuePointIds), | 386 LIST_ELEMENT_INFO(kWebMIdCuePoint, 2, kCuePointIds), |
381 LIST_ELEMENT_INFO(kWebMIdCueTrackPositions, 3, kCueTrackPositionsIds), | 387 LIST_ELEMENT_INFO(kWebMIdCueTrackPositions, 3, kCueTrackPositionsIds), |
382 LIST_ELEMENT_INFO(kWebMIdCueReference, 4, kCueReferenceIds), | 388 LIST_ELEMENT_INFO(kWebMIdCueReference, 4, kCueReferenceIds), |
383 LIST_ELEMENT_INFO(kWebMIdAttachments, 1, kAttachmentsIds), | 389 LIST_ELEMENT_INFO(kWebMIdAttachments, 1, kAttachmentsIds), |
384 LIST_ELEMENT_INFO(kWebMIdAttachedFile, 2, kAttachedFileIds), | 390 LIST_ELEMENT_INFO(kWebMIdAttachedFile, 2, kAttachedFileIds), |
385 LIST_ELEMENT_INFO(kWebMIdChapters, 1, kChaptersIds), | 391 LIST_ELEMENT_INFO(kWebMIdChapters, 1, kChaptersIds), |
386 LIST_ELEMENT_INFO(kWebMIdEditionEntry, 2, kEditionEntryIds), | 392 LIST_ELEMENT_INFO(kWebMIdEditionEntry, 2, kEditionEntryIds), |
387 LIST_ELEMENT_INFO(kWebMIdChapterAtom, 3, kChapterAtomIds), | 393 LIST_ELEMENT_INFO(kWebMIdChapterAtom, 3, kChapterAtomIds), |
388 LIST_ELEMENT_INFO(kWebMIdChapterTrack, 4, kChapterTrackIds), | 394 LIST_ELEMENT_INFO(kWebMIdChapterTrack, 4, kChapterTrackIds), |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
922 if (kSegmentIds[i].id_ == id_b) | 928 if (kSegmentIds[i].id_ == id_b) |
923 return true; | 929 return true; |
924 } | 930 } |
925 } | 931 } |
926 | 932 |
927 // kWebMIdSegment siblings. | 933 // kWebMIdSegment siblings. |
928 return ((id_b == kWebMIdSegment) || (id_b == kWebMIdEBMLHeader)); | 934 return ((id_b == kWebMIdSegment) || (id_b == kWebMIdEBMLHeader)); |
929 } | 935 } |
930 | 936 |
931 } // namespace media | 937 } // namespace media |
OLD | NEW |