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

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

Issue 1899423002: Revert of Implement support for vp9 in ISO-BMFF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/filters/stream_parser_factory.cc ('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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 VideoSampleEntry::VideoSampleEntry(const VideoSampleEntry& other) = default; 588 VideoSampleEntry::VideoSampleEntry(const VideoSampleEntry& other) = default;
589 589
590 VideoSampleEntry::~VideoSampleEntry() {} 590 VideoSampleEntry::~VideoSampleEntry() {}
591 FourCC VideoSampleEntry::BoxType() const { 591 FourCC VideoSampleEntry::BoxType() const {
592 DCHECK(false) << "VideoSampleEntry should be parsed according to the " 592 DCHECK(false) << "VideoSampleEntry should be parsed according to the "
593 << "handler type recovered in its Media ancestor."; 593 << "handler type recovered in its Media ancestor.";
594 return FOURCC_NULL; 594 return FOURCC_NULL;
595 } 595 }
596 596
597 namespace {
598
599 bool IsFormatValidH264(const FourCC& format,
600 const ProtectionSchemeInfo& sinf) {
601 return format == FOURCC_AVC1 || format == FOURCC_AVC3 ||
602 (format == FOURCC_ENCV && (sinf.format.format == FOURCC_AVC1 ||
603 sinf.format.format == FOURCC_AVC3));
604 }
605
606 #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
607 bool IsFormatValidHEVC(const FourCC& format,
608 const ProtectionSchemeInfo& sinf) {
609 return format == FOURCC_HEV1 || format == FOURCC_HVC1 ||
610 (format == FOURCC_ENCV && (sinf.format.format == FOURCC_HEV1 ||
611 sinf.format.format == FOURCC_HVC1));
612 }
613 #endif
614
615 }
616
597 bool VideoSampleEntry::Parse(BoxReader* reader) { 617 bool VideoSampleEntry::Parse(BoxReader* reader) {
598 format = reader->type(); 618 format = reader->type();
599 RCHECK(reader->SkipBytes(6) && 619 RCHECK(reader->SkipBytes(6) &&
600 reader->Read2(&data_reference_index) && 620 reader->Read2(&data_reference_index) &&
601 reader->SkipBytes(16) && 621 reader->SkipBytes(16) &&
602 reader->Read2(&width) && 622 reader->Read2(&width) &&
603 reader->Read2(&height) && 623 reader->Read2(&height) &&
604 reader->SkipBytes(50)); 624 reader->SkipBytes(50));
605 625
606 RCHECK(reader->ScanChildren() && 626 RCHECK(reader->ScanChildren() &&
607 reader->MaybeReadChild(&pixel_aspect)); 627 reader->MaybeReadChild(&pixel_aspect));
608 628
609 if (format == FOURCC_ENCV) { 629 if (format == FOURCC_ENCV) {
610 // Continue scanning until a recognized protection scheme is found, or until 630 // Continue scanning until a recognized protection scheme is found, or until
611 // we run out of protection schemes. 631 // we run out of protection schemes.
612 while (sinf.type.type != FOURCC_CENC) { 632 while (sinf.type.type != FOURCC_CENC) {
613 if (!reader->ReadChild(&sinf)) 633 if (!reader->ReadChild(&sinf))
614 return false; 634 return false;
615 } 635 }
616 } 636 }
617 637
618 const FourCC actual_format = 638 if (IsFormatValidH264(format, sinf)) {
619 format == FOURCC_ENCV ? sinf.format.format : format; 639 DVLOG(2) << __FUNCTION__
620 switch (actual_format) { 640 << " reading AVCDecoderConfigurationRecord (avcC)";
621 case FOURCC_AVC1: 641 std::unique_ptr<AVCDecoderConfigurationRecord> avcConfig(
622 case FOURCC_AVC3: { 642 new AVCDecoderConfigurationRecord());
623 DVLOG(2) << __FUNCTION__ 643 RCHECK(reader->ReadChild(avcConfig.get()));
624 << " reading AVCDecoderConfigurationRecord (avcC)"; 644 frame_bitstream_converter =
625 std::unique_ptr<AVCDecoderConfigurationRecord> avcConfig( 645 make_scoped_refptr(new AVCBitstreamConverter(std::move(avcConfig)));
626 new AVCDecoderConfigurationRecord()); 646 video_codec = kCodecH264;
627 RCHECK(reader->ReadChild(avcConfig.get())); 647 video_codec_profile = H264PROFILE_MAIN;
628 frame_bitstream_converter =
629 make_scoped_refptr(new AVCBitstreamConverter(std::move(avcConfig)));
630 video_codec = kCodecH264;
631 video_codec_profile = H264PROFILE_MAIN;
632 break;
633 }
634 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) 648 #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
635 case FOURCC_HEV1: 649 } else if (IsFormatValidHEVC(format, sinf)) {
636 case FOURCC_HVC1: { 650 DVLOG(2) << __FUNCTION__
637 DVLOG(2) << __FUNCTION__ 651 << " parsing HEVCDecoderConfigurationRecord (hvcC)";
638 << " parsing HEVCDecoderConfigurationRecord (hvcC)"; 652 std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig(
639 std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig( 653 new HEVCDecoderConfigurationRecord());
640 new HEVCDecoderConfigurationRecord()); 654 RCHECK(reader->ReadChild(hevcConfig.get()));
641 RCHECK(reader->ReadChild(hevcConfig.get())); 655 frame_bitstream_converter =
642 frame_bitstream_converter = 656 make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig)));
643 make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig))); 657 video_codec = kCodecHEVC;
644 video_codec = kCodecHEVC;
645 break;
646 }
647 #endif 658 #endif
648 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) 659 } else {
649 case FOURCC_VP09: 660 // Unknown/unsupported format
650 frame_bitstream_converter = NULL; 661 MEDIA_LOG(ERROR, reader->media_log()) << __FUNCTION__
651 video_codec = kCodecVP9; 662 << " unsupported video format "
652 // TODO(kqyang): Read VPCodecConfiguration and extract profile 663 << FourCCToString(format);
653 // (crbug.com/604863). 664 return false;
654 break;
655 #endif
656 default:
657 // Unknown/unsupported format
658 MEDIA_LOG(ERROR, reader->media_log()) << __FUNCTION__
659 << " unsupported video format "
660 << FourCCToString(actual_format);
661 return false;
662 } 665 }
663 666
664 return true; 667 return true;
665 } 668 }
666 669
667 bool VideoSampleEntry::IsFormatValid() const { 670 bool VideoSampleEntry::IsFormatValid() const {
668 const FourCC actual_format =
669 format == FOURCC_ENCV ? sinf.format.format : format;
670 switch (actual_format) {
671 case FOURCC_AVC1:
672 case FOURCC_AVC3:
673 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) 671 #if BUILDFLAG(ENABLE_HEVC_DEMUXING)
674 case FOURCC_HEV1: 672 if (IsFormatValidHEVC(format, sinf))
675 case FOURCC_HVC1: 673 return true;
676 #endif 674 #endif
677 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) 675 return IsFormatValidH264(format, sinf);
678 case FOURCC_VP09:
679 #endif
680 return true;
681 default:
682 return false;
683 }
684 } 676 }
685 677
686 ElementaryStreamDescriptor::ElementaryStreamDescriptor() 678 ElementaryStreamDescriptor::ElementaryStreamDescriptor()
687 : object_type(kForbidden) {} 679 : object_type(kForbidden) {}
688 680
689 ElementaryStreamDescriptor::ElementaryStreamDescriptor( 681 ElementaryStreamDescriptor::ElementaryStreamDescriptor(
690 const ElementaryStreamDescriptor& other) = default; 682 const ElementaryStreamDescriptor& other) = default;
691 683
692 ElementaryStreamDescriptor::~ElementaryStreamDescriptor() {} 684 ElementaryStreamDescriptor::~ElementaryStreamDescriptor() {}
693 685
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on( 1216 SampleDependsOn IndependentAndDisposableSamples::sample_depends_on(
1225 size_t i) const { 1217 size_t i) const {
1226 if (i >= sample_depends_on_.size()) 1218 if (i >= sample_depends_on_.size())
1227 return kSampleDependsOnUnknown; 1219 return kSampleDependsOnUnknown;
1228 1220
1229 return sample_depends_on_[i]; 1221 return sample_depends_on_[i];
1230 } 1222 }
1231 1223
1232 } // namespace mp4 1224 } // namespace mp4
1233 } // namespace media 1225 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/stream_parser_factory.cc ('k') | media/formats/mp4/fourccs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698