Index: media/formats/webm/webm_video_client.cc |
diff --git a/media/formats/webm/webm_video_client.cc b/media/formats/webm/webm_video_client.cc |
index 73bd095b854b73afd57276d232e7032cd3c4b543..1f8d288afded331769fdacfcaae12ec0f4b7d73c 100644 |
--- a/media/formats/webm/webm_video_client.cc |
+++ b/media/formats/webm/webm_video_client.cc |
@@ -28,6 +28,7 @@ void WebMVideoClient::Reset() { |
display_height_ = -1; |
display_unit_ = -1; |
alpha_mode_ = -1; |
+ colour_parsed_ = false; |
} |
bool WebMVideoClient::InitializeConfig( |
@@ -96,9 +97,29 @@ bool WebMVideoClient::InitializeConfig( |
config->Initialize(video_codec, profile, format, COLOR_SPACE_HD_REC709, |
coded_size, visible_rect, natural_size, codec_private, |
encryption_scheme); |
+ if (colour_parsed_) { |
+ WebMColorMetadata color_metadata = colour_parser_.GetWebMColorMetadata(); |
+ config->set_color_space_info(color_metadata.color_space); |
+ config->set_hdr_metadata(color_metadata.hdr_metadata); |
+ } |
return config->IsValidConfig(); |
} |
+WebMParserClient* WebMVideoClient::OnListStart(int id) { |
+ if (id == kWebMIdColour) { |
+ colour_parsed_ = false; |
+ return &colour_parser_; |
+ } |
+ |
+ return this; |
+} |
+ |
+bool WebMVideoClient::OnListEnd(int id) { |
+ if (id == kWebMIdColour) |
+ colour_parsed_ = true; |
+ return true; |
+} |
+ |
bool WebMVideoClient::OnUInt(int id, int64_t val) { |
int64_t* dst = NULL; |