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/box_reader.h" | 8 #include "media/mp4/box_reader.h" |
9 #include "media/mp4/fourccs.h" | 9 #include "media/mp4/fourccs.h" |
10 #include "media/mp4/rcheck.h" | 10 #include "media/mp4/rcheck.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
382 // (http://crbug.com/132351) | 382 // (http://crbug.com/132351) |
383 // | 383 // |
384 // if (format == FOURCC_AVC1 || | 384 // if (format == FOURCC_AVC1 || |
385 // (format == FOURCC_ENCV && | 385 // (format == FOURCC_ENCV && |
386 // sinf.format.format == FOURCC_AVC1)) { | 386 // sinf.format.format == FOURCC_AVC1)) { |
387 RCHECK(reader->ReadChild(&avcc)); | 387 RCHECK(reader->ReadChild(&avcc)); |
388 // } | 388 // } |
389 return true; | 389 return true; |
390 } | 390 } |
391 | 391 |
392 ElementaryStreamDescriptor::ElementaryStreamDescriptor() {} | |
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 | |
403 RCHECK(reader->ReadFullBoxHeader()); | |
404 RCHECK(reader->ReadVec(&data, reader->size() - reader->pos())); | |
405 RCHECK(aac.Initialize(data)); | |
acolwell GONE FROM CHROMIUM
2012/06/28 17:31:25
What do you think about renaming this to Parse() t
| |
406 | |
407 return true; | |
408 } | |
409 | |
392 AudioSampleEntry::AudioSampleEntry() | 410 AudioSampleEntry::AudioSampleEntry() |
393 : format(FOURCC_NULL), | 411 : format(FOURCC_NULL), |
394 data_reference_index(0), | 412 data_reference_index(0), |
395 channelcount(0), | 413 channelcount(0), |
396 samplesize(0), | 414 samplesize(0), |
397 samplerate(0) {} | 415 samplerate(0) {} |
398 | 416 |
399 AudioSampleEntry::~AudioSampleEntry() {} | 417 AudioSampleEntry::~AudioSampleEntry() {} |
418 | |
400 FourCC AudioSampleEntry::BoxType() const { | 419 FourCC AudioSampleEntry::BoxType() const { |
401 DCHECK(false) << "AudioSampleEntry should be parsed according to the " | 420 DCHECK(false) << "AudioSampleEntry should be parsed according to the " |
402 << "handler type recovered in its Media ancestor."; | 421 << "handler type recovered in its Media ancestor."; |
403 return FOURCC_NULL; | 422 return FOURCC_NULL; |
404 } | 423 } |
405 | 424 |
406 bool AudioSampleEntry::Parse(BoxReader* reader) { | 425 bool AudioSampleEntry::Parse(BoxReader* reader) { |
407 format = reader->type(); | 426 format = reader->type(); |
408 RCHECK(reader->SkipBytes(6) && | 427 RCHECK(reader->SkipBytes(6) && |
409 reader->Read2(&data_reference_index) && | 428 reader->Read2(&data_reference_index) && |
410 reader->SkipBytes(8) && | 429 reader->SkipBytes(8) && |
411 reader->Read2(&channelcount) && | 430 reader->Read2(&channelcount) && |
412 reader->Read2(&samplesize) && | 431 reader->Read2(&samplesize) && |
413 reader->SkipBytes(4) && | 432 reader->SkipBytes(4) && |
414 reader->Read4(&samplerate)); | 433 reader->Read4(&samplerate)); |
415 // Convert from 16.16 fixed point to integer | 434 // Convert from 16.16 fixed point to integer |
416 samplerate >>= 16; | 435 samplerate >>= 16; |
417 | 436 |
418 RCHECK(reader->ScanChildren()); | 437 RCHECK(reader->ScanChildren()); |
419 if (format == FOURCC_ENCA) { | 438 if (format == FOURCC_ENCA) { |
420 RCHECK(reader->ReadChild(&sinf)); | 439 RCHECK(reader->ReadChild(&sinf)); |
421 } | 440 } |
441 RCHECK(reader->ReadChild(&esds)); | |
422 return true; | 442 return true; |
423 } | 443 } |
424 | 444 |
425 MediaHeader::MediaHeader() | 445 MediaHeader::MediaHeader() |
426 : creation_time(0), | 446 : creation_time(0), |
427 modification_time(0), | 447 modification_time(0), |
428 timescale(0), | 448 timescale(0), |
429 duration(0) {} | 449 duration(0) {} |
430 MediaHeader::~MediaHeader() {} | 450 MediaHeader::~MediaHeader() {} |
431 FourCC MediaHeader::BoxType() const { return FOURCC_MDHD; } | 451 FourCC MediaHeader::BoxType() const { return FOURCC_MDHD; } |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
694 bool MovieFragment::Parse(BoxReader* reader) { | 714 bool MovieFragment::Parse(BoxReader* reader) { |
695 RCHECK(reader->ScanChildren() && | 715 RCHECK(reader->ScanChildren() && |
696 reader->ReadChild(&header) && | 716 reader->ReadChild(&header) && |
697 reader->ReadChildren(&tracks) && | 717 reader->ReadChildren(&tracks) && |
698 reader->MaybeReadChildren(&pssh)); | 718 reader->MaybeReadChildren(&pssh)); |
699 return true; | 719 return true; |
700 } | 720 } |
701 | 721 |
702 } // namespace mp4 | 722 } // namespace mp4 |
703 } // namespace media | 723 } // namespace media |
OLD | NEW |