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

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

Issue 10780026: Add HE AAC support to ISO BMFF. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove aac.h. Created 8 years, 5 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/mp4/box_definitions.h ('k') | media/mp4/es_descriptor.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 (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/box_reader.h" 8 #include "media/mp4/es_descriptor.h"
9 #include "media/mp4/fourccs.h"
10 #include "media/mp4/rcheck.h" 9 #include "media/mp4/rcheck.h"
11 10
12 namespace media { 11 namespace media {
13 namespace mp4 { 12 namespace mp4 {
14 13
15 bool FileType::Parse(BoxReader* reader) { 14 bool FileType::Parse(BoxReader* reader) {
16 RCHECK(reader->ReadFourCC(&major_brand) && reader->Read4(&minor_version)); 15 RCHECK(reader->ReadFourCC(&major_brand) && reader->Read4(&minor_version));
17 size_t num_brands = (reader->size() - reader->pos()) / sizeof(FourCC); 16 size_t num_brands = (reader->size() - reader->pos()) / sizeof(FourCC);
18 return reader->SkipBytes(sizeof(FourCC) * num_brands); // compatible_brands 17 return reader->SkipBytes(sizeof(FourCC) * num_brands); // compatible_brands
19 } 18 }
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // (http://crbug.com/132351) 381 // (http://crbug.com/132351)
383 // 382 //
384 // if (format == FOURCC_AVC1 || 383 // if (format == FOURCC_AVC1 ||
385 // (format == FOURCC_ENCV && 384 // (format == FOURCC_ENCV &&
386 // sinf.format.format == FOURCC_AVC1)) { 385 // sinf.format.format == FOURCC_AVC1)) {
387 RCHECK(reader->ReadChild(&avcc)); 386 RCHECK(reader->ReadChild(&avcc));
388 // } 387 // }
389 return true; 388 return true;
390 } 389 }
391 390
391 ElementaryStreamDescriptor::ElementaryStreamDescriptor()
392 : object_type(kForbidden) {}
393
394 ElementaryStreamDescriptor::~ElementaryStreamDescriptor() {}
395
396 FourCC ElementaryStreamDescriptor::BoxType() const {
397 return FOURCC_ESDS;
398 }
399
400 bool ElementaryStreamDescriptor::Parse(BoxReader* reader) {
401 std::vector<uint8> data;
402 ESDescriptor es_desc;
403
404 RCHECK(reader->ReadFullBoxHeader());
405 RCHECK(reader->ReadVec(&data, reader->size() - reader->pos()));
406 RCHECK(es_desc.Parse(data));
407
408 object_type = es_desc.object_type();
409
410 RCHECK(aac.Parse(es_desc.decoder_specific_info()));
411
412 return true;
413 }
414
392 AudioSampleEntry::AudioSampleEntry() 415 AudioSampleEntry::AudioSampleEntry()
393 : format(FOURCC_NULL), 416 : format(FOURCC_NULL),
394 data_reference_index(0), 417 data_reference_index(0),
395 channelcount(0), 418 channelcount(0),
396 samplesize(0), 419 samplesize(0),
397 samplerate(0) {} 420 samplerate(0) {}
398 421
399 AudioSampleEntry::~AudioSampleEntry() {} 422 AudioSampleEntry::~AudioSampleEntry() {}
423
400 FourCC AudioSampleEntry::BoxType() const { 424 FourCC AudioSampleEntry::BoxType() const {
401 DCHECK(false) << "AudioSampleEntry should be parsed according to the " 425 DCHECK(false) << "AudioSampleEntry should be parsed according to the "
402 << "handler type recovered in its Media ancestor."; 426 << "handler type recovered in its Media ancestor.";
403 return FOURCC_NULL; 427 return FOURCC_NULL;
404 } 428 }
405 429
406 bool AudioSampleEntry::Parse(BoxReader* reader) { 430 bool AudioSampleEntry::Parse(BoxReader* reader) {
407 format = reader->type(); 431 format = reader->type();
408 RCHECK(reader->SkipBytes(6) && 432 RCHECK(reader->SkipBytes(6) &&
409 reader->Read2(&data_reference_index) && 433 reader->Read2(&data_reference_index) &&
410 reader->SkipBytes(8) && 434 reader->SkipBytes(8) &&
411 reader->Read2(&channelcount) && 435 reader->Read2(&channelcount) &&
412 reader->Read2(&samplesize) && 436 reader->Read2(&samplesize) &&
413 reader->SkipBytes(4) && 437 reader->SkipBytes(4) &&
414 reader->Read4(&samplerate)); 438 reader->Read4(&samplerate));
415 // Convert from 16.16 fixed point to integer 439 // Convert from 16.16 fixed point to integer
416 samplerate >>= 16; 440 samplerate >>= 16;
417 441
418 RCHECK(reader->ScanChildren()); 442 RCHECK(reader->ScanChildren());
419 if (format == FOURCC_ENCA) { 443 if (format == FOURCC_ENCA) {
420 RCHECK(reader->ReadChild(&sinf)); 444 RCHECK(reader->ReadChild(&sinf));
421 } 445 }
446 RCHECK(reader->ReadChild(&esds));
422 return true; 447 return true;
423 } 448 }
424 449
425 MediaHeader::MediaHeader() 450 MediaHeader::MediaHeader()
426 : creation_time(0), 451 : creation_time(0),
427 modification_time(0), 452 modification_time(0),
428 timescale(0), 453 timescale(0),
429 duration(0) {} 454 duration(0) {}
430 MediaHeader::~MediaHeader() {} 455 MediaHeader::~MediaHeader() {}
431 FourCC MediaHeader::BoxType() const { return FOURCC_MDHD; } 456 FourCC MediaHeader::BoxType() const { return FOURCC_MDHD; }
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 bool MovieFragment::Parse(BoxReader* reader) { 722 bool MovieFragment::Parse(BoxReader* reader) {
698 RCHECK(reader->ScanChildren() && 723 RCHECK(reader->ScanChildren() &&
699 reader->ReadChild(&header) && 724 reader->ReadChild(&header) &&
700 reader->ReadChildren(&tracks) && 725 reader->ReadChildren(&tracks) &&
701 reader->MaybeReadChildren(&pssh)); 726 reader->MaybeReadChildren(&pssh));
702 return true; 727 return true;
703 } 728 }
704 729
705 } // namespace mp4 730 } // namespace mp4
706 } // namespace media 731 } // namespace media
OLDNEW
« no previous file with comments | « media/mp4/box_definitions.h ('k') | media/mp4/es_descriptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698