Index: media/formats/mp4/box_definitions.cc |
diff --git a/media/formats/mp4/box_definitions.cc b/media/formats/mp4/box_definitions.cc |
index f541ee633760d0e736a733ab470fbbb30f6a47f6..d3e2a0058a668222a79e79464b72f02b629a0468 100644 |
--- a/media/formats/mp4/box_definitions.cc |
+++ b/media/formats/mp4/box_definitions.cc |
@@ -24,6 +24,10 @@ |
#include "media/formats/mp4/hevc.h" |
#endif |
+#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
+#include "media/formats/mp4/dolby_vision.h" |
wolenetz
2017/01/25 23:42:42
nit: ordering of include: dolby_vision < hevc alph
erickung1
2017/02/03 18:18:31
Done.
|
+#endif |
+ |
namespace media { |
namespace mp4 { |
@@ -700,8 +704,10 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { |
reader->Read2(&height) && |
reader->SkipBytes(50)); |
- RCHECK(reader->ScanChildren() && |
- reader->MaybeReadChild(&pixel_aspect)); |
+ RCHECK(reader->ScanChildren()); |
+ if (reader->HasChild(&pixel_aspect)) { |
wolenetz
2017/01/25 23:42:41
Why "maybe", if it has the child? Why didn't previ
erickung1
2017/02/03 18:18:32
Done. Remove the code since it was just experiment
|
+ RCHECK(reader->MaybeReadChild(&pixel_aspect)); |
+ } |
if (format == FOURCC_ENCV) { |
// Continue scanning until a recognized protection scheme is found, or until |
@@ -726,6 +732,16 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { |
avcConfig->profile_indication); |
frame_bitstream_converter = |
make_scoped_refptr(new AVCBitstreamConverter(std::move(avcConfig))); |
+#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
+ // It can be Dolby Vision stream if there is DVCC box. |
+ DolbyVisionConfiguration dvccConfig; |
+ if (reader->HasChild(&dvccConfig) && reader->ReadChild(&dvccConfig)) { |
wolenetz
2017/01/25 23:42:41
Why not log reading dvcc here?
erickung1
2017/02/03 18:18:32
Done.
|
+ static_cast<AVCBitstreamConverter*>(frame_bitstream_converter.get()) |
+ ->DisablePostAnnexbValidation(); |
wolenetz
2017/01/25 23:42:41
Comment why, please, and note this is only changin
|
+ video_codec = kCodecDolbyVision; |
+ video_codec_profile = dvccConfig.codec_profile; |
+ } |
+#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
break; |
} |
#if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
@@ -739,9 +755,47 @@ bool VideoSampleEntry::Parse(BoxReader* reader) { |
video_codec_profile = hevcConfig->GetVideoProfile(); |
frame_bitstream_converter = |
make_scoped_refptr(new HEVCBitstreamConverter(std::move(hevcConfig))); |
+#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
+ // It can be Dolby Vision stream if there is DVCC box. |
+ DolbyVisionConfiguration dvccConfig; |
+ if (reader->HasChild(&dvccConfig) && reader->ReadChild(&dvccConfig)) { |
wolenetz
2017/01/25 23:42:41
why not DisablePostAnnexbValidation on it here?
wolenetz
2017/01/25 23:42:42
Also, why not log reading dvcc here?
erickung1
2017/02/03 18:18:31
Done.
|
+ video_codec = kCodecDolbyVision; |
+ video_codec_profile = dvccConfig.codec_profile; |
+ } |
+#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
break; |
} |
-#endif |
+#endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) |
+#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
+ case FOURCC_DVAV: { |
wolenetz
2017/01/25 23:42:42
Is there no DVA1 or DVH1 needed?
erickung1
2017/02/03 18:18:32
Done.
|
+ DVLOG(2) << __func__ << " reading AVCDecoderConfigurationRecord (avcC)"; |
+ std::unique_ptr<AVCDecoderConfigurationRecord> avcConfig( |
+ new AVCDecoderConfigurationRecord()); |
+ RCHECK(reader->ReadChild(avcConfig.get())); |
+ frame_bitstream_converter = |
wolenetz
2017/01/25 23:42:41
Why not DisablePostAnnexbValidation on it here?
|
+ make_scoped_refptr(new AVCBitstreamConverter(std::move(avcConfig))); |
+ DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC)"; |
+ DolbyVisionConfiguration dvccConfig; |
+ RCHECK(reader->ReadChild(&dvccConfig)); |
+ video_codec = kCodecDolbyVision; |
+ video_codec_profile = dvccConfig.codec_profile; |
+ break; |
+ } |
+ case FOURCC_DVHE: { |
+ DVLOG(2) << __func__ << " reading 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))); |
wolenetz
2017/01/25 23:42:41
Why not DisablePostAnnexbValidation on it here?
|
+ DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC)"; |
+ DolbyVisionConfiguration dvccConfig; |
+ RCHECK(reader->ReadChild(&dvccConfig)); |
+ video_codec = kCodecDolbyVision; |
+ video_codec_profile = dvccConfig.codec_profile; |
+ break; |
+ } |
+#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
case FOURCC_VP09: |
if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableVp9InMp4)) { |
@@ -778,6 +832,10 @@ bool VideoSampleEntry::IsFormatValid() const { |
case FOURCC_HEV1: |
case FOURCC_HVC1: |
#endif |
+#if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
+ case FOURCC_DVAV: |
wolenetz
2017/01/25 23:42:41
ditto: DVA1? DVH1?
erickung1
2017/02/03 18:18:31
Done.
|
+ case FOURCC_DVHE: |
+#endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) |
return true; |
case FOURCC_VP09: |
return base::CommandLine::ForCurrentProcess()->HasSwitch( |