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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 558 pps_list.resize(num_pps); | 558 pps_list.resize(num_pps); |
| 559 for (int i = 0; i < num_pps; i++) { | 559 for (int i = 0; i < num_pps; i++) { |
| 560 uint16_t pps_length; | 560 uint16_t pps_length; |
| 561 RCHECK(reader->Read2(&pps_length) && | 561 RCHECK(reader->Read2(&pps_length) && |
| 562 reader->ReadVec(&pps_list[i], pps_length)); | 562 reader->ReadVec(&pps_list[i], pps_length)); |
| 563 } | 563 } |
| 564 | 564 |
| 565 return true; | 565 return true; |
| 566 } | 566 } |
| 567 | 567 |
| 568 VPCodecConfigurationRecord::VPCodecConfigurationRecord() | |
| 569 : profile(VIDEO_CODEC_PROFILE_UNKNOWN) {} | |
| 570 | |
| 571 VPCodecConfigurationRecord::VPCodecConfigurationRecord( | |
|
tinskip
2016/06/06 20:13:34
If using the default copy constructor, why bother
kqyang
2016/06/06 20:30:18
The box methods are declared using macro: https://
| |
| 572 const VPCodecConfigurationRecord& other) = default; | |
| 573 | |
| 574 VPCodecConfigurationRecord::~VPCodecConfigurationRecord() {} | |
| 575 | |
| 576 FourCC VPCodecConfigurationRecord::BoxType() const { | |
| 577 return FOURCC_VPCC; | |
| 578 } | |
| 579 | |
| 580 bool VPCodecConfigurationRecord::Parse(BoxReader* reader) { | |
| 581 uint8_t profile_indication = 0; | |
| 582 RCHECK(reader->ReadFullBoxHeader() && reader->Read1(&profile_indication)); | |
| 583 // The remaining fields are not parsed as we don't care about them for now. | |
| 584 | |
| 585 RCHECK(profile_indication < 4); | |
|
tinskip
2016/06/06 20:13:34
There are, and will only be 2 VP9 profiles: 0 and
kqyang
2016/06/06 20:30:18
There are actually four profiles: https://en.wikip
| |
| 586 switch (profile_indication) { | |
| 587 case 0: | |
| 588 profile = VP9PROFILE_PROFILE0; | |
| 589 break; | |
| 590 case 1: | |
| 591 profile = VP9PROFILE_PROFILE1; | |
| 592 break; | |
| 593 case 2: | |
| 594 profile = VP9PROFILE_PROFILE2; | |
| 595 break; | |
| 596 case 3: | |
| 597 profile = VP9PROFILE_PROFILE3; | |
| 598 break; | |
| 599 } | |
|
ddorwin
2016/06/14 18:58:22
maybe DVLOG(WARNING) all other cases.
kqyang
2016/06/14 21:02:32
Removed line 585 and add a default case here.
| |
| 600 return true; | |
| 601 } | |
| 602 | |
| 568 PixelAspectRatioBox::PixelAspectRatioBox() : h_spacing(1), v_spacing(1) {} | 603 PixelAspectRatioBox::PixelAspectRatioBox() : h_spacing(1), v_spacing(1) {} |
| 569 PixelAspectRatioBox::PixelAspectRatioBox(const PixelAspectRatioBox& other) = | 604 PixelAspectRatioBox::PixelAspectRatioBox(const PixelAspectRatioBox& other) = |
| 570 default; | 605 default; |
| 571 PixelAspectRatioBox::~PixelAspectRatioBox() {} | 606 PixelAspectRatioBox::~PixelAspectRatioBox() {} |
| 572 FourCC PixelAspectRatioBox::BoxType() const { return FOURCC_PASP; } | 607 FourCC PixelAspectRatioBox::BoxType() const { return FOURCC_PASP; } |
| 573 | 608 |
| 574 bool PixelAspectRatioBox::Parse(BoxReader* reader) { | 609 bool PixelAspectRatioBox::Parse(BoxReader* reader) { |
| 575 RCHECK(reader->Read4(&h_spacing) && | 610 RCHECK(reader->Read4(&h_spacing) && |
| 576 reader->Read4(&v_spacing)); | 611 reader->Read4(&v_spacing)); |
| 577 return true; | 612 return true; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 639 std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig( | 674 std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig( |
| 640 new HEVCDecoderConfigurationRecord()); | 675 new HEVCDecoderConfigurationRecord()); |
| 641 RCHECK(reader->ReadChild(hevcConfig.get())); | 676 RCHECK(reader->ReadChild(hevcConfig.get())); |
| 642 frame_bitstream_converter = | 677 frame_bitstream_converter = |
| 643 make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig))); | 678 make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig))); |
| 644 video_codec = kCodecHEVC; | 679 video_codec = kCodecHEVC; |
| 645 break; | 680 break; |
| 646 } | 681 } |
| 647 #endif | 682 #endif |
| 648 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) | 683 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) |
| 649 case FOURCC_VP09: | 684 case FOURCC_VP09: { |
| 650 frame_bitstream_converter = NULL; | 685 frame_bitstream_converter = NULL; |
| 651 video_codec = kCodecVP9; | 686 video_codec = kCodecVP9; |
| 652 // TODO(kqyang): Read VPCodecConfiguration and extract profile | 687 |
| 653 // (crbug.com/604863). | 688 DVLOG(2) << __FUNCTION__ << " parsing VPCodecConfigurationRecord (vpcC)"; |
|
ddorwin
2016/06/14 18:58:22
nit: Log at the top of the block for consistency.
kqyang
2016/06/14 21:02:32
Done.
| |
| 689 std::unique_ptr<VPCodecConfigurationRecord> vp_config( | |
| 690 new VPCodecConfigurationRecord()); | |
| 691 RCHECK(reader->ReadChild(vp_config.get())); | |
| 692 video_codec_profile = vp_config->profile; | |
| 654 break; | 693 break; |
| 694 } | |
| 655 #endif | 695 #endif |
| 656 default: | 696 default: |
| 657 // Unknown/unsupported format | 697 // Unknown/unsupported format |
| 658 MEDIA_LOG(ERROR, reader->media_log()) << __FUNCTION__ | 698 MEDIA_LOG(ERROR, reader->media_log()) << __FUNCTION__ |
| 659 << " unsupported video format " | 699 << " unsupported video format " |
| 660 << FourCCToString(actual_format); | 700 << FourCCToString(actual_format); |
| 661 return false; | 701 return false; |
| 662 } | 702 } |
| 663 | 703 |
| 664 return true; | 704 return true; |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1224 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on( | 1264 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on( |
| 1225 size_t i) const { | 1265 size_t i) const { |
| 1226 if (i >= sample_depends_on_.size()) | 1266 if (i >= sample_depends_on_.size()) |
| 1227 return kSampleDependsOnUnknown; | 1267 return kSampleDependsOnUnknown; |
| 1228 | 1268 |
| 1229 return sample_depends_on_[i]; | 1269 return sample_depends_on_[i]; |
| 1230 } | 1270 } |
| 1231 | 1271 |
| 1232 } // namespace mp4 | 1272 } // namespace mp4 |
| 1233 } // namespace media | 1273 } // namespace media |
| OLD | NEW |