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 // This file contains code for encrypted WebM. Current WebM | |
11 // encrypted request for comments specification is here | |
12 // http://wiki.webmproject.org/encryption/webm-encryption-rfc | |
13 | 10 |
14 #include <iomanip> | 11 #include <iomanip> |
15 | 12 |
16 #include "base/logging.h" | 13 #include "base/logging.h" |
17 #include "media/webm/webm_constants.h" | 14 #include "media/webm/webm_constants.h" |
18 | 15 |
19 namespace media { | 16 namespace media { |
20 | 17 |
21 enum ElementType { | 18 enum ElementType { |
22 UNKNOWN, | 19 UNKNOWN, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 {LIST, kWebMIdContentCompression}, | 225 {LIST, kWebMIdContentCompression}, |
229 {LIST, kWebMIdContentEncryption}, | 226 {LIST, kWebMIdContentEncryption}, |
230 }; | 227 }; |
231 | 228 |
232 static const ElementIdInfo kContentCompressionIds[] = { | 229 static const ElementIdInfo kContentCompressionIds[] = { |
233 {UINT, kWebMIdContentCompAlgo}, | 230 {UINT, kWebMIdContentCompAlgo}, |
234 {BINARY, kWebMIdContentCompSettings}, | 231 {BINARY, kWebMIdContentCompSettings}, |
235 }; | 232 }; |
236 | 233 |
237 static const ElementIdInfo kContentEncryptionIds[] = { | 234 static const ElementIdInfo kContentEncryptionIds[] = { |
238 {LIST, kWebMIdContentEncAESSettings}, | |
239 {UINT, kWebMIdContentEncAlgo}, | 235 {UINT, kWebMIdContentEncAlgo}, |
240 {BINARY, kWebMIdContentEncKeyID}, | 236 {BINARY, kWebMIdContentEncKeyID}, |
241 {BINARY, kWebMIdContentSignature}, | 237 {BINARY, kWebMIdContentSignature}, |
242 {BINARY, kWebMIdContentSigKeyID}, | 238 {BINARY, kWebMIdContentSigKeyID}, |
243 {UINT, kWebMIdContentSigAlgo}, | 239 {UINT, kWebMIdContentSigAlgo}, |
244 {UINT, kWebMIdContentSigHashAlgo}, | 240 {UINT, kWebMIdContentSigHashAlgo}, |
245 }; | 241 }; |
246 | 242 |
247 static const ElementIdInfo kContentEncAESSettingsIds[] = { | |
248 {UINT, kWebMIdAESSettingsCipherMode}, | |
249 }; | |
250 | |
251 static const ElementIdInfo kCuesIds[] = { | 243 static const ElementIdInfo kCuesIds[] = { |
252 {LIST, kWebMIdCuePoint}, | 244 {LIST, kWebMIdCuePoint}, |
253 }; | 245 }; |
254 | 246 |
255 static const ElementIdInfo kCuePointIds[] = { | 247 static const ElementIdInfo kCuePointIds[] = { |
256 {UINT, kWebMIdCueTime}, | 248 {UINT, kWebMIdCueTime}, |
257 {LIST, kWebMIdCueTrackPositions}, | 249 {LIST, kWebMIdCueTrackPositions}, |
258 }; | 250 }; |
259 | 251 |
260 static const ElementIdInfo kCueTrackPositionsIds[] = { | 252 static const ElementIdInfo kCueTrackPositionsIds[] = { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 LIST_ELEMENT_INFO(kWebMIdVideo, 3, kVideoIds), | 369 LIST_ELEMENT_INFO(kWebMIdVideo, 3, kVideoIds), |
378 LIST_ELEMENT_INFO(kWebMIdAudio, 3, kAudioIds), | 370 LIST_ELEMENT_INFO(kWebMIdAudio, 3, kAudioIds), |
379 LIST_ELEMENT_INFO(kWebMIdTrackOperation, 3, kTrackOperationIds), | 371 LIST_ELEMENT_INFO(kWebMIdTrackOperation, 3, kTrackOperationIds), |
380 LIST_ELEMENT_INFO(kWebMIdTrackCombinePlanes, 4, kTrackCombinePlanesIds), | 372 LIST_ELEMENT_INFO(kWebMIdTrackCombinePlanes, 4, kTrackCombinePlanesIds), |
381 LIST_ELEMENT_INFO(kWebMIdTrackPlane, 5, kTrackPlaneIds), | 373 LIST_ELEMENT_INFO(kWebMIdTrackPlane, 5, kTrackPlaneIds), |
382 LIST_ELEMENT_INFO(kWebMIdJoinBlocks, 4, kJoinBlocksIds), | 374 LIST_ELEMENT_INFO(kWebMIdJoinBlocks, 4, kJoinBlocksIds), |
383 LIST_ELEMENT_INFO(kWebMIdContentEncodings, 3, kContentEncodingsIds), | 375 LIST_ELEMENT_INFO(kWebMIdContentEncodings, 3, kContentEncodingsIds), |
384 LIST_ELEMENT_INFO(kWebMIdContentEncoding, 4, kContentEncodingIds), | 376 LIST_ELEMENT_INFO(kWebMIdContentEncoding, 4, kContentEncodingIds), |
385 LIST_ELEMENT_INFO(kWebMIdContentCompression, 5, kContentCompressionIds), | 377 LIST_ELEMENT_INFO(kWebMIdContentCompression, 5, kContentCompressionIds), |
386 LIST_ELEMENT_INFO(kWebMIdContentEncryption, 5, kContentEncryptionIds), | 378 LIST_ELEMENT_INFO(kWebMIdContentEncryption, 5, kContentEncryptionIds), |
387 LIST_ELEMENT_INFO(kWebMIdContentEncAESSettings, 6, kContentEncAESSettingsIds), | |
388 LIST_ELEMENT_INFO(kWebMIdCues, 1, kCuesIds), | 379 LIST_ELEMENT_INFO(kWebMIdCues, 1, kCuesIds), |
389 LIST_ELEMENT_INFO(kWebMIdCuePoint, 2, kCuePointIds), | 380 LIST_ELEMENT_INFO(kWebMIdCuePoint, 2, kCuePointIds), |
390 LIST_ELEMENT_INFO(kWebMIdCueTrackPositions, 3, kCueTrackPositionsIds), | 381 LIST_ELEMENT_INFO(kWebMIdCueTrackPositions, 3, kCueTrackPositionsIds), |
391 LIST_ELEMENT_INFO(kWebMIdCueReference, 4, kCueReferenceIds), | 382 LIST_ELEMENT_INFO(kWebMIdCueReference, 4, kCueReferenceIds), |
392 LIST_ELEMENT_INFO(kWebMIdAttachments, 1, kAttachmentsIds), | 383 LIST_ELEMENT_INFO(kWebMIdAttachments, 1, kAttachmentsIds), |
393 LIST_ELEMENT_INFO(kWebMIdAttachedFile, 2, kAttachedFileIds), | 384 LIST_ELEMENT_INFO(kWebMIdAttachedFile, 2, kAttachedFileIds), |
394 LIST_ELEMENT_INFO(kWebMIdChapters, 1, kChaptersIds), | 385 LIST_ELEMENT_INFO(kWebMIdChapters, 1, kChaptersIds), |
395 LIST_ELEMENT_INFO(kWebMIdEditionEntry, 2, kEditionEntryIds), | 386 LIST_ELEMENT_INFO(kWebMIdEditionEntry, 2, kEditionEntryIds), |
396 LIST_ELEMENT_INFO(kWebMIdChapterAtom, 3, kChapterAtomIds), | 387 LIST_ELEMENT_INFO(kWebMIdChapterAtom, 3, kChapterAtomIds), |
397 LIST_ELEMENT_INFO(kWebMIdChapterTrack, 4, kChapterTrackIds), | 388 LIST_ELEMENT_INFO(kWebMIdChapterTrack, 4, kChapterTrackIds), |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 if (kSegmentIds[i].id_ == id_b) | 922 if (kSegmentIds[i].id_ == id_b) |
932 return true; | 923 return true; |
933 } | 924 } |
934 } | 925 } |
935 | 926 |
936 // kWebMIdSegment siblings. | 927 // kWebMIdSegment siblings. |
937 return ((id_b == kWebMIdSegment) || (id_b == kWebMIdEBMLHeader)); | 928 return ((id_b == kWebMIdSegment) || (id_b == kWebMIdEBMLHeader)); |
938 } | 929 } |
939 | 930 |
940 } // namespace media | 931 } // namespace media |
OLD | NEW |