Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Side by Side Diff: media/formats/mp4/box_definitions.cc

Issue 264743016: Change H264AnnexBBitstreamConverter to use AVCDecoderConfigurationRecord. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address CR comments. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/formats/mp4/box_definitions.h ('k') | media/formats/mp4/box_reader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 BufferReader reader(data, data_size);
357 return ParseInternal(&reader);
358 }
359
360 bool AVCDecoderConfigurationRecord::ParseInternal(BufferReader* reader) {
352 RCHECK(reader->Read1(&version) && version == 1 && 361 RCHECK(reader->Read1(&version) && version == 1 &&
353 reader->Read1(&profile_indication) && 362 reader->Read1(&profile_indication) &&
354 reader->Read1(&profile_compatibility) && 363 reader->Read1(&profile_compatibility) &&
355 reader->Read1(&avc_level)); 364 reader->Read1(&avc_level));
356 365
357 uint8 length_size_minus_one; 366 uint8 length_size_minus_one;
358 RCHECK(reader->Read1(&length_size_minus_one) && 367 RCHECK(reader->Read1(&length_size_minus_one) &&
359 (length_size_minus_one & 0xfc) == 0xfc); 368 (length_size_minus_one & 0xfc) == 0xfc);
360 length_size = (length_size_minus_one & 0x3) + 1; 369 length_size = (length_size_minus_one & 0x3) + 1;
361 370
371 RCHECK(length_size != 3); // Only values of 1, 2, and 4 are valid.
372
362 uint8 num_sps; 373 uint8 num_sps;
363 RCHECK(reader->Read1(&num_sps) && (num_sps & 0xe0) == 0xe0); 374 RCHECK(reader->Read1(&num_sps) && (num_sps & 0xe0) == 0xe0);
364 num_sps &= 0x1f; 375 num_sps &= 0x1f;
365 376
366 sps_list.resize(num_sps); 377 sps_list.resize(num_sps);
367 for (int i = 0; i < num_sps; i++) { 378 for (int i = 0; i < num_sps; i++) {
368 uint16 sps_length; 379 uint16 sps_length;
369 RCHECK(reader->Read2(&sps_length) && 380 RCHECK(reader->Read2(&sps_length) &&
370 reader->ReadVec(&sps_list[i], sps_length)); 381 reader->ReadVec(&sps_list[i], sps_length));
371 } 382 }
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on( 825 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on(
815 size_t i) const { 826 size_t i) const {
816 if (i >= sample_depends_on_.size()) 827 if (i >= sample_depends_on_.size())
817 return kSampleDependsOnUnknown; 828 return kSampleDependsOnUnknown;
818 829
819 return sample_depends_on_[i]; 830 return sample_depends_on_[i];
820 } 831 }
821 832
822 } // namespace mp4 833 } // namespace mp4
823 } // namespace media 834 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp4/box_definitions.h ('k') | media/formats/mp4/box_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698