OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ | 5 #ifndef CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ |
6 #define CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ | 6 #define CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 | 154 |
155 inline EncryptionScheme Unencrypted() { | 155 inline EncryptionScheme Unencrypted() { |
156 return EncryptionScheme(); | 156 return EncryptionScheme(); |
157 } | 157 } |
158 | 158 |
159 inline EncryptionScheme AesCtrEncryptionScheme() { | 159 inline EncryptionScheme AesCtrEncryptionScheme() { |
160 return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR, | 160 return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR, |
161 EncryptionScheme::Pattern()); | 161 EncryptionScheme::Pattern()); |
162 } | 162 } |
163 | 163 |
164 // ---- Begin copy/paste from ui/gfx/color_space.h ---- | |
165 enum class PrimaryID : uint16_t { | |
166 // The first 0-255 values should match the H264 specification. | |
167 RESERVED0 = 0, | |
168 BT709 = 1, | |
169 UNSPECIFIED = 2, | |
170 RESERVED = 3, | |
171 BT470M = 4, | |
172 BT470BG = 5, | |
173 SMPTE170M = 6, | |
174 SMPTE240M = 7, | |
175 FILM = 8, | |
176 BT2020 = 9, | |
177 SMPTEST428_1 = 10, | |
178 SMPTEST431_2 = 11, | |
179 SMPTEST432_1 = 12, | |
halliwell
2016/09/23 17:31:05
Do we need all these values? It seems like a lot
servolk
2016/09/23 18:28:08
Strictly speaking we don't need all those values a
| |
180 | |
181 // Chrome-specific values start at 1000. | |
182 XYZ_D50 = 1000, | |
183 // TODO(hubbe): We need to store the primaries. | |
184 CUSTOM = 1001, | |
185 LAST = CUSTOM | |
186 }; | |
187 | |
188 enum class TransferID : uint16_t { | |
189 // The first 0-255 values should match the H264 specification. | |
190 RESERVED0 = 0, | |
191 BT709 = 1, | |
192 UNSPECIFIED = 2, | |
193 RESERVED = 3, | |
194 GAMMA22 = 4, | |
195 GAMMA28 = 5, | |
196 SMPTE170M = 6, | |
197 SMPTE240M = 7, | |
198 LINEAR = 8, | |
199 LOG = 9, | |
200 LOG_SQRT = 10, | |
201 IEC61966_2_4 = 11, | |
202 BT1361_ECG = 12, | |
203 IEC61966_2_1 = 13, | |
204 BT2020_10 = 14, | |
205 BT2020_12 = 15, | |
206 SMPTEST2084 = 16, | |
207 SMPTEST428_1 = 17, | |
208 ARIB_STD_B67 = 18, // AKA hybrid-log gamma, HLG | |
209 | |
210 // Chrome-specific values start at 1000. | |
211 GAMMA24 = 1000, | |
212 | |
213 // This is an ad-hoc transfer function that decodes SMPTE 2084 content | |
214 // into a 0-1 range more or less suitable for viewing on a non-hdr | |
215 // display. | |
216 SMPTEST2084_NON_HDR, | |
217 | |
218 // TODO(hubbe): Need to store an approximation of the gamma function(s). | |
219 CUSTOM, | |
220 LAST = CUSTOM, | |
221 }; | |
222 | |
223 enum class MatrixID : int16_t { | |
224 // The first 0-255 values should match the H264 specification. | |
225 RGB = 0, | |
226 BT709 = 1, | |
227 UNSPECIFIED = 2, | |
228 RESERVED = 3, | |
229 FCC = 4, | |
230 BT470BG = 5, | |
231 SMPTE170M = 6, | |
232 SMPTE240M = 7, | |
233 YCOCG = 8, | |
234 BT2020_NCL = 9, | |
235 BT2020_CL = 10, | |
236 YDZDX = 11, | |
237 | |
238 // Chrome-specific values start at 1000 | |
239 LAST = YDZDX, | |
240 }; | |
241 | |
242 // This corresponds to the WebM Range enum which is part of WebM color data | |
243 // (see http://www.webmproject.org/docs/container/#Range). | |
244 // H.264 only uses a bool, which corresponds to the LIMITED/FULL values. | |
245 // Chrome-specific values start at 1000. | |
246 enum class RangeID : int8_t { | |
247 // Range is not explicitly specified / unknown. | |
248 UNSPECIFIED = 0, | |
249 | |
250 // Limited Rec. 709 color range with RGB values ranging from 16 to 235. | |
251 LIMITED = 1, | |
252 | |
253 // Full RGB color range with RGB valees from 0 to 255. | |
254 FULL = 2, | |
255 | |
256 // Range is defined by TransferID/MatrixID. | |
257 DERIVED = 3, | |
258 | |
259 LAST = DERIVED | |
260 }; | |
261 // ---- End copy/pasted from ui/gfx/color_space.h ---- | |
262 | |
263 // ---- Begin copy/paste from media/base/hdr_metadata.h ---- | |
264 // SMPTE ST 2086 mastering metadata. | |
265 struct MasteringMetadata { | |
266 float primary_r_chromaticity_x = 0; | |
267 float primary_r_chromaticity_y = 0; | |
268 float primary_g_chromaticity_x = 0; | |
269 float primary_g_chromaticity_y = 0; | |
270 float primary_b_chromaticity_x = 0; | |
271 float primary_b_chromaticity_y = 0; | |
272 float white_point_chromaticity_x = 0; | |
273 float white_point_chromaticity_y = 0; | |
274 float luminance_max = 0; | |
275 float luminance_min = 0; | |
276 | |
277 MasteringMetadata(); | |
278 MasteringMetadata(const MasteringMetadata& rhs); | |
279 }; | |
280 | |
281 // HDR metadata common for HDR10 and WebM/VP9-based HDR formats. | |
282 struct HDRMetadata { | |
283 MasteringMetadata mastering_metadata; | |
284 unsigned max_cll = 0; | |
285 unsigned max_fall = 0; | |
286 | |
287 HDRMetadata(); | |
288 HDRMetadata(const HDRMetadata& rhs); | |
289 }; | |
290 // ---- End copy/paste from media/base/hdr_metadata.h ---- | |
164 | 291 |
165 // TODO(erickung): Remove constructor once CMA backend implementation doesn't | 292 // TODO(erickung): Remove constructor once CMA backend implementation doesn't |
166 // create a new object to reset the configuration and use IsValidConfig() to | 293 // create a new object to reset the configuration and use IsValidConfig() to |
167 // determine if the configuration is still valid or not. | 294 // determine if the configuration is still valid or not. |
168 struct AudioConfig { | 295 struct AudioConfig { |
169 AudioConfig(); | 296 AudioConfig(); |
170 AudioConfig(const AudioConfig& other); | 297 AudioConfig(const AudioConfig& other); |
171 ~AudioConfig(); | 298 ~AudioConfig(); |
172 | 299 |
173 bool is_encrypted() const { return encryption_scheme.is_encrypted(); } | 300 bool is_encrypted() const { return encryption_scheme.is_encrypted(); } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 // Video codec profile. | 346 // Video codec profile. |
220 VideoProfile profile; | 347 VideoProfile profile; |
221 // Additional video config for the video stream if available. Consumers of | 348 // Additional video config for the video stream if available. Consumers of |
222 // this structure should make an explicit copy of |additional_config| if it | 349 // this structure should make an explicit copy of |additional_config| if it |
223 // will be used after SetConfig() finishes. | 350 // will be used after SetConfig() finishes. |
224 VideoConfig* additional_config; | 351 VideoConfig* additional_config; |
225 // Extra data buffer for certain codec initialization. | 352 // Extra data buffer for certain codec initialization. |
226 std::vector<uint8_t> extra_data; | 353 std::vector<uint8_t> extra_data; |
227 // Encryption scheme (if any) used for the content. | 354 // Encryption scheme (if any) used for the content. |
228 EncryptionScheme encryption_scheme; | 355 EncryptionScheme encryption_scheme; |
356 | |
357 // ColorSpace info | |
358 PrimaryID primaries = PrimaryID::UNSPECIFIED; | |
359 TransferID transfer = TransferID::UNSPECIFIED; | |
360 MatrixID matrix = MatrixID::UNSPECIFIED; | |
361 RangeID range = RangeID::UNSPECIFIED; | |
362 | |
363 bool have_hdr_metadata = false; | |
364 HDRMetadata hdr_metadata; | |
229 }; | 365 }; |
230 | 366 |
231 inline VideoConfig::VideoConfig() | 367 inline VideoConfig::VideoConfig() |
232 : id(kPrimary), | 368 : id(kPrimary), |
233 codec(kVideoCodecUnknown), | 369 codec(kVideoCodecUnknown), |
234 profile(kVideoProfileUnknown), | 370 profile(kVideoProfileUnknown), |
235 additional_config(nullptr) { | 371 additional_config(nullptr) { |
236 } | 372 } |
237 | 373 |
238 inline VideoConfig::VideoConfig(const VideoConfig& other) = default; | 374 inline VideoConfig::VideoConfig(const VideoConfig& other) = default; |
(...skipping 21 matching lines...) Expand all Loading... | |
260 inline bool IsValidConfig(const VideoConfig& config) { | 396 inline bool IsValidConfig(const VideoConfig& config) { |
261 return config.codec >= kVideoCodecMin && | 397 return config.codec >= kVideoCodecMin && |
262 config.codec <= kVideoCodecMax && | 398 config.codec <= kVideoCodecMax && |
263 config.codec != kVideoCodecUnknown; | 399 config.codec != kVideoCodecUnknown; |
264 } | 400 } |
265 | 401 |
266 } // namespace media | 402 } // namespace media |
267 } // namespace chromecast | 403 } // namespace chromecast |
268 | 404 |
269 #endif // CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ | 405 #endif // CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ |
OLD | NEW |