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

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

Issue 1933793003: Parse VPCodecConfiguration and extract VP9 profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/fourccs.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 <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
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(
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 switch (profile_indication) {
586 case 0:
587 profile = VP9PROFILE_PROFILE0;
588 break;
589 case 1:
590 profile = VP9PROFILE_PROFILE1;
591 break;
592 case 2:
593 profile = VP9PROFILE_PROFILE2;
594 break;
595 case 3:
596 profile = VP9PROFILE_PROFILE3;
597 break;
598 default:
599 MEDIA_LOG(ERROR, reader->media_log()) << "Unsupported VP9 profile: "
600 << profile_indication;
601 return false;
602 }
603 return true;
604 }
605
568 PixelAspectRatioBox::PixelAspectRatioBox() : h_spacing(1), v_spacing(1) {} 606 PixelAspectRatioBox::PixelAspectRatioBox() : h_spacing(1), v_spacing(1) {}
569 PixelAspectRatioBox::PixelAspectRatioBox(const PixelAspectRatioBox& other) = 607 PixelAspectRatioBox::PixelAspectRatioBox(const PixelAspectRatioBox& other) =
570 default; 608 default;
571 PixelAspectRatioBox::~PixelAspectRatioBox() {} 609 PixelAspectRatioBox::~PixelAspectRatioBox() {}
572 FourCC PixelAspectRatioBox::BoxType() const { return FOURCC_PASP; } 610 FourCC PixelAspectRatioBox::BoxType() const { return FOURCC_PASP; }
573 611
574 bool PixelAspectRatioBox::Parse(BoxReader* reader) { 612 bool PixelAspectRatioBox::Parse(BoxReader* reader) {
575 RCHECK(reader->Read4(&h_spacing) && 613 RCHECK(reader->Read4(&h_spacing) &&
576 reader->Read4(&v_spacing)); 614 reader->Read4(&v_spacing));
577 return true; 615 return true;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig( 677 std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig(
640 new HEVCDecoderConfigurationRecord()); 678 new HEVCDecoderConfigurationRecord());
641 RCHECK(reader->ReadChild(hevcConfig.get())); 679 RCHECK(reader->ReadChild(hevcConfig.get()));
642 frame_bitstream_converter = 680 frame_bitstream_converter =
643 make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig))); 681 make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig)));
644 video_codec = kCodecHEVC; 682 video_codec = kCodecHEVC;
645 break; 683 break;
646 } 684 }
647 #endif 685 #endif
648 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) 686 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING)
649 case FOURCC_VP09: 687 case FOURCC_VP09: {
650 frame_bitstream_converter = NULL; 688 DVLOG(2) << __FUNCTION__ << " parsing VPCodecConfigurationRecord (vpcC)";
689 std::unique_ptr<VPCodecConfigurationRecord> vp_config(
690 new VPCodecConfigurationRecord());
691 RCHECK(reader->ReadChild(vp_config.get()));
692 frame_bitstream_converter = nullptr;
651 video_codec = kCodecVP9; 693 video_codec = kCodecVP9;
652 // TODO(kqyang): Read VPCodecConfiguration and extract profile 694 video_codec_profile = vp_config->profile;
653 // (crbug.com/604863).
654 break; 695 break;
696 }
655 #endif 697 #endif
656 default: 698 default:
657 // Unknown/unsupported format 699 // Unknown/unsupported format
658 MEDIA_LOG(ERROR, reader->media_log()) << __FUNCTION__ 700 MEDIA_LOG(ERROR, reader->media_log()) << __FUNCTION__
659 << " unsupported video format " 701 << " unsupported video format "
660 << FourCCToString(actual_format); 702 << FourCCToString(actual_format);
661 return false; 703 return false;
662 } 704 }
663 705
664 return true; 706 return true;
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on( 1266 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on(
1225 size_t i) const { 1267 size_t i) const {
1226 if (i >= sample_depends_on_.size()) 1268 if (i >= sample_depends_on_.size())
1227 return kSampleDependsOnUnknown; 1269 return kSampleDependsOnUnknown;
1228 1270
1229 return sample_depends_on_[i]; 1271 return sample_depends_on_[i];
1230 } 1272 }
1231 1273
1232 } // namespace mp4 1274 } // namespace mp4
1233 } // namespace media 1275 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp4/box_definitions.h ('k') | media/formats/mp4/fourccs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698