summaryrefslogtreecommitdiff
path: root/chromium/media/formats/mp4/box_definitions.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 15:28:34 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 13:54:51 +0000
commit2a19c63448c84c1805fb1a585c3651318bb86ca7 (patch)
treeeb17888e8531aa6ee5e85721bd553b832a7e5156 /chromium/media/formats/mp4/box_definitions.cc
parentb014812705fc80bff0a5c120dfcef88f349816dc (diff)
downloadqtwebengine-chromium-2a19c63448c84c1805fb1a585c3651318bb86ca7.tar.gz
BASELINE: Update Chromium to 69.0.3497.70
Change-Id: I2b7b56e4e7a8b26656930def0d4575dc32b900a0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/media/formats/mp4/box_definitions.cc')
-rw-r--r--chromium/media/formats/mp4/box_definitions.cc88
1 files changed, 81 insertions, 7 deletions
diff --git a/chromium/media/formats/mp4/box_definitions.cc b/chromium/media/formats/mp4/box_definitions.cc
index 6def180d143..f3761045648 100644
--- a/chromium/media/formats/mp4/box_definitions.cc
+++ b/chromium/media/formats/mp4/box_definitions.cc
@@ -690,6 +690,81 @@ bool VPCodecConfigurationRecord::Parse(BoxReader* reader) {
return true;
}
+#if BUILDFLAG(ENABLE_AV1_DECODER)
+AV1CodecConfigurationRecord::AV1CodecConfigurationRecord()
+ : profile(VIDEO_CODEC_PROFILE_UNKNOWN) {}
+
+AV1CodecConfigurationRecord::AV1CodecConfigurationRecord(
+ const AV1CodecConfigurationRecord& other) = default;
+
+AV1CodecConfigurationRecord::~AV1CodecConfigurationRecord() = default;
+
+FourCC AV1CodecConfigurationRecord::BoxType() const {
+ return FOURCC_AV1C;
+}
+
+// Parse the AV1CodecConfigurationRecord, which has the following format:
+// unsigned int (1) marker = 1;
+// unsigned int (7) version = 1;
+// unsigned int (3) seq_profile;
+// unsigned int (5) seq_level_idx_0;
+// unsigned int (1) seq_tier_0;
+// unsigned int (1) high_bitdepth;
+// unsigned int (1) twelve_bit;
+// unsigned int (1) monochrome;
+// unsigned int (1) chroma_subsampling_x;
+// unsigned int (1) chroma_subsampling_y;
+// unsigned int (2) chroma_sample_position;
+// unsigned int (3) reserved = 0;
+//
+// unsigned int (1) initial_presentation_delay_present;
+// if (initial_presentation_delay_present) {
+// unsigned int (4) initial_presentation_delay_minus_one;
+// } else {
+// unsigned int (4) reserved = 0;
+// }
+//
+// unsigned int (8)[] configOBUs;
+bool AV1CodecConfigurationRecord::Parse(BoxReader* reader) {
+ uint8_t av1c_byte = 0;
+ RCHECK(reader->Read1(&av1c_byte));
+ const uint8_t av1c_marker = av1c_byte >> 7;
+ if (!av1c_marker) {
+ MEDIA_LOG(ERROR, reader->media_log()) << "Unsupported av1C: marker unset.";
+ return false;
+ }
+
+ const uint8_t av1c_version = av1c_byte & 0b01111111;
+ if (av1c_version != 1) {
+ MEDIA_LOG(ERROR, reader->media_log())
+ << "Unsupported av1C: unexpected version number: " << av1c_version;
+ return false;
+ }
+
+ RCHECK(reader->Read1(&av1c_byte));
+ const uint8_t seq_profile = av1c_byte >> 5;
+ switch (seq_profile) {
+ case 0:
+ profile = AV1PROFILE_PROFILE_MAIN;
+ break;
+ case 1:
+ profile = AV1PROFILE_PROFILE_HIGH;
+ break;
+ case 2:
+ profile = AV1PROFILE_PROFILE_PRO;
+ break;
+ default:
+ MEDIA_LOG(ERROR, reader->media_log())
+ << "Unsupported av1C: unknown profile 0x" << std::hex << seq_profile;
+ return false;
+ }
+
+ // The remaining fields are ignored since we don't care about them yet.
+
+ return true;
+}
+#endif // BUILDFLAG(ENABLE_AV1_DECODER)
+
PixelAspectRatioBox::PixelAspectRatioBox() : h_spacing(1), v_spacing(1) {}
PixelAspectRatioBox::PixelAspectRatioBox(const PixelAspectRatioBox& other) =
default;
@@ -842,20 +917,19 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
#if BUILDFLAG(ENABLE_AV1_DECODER)
case FOURCC_AV01: {
DVLOG(2) << __func__ << " reading AV1 configuration.";
- // TODO(dalecurtis): AV1 profiles are not finalized, this needs updating
- // to read the actual profile and configuration before enabling for
- // release. http://crbug.com/784993
+ AV1CodecConfigurationRecord av1_config;
+ RCHECK(reader->ReadChild(&av1_config));
frame_bitstream_converter = nullptr;
video_codec = kCodecAV1;
- video_codec_profile = AV1PROFILE_PROFILE0;
+ video_codec_profile = av1_config.profile;
break;
}
#endif
default:
// Unknown/unsupported format
- MEDIA_LOG(ERROR, reader->media_log()) << __func__
- << " unsupported video format "
- << FourCCToString(actual_format);
+ MEDIA_LOG(ERROR, reader->media_log())
+ << "Unsupported VisualSampleEntry type "
+ << FourCCToString(actual_format);
return false;
}