OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/formats/webm/webm_video_client.h" | 5 #include "media/formats/webm/webm_video_client.h" |
6 | 6 |
7 #include "media/base/video_decoder_config.h" | 7 #include "media/base/video_decoder_config.h" |
8 #include "media/formats/webm/webm_constants.h" | 8 #include "media/formats/webm/webm_constants.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
(...skipping 10 matching lines...) Expand all Loading... |
21 pixel_width_ = -1; | 21 pixel_width_ = -1; |
22 pixel_height_ = -1; | 22 pixel_height_ = -1; |
23 crop_bottom_ = -1; | 23 crop_bottom_ = -1; |
24 crop_top_ = -1; | 24 crop_top_ = -1; |
25 crop_left_ = -1; | 25 crop_left_ = -1; |
26 crop_right_ = -1; | 26 crop_right_ = -1; |
27 display_width_ = -1; | 27 display_width_ = -1; |
28 display_height_ = -1; | 28 display_height_ = -1; |
29 display_unit_ = -1; | 29 display_unit_ = -1; |
30 alpha_mode_ = -1; | 30 alpha_mode_ = -1; |
| 31 colour_parsed_ = false; |
31 } | 32 } |
32 | 33 |
33 bool WebMVideoClient::InitializeConfig( | 34 bool WebMVideoClient::InitializeConfig( |
34 const std::string& codec_id, | 35 const std::string& codec_id, |
35 const std::vector<uint8_t>& codec_private, | 36 const std::vector<uint8_t>& codec_private, |
36 const EncryptionScheme& encryption_scheme, | 37 const EncryptionScheme& encryption_scheme, |
37 VideoDecoderConfig* config) { | 38 VideoDecoderConfig* config) { |
38 DCHECK(config); | 39 DCHECK(config); |
39 | 40 |
40 VideoCodec video_codec = kUnknownVideoCodec; | 41 VideoCodec video_codec = kUnknownVideoCodec; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } else { | 90 } else { |
90 MEDIA_LOG(ERROR, media_log_) << "Unsupported display unit type " | 91 MEDIA_LOG(ERROR, media_log_) << "Unsupported display unit type " |
91 << display_unit_; | 92 << display_unit_; |
92 return false; | 93 return false; |
93 } | 94 } |
94 gfx::Size natural_size = gfx::Size(display_width_, display_height_); | 95 gfx::Size natural_size = gfx::Size(display_width_, display_height_); |
95 | 96 |
96 config->Initialize(video_codec, profile, format, COLOR_SPACE_HD_REC709, | 97 config->Initialize(video_codec, profile, format, COLOR_SPACE_HD_REC709, |
97 coded_size, visible_rect, natural_size, codec_private, | 98 coded_size, visible_rect, natural_size, codec_private, |
98 encryption_scheme); | 99 encryption_scheme); |
| 100 if (colour_parsed_) { |
| 101 WebMColorMetadata color_metadata = colour_parser_.GetWebMColorMetadata(); |
| 102 config->set_color_space_info(color_metadata.color_space); |
| 103 config->set_hdr_metadata(color_metadata.hdr_metadata); |
| 104 } |
99 return config->IsValidConfig(); | 105 return config->IsValidConfig(); |
100 } | 106 } |
101 | 107 |
| 108 WebMParserClient* WebMVideoClient::OnListStart(int id) { |
| 109 if (id == kWebMIdColour) { |
| 110 colour_parsed_ = false; |
| 111 return &colour_parser_; |
| 112 } |
| 113 |
| 114 return this; |
| 115 } |
| 116 |
| 117 bool WebMVideoClient::OnListEnd(int id) { |
| 118 if (id == kWebMIdColour) |
| 119 colour_parsed_ = true; |
| 120 return true; |
| 121 } |
| 122 |
102 bool WebMVideoClient::OnUInt(int id, int64_t val) { | 123 bool WebMVideoClient::OnUInt(int id, int64_t val) { |
103 int64_t* dst = NULL; | 124 int64_t* dst = NULL; |
104 | 125 |
105 switch (id) { | 126 switch (id) { |
106 case kWebMIdPixelWidth: | 127 case kWebMIdPixelWidth: |
107 dst = &pixel_width_; | 128 dst = &pixel_width_; |
108 break; | 129 break; |
109 case kWebMIdPixelHeight: | 130 case kWebMIdPixelHeight: |
110 dst = &pixel_height_; | 131 dst = &pixel_height_; |
111 break; | 132 break; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Accept binary fields we don't care about for now. | 173 // Accept binary fields we don't care about for now. |
153 return true; | 174 return true; |
154 } | 175 } |
155 | 176 |
156 bool WebMVideoClient::OnFloat(int id, double val) { | 177 bool WebMVideoClient::OnFloat(int id, double val) { |
157 // Accept float fields we don't care about for now. | 178 // Accept float fields we don't care about for now. |
158 return true; | 179 return true; |
159 } | 180 } |
160 | 181 |
161 } // namespace media | 182 } // namespace media |
OLD | NEW |