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

Unified Diff: media/formats/mp4/box_definitions.cc

Issue 1897363004: Reland 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/box_definitions.cc
diff --git a/media/formats/mp4/box_definitions.cc b/media/formats/mp4/box_definitions.cc
index 1b9a8338cf41cfd9dd5d8f676fb3fe6422db5472..82a94709f73f5572dd0f2dc6b52fe5c41080b9fb 100644
--- a/media/formats/mp4/box_definitions.cc
+++ b/media/formats/mp4/box_definitions.cc
@@ -594,26 +594,6 @@
return FOURCC_NULL;
}
-namespace {
-
-bool IsFormatValidH264(const FourCC& format,
- const ProtectionSchemeInfo& sinf) {
- return format == FOURCC_AVC1 || format == FOURCC_AVC3 ||
- (format == FOURCC_ENCV && (sinf.format.format == FOURCC_AVC1 ||
- sinf.format.format == FOURCC_AVC3));
-}
-
-#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
-bool IsFormatValidHEVC(const FourCC& format,
- const ProtectionSchemeInfo& sinf) {
- return format == FOURCC_HEV1 || format == FOURCC_HVC1 ||
- (format == FOURCC_ENCV && (sinf.format.format == FOURCC_HEV1 ||
- sinf.format.format == FOURCC_HVC1));
-}
-#endif
-
-}
-
bool VideoSampleEntry::Parse(BoxReader* reader) {
format = reader->type();
RCHECK(reader->SkipBytes(6) &&
@@ -635,44 +615,72 @@
}
}
- if (IsFormatValidH264(format, sinf)) {
- DVLOG(2) << __FUNCTION__
- << " reading AVCDecoderConfigurationRecord (avcC)";
- std::unique_ptr<AVCDecoderConfigurationRecord> avcConfig(
- new AVCDecoderConfigurationRecord());
- RCHECK(reader->ReadChild(avcConfig.get()));
- frame_bitstream_converter =
- make_scoped_refptr(new AVCBitstreamConverter(std::move(avcConfig)));
- video_codec = kCodecH264;
- video_codec_profile = H264PROFILE_MAIN;
+ const FourCC actual_format =
+ format == FOURCC_ENCV ? sinf.format.format : format;
+ switch (actual_format) {
+ case FOURCC_AVC1:
+ case FOURCC_AVC3: {
+ DVLOG(2) << __FUNCTION__
+ << " reading AVCDecoderConfigurationRecord (avcC)";
+ std::unique_ptr<AVCDecoderConfigurationRecord> avcConfig(
+ new AVCDecoderConfigurationRecord());
+ RCHECK(reader->ReadChild(avcConfig.get()));
+ frame_bitstream_converter =
+ make_scoped_refptr(new AVCBitstreamConverter(std::move(avcConfig)));
+ video_codec = kCodecH264;
+ video_codec_profile = H264PROFILE_MAIN;
+ break;
+ }
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
- } else if (IsFormatValidHEVC(format, sinf)) {
- DVLOG(2) << __FUNCTION__
- << " parsing HEVCDecoderConfigurationRecord (hvcC)";
- std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig(
- new HEVCDecoderConfigurationRecord());
- RCHECK(reader->ReadChild(hevcConfig.get()));
- frame_bitstream_converter =
- make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig)));
- video_codec = kCodecHEVC;
+ case FOURCC_HEV1:
+ case FOURCC_HVC1: {
+ DVLOG(2) << __FUNCTION__
+ << " parsing HEVCDecoderConfigurationRecord (hvcC)";
+ std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig(
+ new HEVCDecoderConfigurationRecord());
+ RCHECK(reader->ReadChild(hevcConfig.get()));
+ frame_bitstream_converter =
+ make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig)));
+ video_codec = kCodecHEVC;
+ break;
+ }
#endif
- } else {
- // Unknown/unsupported format
- MEDIA_LOG(ERROR, reader->media_log()) << __FUNCTION__
- << " unsupported video format "
- << FourCCToString(format);
- return false;
+#if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING)
+ case FOURCC_VP09:
+ frame_bitstream_converter = NULL;
+ video_codec = kCodecVP9;
+ // TODO(kqyang): Read VPCodecConfiguration and extract profile
+ // (crbug.com/604863).
+ break;
+#endif
+ default:
+ // Unknown/unsupported format
+ MEDIA_LOG(ERROR, reader->media_log()) << __FUNCTION__
+ << " unsupported video format "
+ << FourCCToString(actual_format);
+ return false;
}
return true;
}
bool VideoSampleEntry::IsFormatValid() const {
+ const FourCC actual_format =
+ format == FOURCC_ENCV ? sinf.format.format : format;
+ switch (actual_format) {
+ case FOURCC_AVC1:
+ case FOURCC_AVC3:
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
- if (IsFormatValidHEVC(format, sinf))
- return true;
+ case FOURCC_HEV1:
+ case FOURCC_HVC1:
#endif
- return IsFormatValidH264(format, sinf);
+#if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING)
+ case FOURCC_VP09:
+#endif
+ return true;
+ default:
+ return false;
+ }
}
ElementaryStreamDescriptor::ElementaryStreamDescriptor()
« 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