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/mp4/box_definitions.h" | 5 #include "media/mp4/box_definitions.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/mp4/es_descriptor.h" | 8 #include "media/mp4/es_descriptor.h" |
9 #include "media/mp4/rcheck.h" | 9 #include "media/mp4/rcheck.h" |
10 | 10 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 392 |
393 if (format == FOURCC_ENCV) { | 393 if (format == FOURCC_ENCV) { |
394 // Continue scanning until a recognized protection scheme is found, or until | 394 // Continue scanning until a recognized protection scheme is found, or until |
395 // we run out of protection schemes. | 395 // we run out of protection schemes. |
396 while (sinf.type.type != FOURCC_CENC) { | 396 while (sinf.type.type != FOURCC_CENC) { |
397 if (!reader->ReadChild(&sinf)) | 397 if (!reader->ReadChild(&sinf)) |
398 return false; | 398 return false; |
399 } | 399 } |
400 } | 400 } |
401 | 401 |
402 if (format == FOURCC_AVC1 || | 402 if (IsFormatValid()) |
403 (format == FOURCC_ENCV && sinf.format.format == FOURCC_AVC1)) { | |
404 RCHECK(reader->ReadChild(&avcc)); | 403 RCHECK(reader->ReadChild(&avcc)); |
405 } | 404 |
406 return true; | 405 return true; |
407 } | 406 } |
408 | 407 |
| 408 bool VideoSampleEntry::IsFormatValid() const { |
| 409 return format == FOURCC_AVC1 || format == FOURCC_AVC3 || |
| 410 (format == FOURCC_ENCV && (sinf.format.format == FOURCC_AVC1 || |
| 411 sinf.format.format == FOURCC_AVC3)); |
| 412 } |
| 413 |
409 ElementaryStreamDescriptor::ElementaryStreamDescriptor() | 414 ElementaryStreamDescriptor::ElementaryStreamDescriptor() |
410 : object_type(kForbidden) {} | 415 : object_type(kForbidden) {} |
411 | 416 |
412 ElementaryStreamDescriptor::~ElementaryStreamDescriptor() {} | 417 ElementaryStreamDescriptor::~ElementaryStreamDescriptor() {} |
413 | 418 |
414 FourCC ElementaryStreamDescriptor::BoxType() const { | 419 FourCC ElementaryStreamDescriptor::BoxType() const { |
415 return FOURCC_ESDS; | 420 return FOURCC_ESDS; |
416 } | 421 } |
417 | 422 |
418 bool ElementaryStreamDescriptor::Parse(BoxReader* reader) { | 423 bool ElementaryStreamDescriptor::Parse(BoxReader* reader) { |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 bool MovieFragment::Parse(BoxReader* reader) { | 753 bool MovieFragment::Parse(BoxReader* reader) { |
749 RCHECK(reader->ScanChildren() && | 754 RCHECK(reader->ScanChildren() && |
750 reader->ReadChild(&header) && | 755 reader->ReadChild(&header) && |
751 reader->ReadChildren(&tracks) && | 756 reader->ReadChildren(&tracks) && |
752 reader->MaybeReadChildren(&pssh)); | 757 reader->MaybeReadChildren(&pssh)); |
753 return true; | 758 return true; |
754 } | 759 } |
755 | 760 |
756 } // namespace mp4 | 761 } // namespace mp4 |
757 } // namespace media | 762 } // namespace media |
OLD | NEW |