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

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

Issue 1624703002: Implement support for vp9 in ISO-BMFF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
Index: media/formats/mp4/box_definitions.cc
diff --git a/media/formats/mp4/box_definitions.cc b/media/formats/mp4/box_definitions.cc
index fa76eb2b930ebbac7aebef333655369011895bfb..70aba540b5bf4d63d7202798a5805fde0a645462 100644
--- a/media/formats/mp4/box_definitions.cc
+++ b/media/formats/mp4/box_definitions.cc
@@ -478,22 +478,20 @@ FourCC VideoSampleEntry::BoxType() const {
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));
+bool IsFormatValidH264(FourCC format) {
+ return format == FOURCC_AVC1 || 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));
+bool IsFormatValidHEVC(FourCC format) {
+ return format == FOURCC_HEV1 || format == FOURCC_HVC1;
}
#endif
+bool IsFormatValidVpx(FourCC format) {
+ return format == FOURCC_VP08 || format == FOURCC_VP09;
+}
+
}
bool VideoSampleEntry::Parse(BoxReader* reader) {
@@ -517,7 +515,9 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
}
}
- if (IsFormatValidH264(format, sinf)) {
+ const FourCC actual_format =
+ format == FOURCC_ENCV ? sinf.format.format : format;
+ if (IsFormatValidH264(actual_format)) {
DVLOG(2) << __FUNCTION__
<< " reading AVCDecoderConfigurationRecord (avcC)";
scoped_ptr<AVCDecoderConfigurationRecord> avcConfig(
@@ -528,7 +528,7 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
video_codec = kCodecH264;
video_codec_profile = H264PROFILE_MAIN;
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
- } else if (IsFormatValidHEVC(format, sinf)) {
+ } else if (IsFormatValidHEVC(actual_format)) {
DVLOG(2) << __FUNCTION__
<< " parsing HEVCDecoderConfigurationRecord (hvcC)";
scoped_ptr<HEVCDecoderConfigurationRecord> hevcConfig(
@@ -538,6 +538,20 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig)));
video_codec = kCodecHEVC;
#endif
+ } else if (IsFormatValidVpx(actual_format)) {
+ frame_bitstream_converter = NULL;
+ switch (actual_format) {
+ case FOURCC_VP08:
+ video_codec = kCodecVP8;
+ video_codec_profile = VP8PROFILE_ANY;
+ break;
+ case FOURCC_VP09:
+ video_codec = kCodecVP9;
+ video_codec_profile = VP9PROFILE_ANY;
+ break;
+ default:
+ NOTREACHED() << "Unexpected format " << actual_format;
+ }
} else {
// Unknown/unsupported format
MEDIA_LOG(ERROR, reader->media_log()) << __FUNCTION__
@@ -550,11 +564,17 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
}
bool VideoSampleEntry::IsFormatValid() const {
+ const FourCC actual_format =
+ format == FOURCC_ENCV ? sinf.format.format : format;
#if BUILDFLAG(ENABLE_HEVC_DEMUXING)
- if (IsFormatValidHEVC(format, sinf))
+ if (IsFormatValidHEVC(actual_format))
return true;
#endif
- return IsFormatValidH264(format, sinf);
+ if (IsFormatValidH264(actual_format))
+ return true;
+ if (IsFormatValidVpx(actual_format))
+ return true;
+ return false;
}
ElementaryStreamDescriptor::ElementaryStreamDescriptor()

Powered by Google App Engine
This is Rietveld 408576698