Chromium Code Reviews| 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 #include "media/formats/mp4/box_definitions.h" | 5 #include "media/formats/mp4/box_definitions.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/formats/mp4/es_descriptor.h" | 8 #include "media/formats/mp4/es_descriptor.h" |
| 9 #include "media/formats/mp4/rcheck.h" | 9 #include "media/formats/mp4/rcheck.h" |
| 10 | 10 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 : version(0), | 342 : version(0), |
| 343 profile_indication(0), | 343 profile_indication(0), |
| 344 profile_compatibility(0), | 344 profile_compatibility(0), |
| 345 avc_level(0), | 345 avc_level(0), |
| 346 length_size(0) {} | 346 length_size(0) {} |
| 347 | 347 |
| 348 AVCDecoderConfigurationRecord::~AVCDecoderConfigurationRecord() {} | 348 AVCDecoderConfigurationRecord::~AVCDecoderConfigurationRecord() {} |
| 349 FourCC AVCDecoderConfigurationRecord::BoxType() const { return FOURCC_AVCC; } | 349 FourCC AVCDecoderConfigurationRecord::BoxType() const { return FOURCC_AVCC; } |
| 350 | 350 |
| 351 bool AVCDecoderConfigurationRecord::Parse(BoxReader* reader) { | 351 bool AVCDecoderConfigurationRecord::Parse(BoxReader* reader) { |
| 352 return ParseInternal(reader); | |
| 353 } | |
| 354 | |
| 355 bool AVCDecoderConfigurationRecord::Parse(const uint8* data, int data_size) { | |
| 356 DCHECK(data); | |
|
scherkus (not reviewing)
2014/05/05 18:22:17
you DCHECK here but BufferReader CHECK()s
remove?
acolwell GONE FROM CHROMIUM
2014/05/05 18:49:02
Done.
| |
| 357 DCHECK_GE(data_size, 0); | |
| 358 | |
| 359 BufferReader reader(data, data_size); | |
| 360 return ParseInternal(&reader); | |
| 361 } | |
| 362 | |
| 363 bool AVCDecoderConfigurationRecord::ParseInternal(BufferReader* reader) { | |
| 352 RCHECK(reader->Read1(&version) && version == 1 && | 364 RCHECK(reader->Read1(&version) && version == 1 && |
| 353 reader->Read1(&profile_indication) && | 365 reader->Read1(&profile_indication) && |
| 354 reader->Read1(&profile_compatibility) && | 366 reader->Read1(&profile_compatibility) && |
| 355 reader->Read1(&avc_level)); | 367 reader->Read1(&avc_level)); |
| 356 | 368 |
| 357 uint8 length_size_minus_one; | 369 uint8 length_size_minus_one; |
| 358 RCHECK(reader->Read1(&length_size_minus_one) && | 370 RCHECK(reader->Read1(&length_size_minus_one) && |
| 359 (length_size_minus_one & 0xfc) == 0xfc); | 371 (length_size_minus_one & 0xfc) == 0xfc); |
| 360 length_size = (length_size_minus_one & 0x3) + 1; | 372 length_size = (length_size_minus_one & 0x3) + 1; |
| 361 | 373 |
| 374 RCHECK(length_size != 3); // Only values of 1, 2, and 4 are valid. | |
| 375 | |
| 362 uint8 num_sps; | 376 uint8 num_sps; |
| 363 RCHECK(reader->Read1(&num_sps) && (num_sps & 0xe0) == 0xe0); | 377 RCHECK(reader->Read1(&num_sps) && (num_sps & 0xe0) == 0xe0); |
| 364 num_sps &= 0x1f; | 378 num_sps &= 0x1f; |
| 365 | 379 |
| 366 sps_list.resize(num_sps); | 380 sps_list.resize(num_sps); |
| 367 for (int i = 0; i < num_sps; i++) { | 381 for (int i = 0; i < num_sps; i++) { |
| 368 uint16 sps_length; | 382 uint16 sps_length; |
| 369 RCHECK(reader->Read2(&sps_length) && | 383 RCHECK(reader->Read2(&sps_length) && |
| 370 reader->ReadVec(&sps_list[i], sps_length)); | 384 reader->ReadVec(&sps_list[i], sps_length)); |
| 371 } | 385 } |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 814 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on( | 828 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on( |
| 815 size_t i) const { | 829 size_t i) const { |
| 816 if (i >= sample_depends_on_.size()) | 830 if (i >= sample_depends_on_.size()) |
| 817 return kSampleDependsOnUnknown; | 831 return kSampleDependsOnUnknown; |
| 818 | 832 |
| 819 return sample_depends_on_[i]; | 833 return sample_depends_on_[i]; |
| 820 } | 834 } |
| 821 | 835 |
| 822 } // namespace mp4 | 836 } // namespace mp4 |
| 823 } // namespace media | 837 } // namespace media |
| OLD | NEW |