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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 inline EncryptionScheme Unencrypted() { | 161 inline EncryptionScheme Unencrypted() { |
162 return EncryptionScheme(); | 162 return EncryptionScheme(); |
163 } | 163 } |
164 | 164 |
165 inline EncryptionScheme AesCtrEncryptionScheme() { | 165 inline EncryptionScheme AesCtrEncryptionScheme() { |
166 return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR, | 166 return EncryptionScheme(EncryptionScheme::CIPHER_MODE_AES_CTR, |
167 EncryptionScheme::Pattern()); | 167 EncryptionScheme::Pattern()); |
168 } | 168 } |
169 | 169 |
170 // ---- Begin copy/paste from ui/gfx/color_space.h ---- | |
171 enum class PrimaryID : uint16_t { | |
172 // The first 0-255 values should match the H264 specification. | |
173 RESERVED0 = 0, | |
174 BT709 = 1, | |
175 UNSPECIFIED = 2, | |
176 RESERVED = 3, | |
177 BT470M = 4, | |
178 BT470BG = 5, | |
179 SMPTE170M = 6, | |
180 SMPTE240M = 7, | |
181 FILM = 8, | |
182 BT2020 = 9, | |
183 SMPTEST428_1 = 10, | |
184 SMPTEST431_2 = 11, | |
185 SMPTEST432_1 = 12, | |
186 | |
187 // Chrome-specific values start at 1000. | |
188 XYZ_D50 = 1000, | |
189 // TODO(hubbe): We need to store the primaries. | |
190 CUSTOM = 1001, | |
191 LAST = CUSTOM | |
192 }; | |
193 | |
194 enum class TransferID : uint16_t { | |
195 // The first 0-255 values should match the H264 specification. | |
196 RESERVED0 = 0, | |
197 BT709 = 1, | |
198 UNSPECIFIED = 2, | |
199 RESERVED = 3, | |
200 GAMMA22 = 4, | |
201 GAMMA28 = 5, | |
202 SMPTE170M = 6, | |
203 SMPTE240M = 7, | |
204 LINEAR = 8, | |
205 LOG = 9, | |
206 LOG_SQRT = 10, | |
207 IEC61966_2_4 = 11, | |
208 BT1361_ECG = 12, | |
209 IEC61966_2_1 = 13, | |
210 BT2020_10 = 14, | |
211 BT2020_12 = 15, | |
212 SMPTEST2084 = 16, | |
213 SMPTEST428_1 = 17, | |
214 ARIB_STD_B67 = 18, // AKA hybrid-log gamma, HLG | |
215 | |
216 // Chrome-specific values start at 1000. | |
217 GAMMA24 = 1000, | |
218 | |
219 // This is an ad-hoc transfer function that decodes SMPTE 2084 content | |
220 // into a 0-1 range more or less suitable for viewing on a non-hdr | |
221 // display. | |
222 SMPTEST2084_NON_HDR, | |
223 | |
224 // TODO(hubbe): Need to store an approximation of the gamma function(s). | |
225 CUSTOM, | |
226 LAST = CUSTOM, | |
227 }; | |
228 | |
229 enum class MatrixID : int16_t { | |
230 // The first 0-255 values should match the H264 specification. | |
231 RGB = 0, | |
232 BT709 = 1, | |
233 UNSPECIFIED = 2, | |
234 RESERVED = 3, | |
235 FCC = 4, | |
236 BT470BG = 5, | |
237 SMPTE170M = 6, | |
238 SMPTE240M = 7, | |
239 YCOCG = 8, | |
240 BT2020_NCL = 9, | |
241 BT2020_CL = 10, | |
242 YDZDX = 11, | |
243 | |
244 // Chrome-specific values start at 1000 | |
245 LAST = YDZDX, | |
246 }; | |
247 | |
248 // This corresponds to the WebM Range enum which is part of WebM color data | |
249 // (see http://www.webmproject.org/docs/container/#Range). | |
250 // H.264 only uses a bool, which corresponds to the LIMITED/FULL values. | |
251 // Chrome-specific values start at 1000. | |
252 enum class RangeID : int8_t { | |
253 // Range is not explicitly specified / unknown. | |
254 UNSPECIFIED = 0, | |
255 | |
256 // Limited Rec. 709 color range with RGB values ranging from 16 to 235. | |
257 LIMITED = 1, | |
258 | |
259 // Full RGB color range with RGB valees from 0 to 255. | |
260 FULL = 2, | |
261 | |
262 // Range is defined by TransferID/MatrixID. | |
263 DERIVED = 3, | |
264 | |
265 LAST = DERIVED | |
266 }; | |
267 // ---- End copy/pasted from ui/gfx/color_space.h ---- | |
268 | |
269 // ---- Begin copy/paste from media/base/hdr_metadata.h ---- | 170 // ---- Begin copy/paste from media/base/hdr_metadata.h ---- |
270 // SMPTE ST 2086 mastering metadata. | 171 // SMPTE ST 2086 mastering metadata. |
271 struct MasteringMetadata { | 172 struct MasteringMetadata { |
272 float primary_r_chromaticity_x = 0; | 173 float primary_r_chromaticity_x = 0; |
273 float primary_r_chromaticity_y = 0; | 174 float primary_r_chromaticity_y = 0; |
274 float primary_g_chromaticity_x = 0; | 175 float primary_g_chromaticity_x = 0; |
275 float primary_g_chromaticity_y = 0; | 176 float primary_g_chromaticity_y = 0; |
276 float primary_b_chromaticity_x = 0; | 177 float primary_b_chromaticity_x = 0; |
277 float primary_b_chromaticity_y = 0; | 178 float primary_b_chromaticity_y = 0; |
278 float white_point_chromaticity_x = 0; | 179 float white_point_chromaticity_x = 0; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 VideoProfile profile; | 261 VideoProfile profile; |
361 // Additional video config for the video stream if available. Consumers of | 262 // Additional video config for the video stream if available. Consumers of |
362 // this structure should make an explicit copy of |additional_config| if it | 263 // this structure should make an explicit copy of |additional_config| if it |
363 // will be used after SetConfig() finishes. | 264 // will be used after SetConfig() finishes. |
364 VideoConfig* additional_config; | 265 VideoConfig* additional_config; |
365 // Extra data buffer for certain codec initialization. | 266 // Extra data buffer for certain codec initialization. |
366 std::vector<uint8_t> extra_data; | 267 std::vector<uint8_t> extra_data; |
367 // Encryption scheme (if any) used for the content. | 268 // Encryption scheme (if any) used for the content. |
368 EncryptionScheme encryption_scheme; | 269 EncryptionScheme encryption_scheme; |
369 | 270 |
370 // ColorSpace info | 271 // TODO(ccameron) add color space info |
371 PrimaryID primaries = PrimaryID::UNSPECIFIED; | |
372 TransferID transfer = TransferID::UNSPECIFIED; | |
373 MatrixID matrix = MatrixID::UNSPECIFIED; | |
374 RangeID range = RangeID::UNSPECIFIED; | |
375 | 272 |
376 bool have_hdr_metadata = false; | 273 bool have_hdr_metadata = false; |
377 HDRMetadata hdr_metadata; | 274 HDRMetadata hdr_metadata; |
378 }; | 275 }; |
379 | 276 |
380 inline VideoConfig::VideoConfig() | 277 inline VideoConfig::VideoConfig() |
381 : id(kPrimary), | 278 : id(kPrimary), |
382 codec(kVideoCodecUnknown), | 279 codec(kVideoCodecUnknown), |
383 profile(kVideoProfileUnknown), | 280 profile(kVideoProfileUnknown), |
384 additional_config(nullptr) { | 281 additional_config(nullptr) { |
(...skipping 24 matching lines...) Expand all Loading... |
409 inline bool IsValidConfig(const VideoConfig& config) { | 306 inline bool IsValidConfig(const VideoConfig& config) { |
410 return config.codec >= kVideoCodecMin && | 307 return config.codec >= kVideoCodecMin && |
411 config.codec <= kVideoCodecMax && | 308 config.codec <= kVideoCodecMax && |
412 config.codec != kVideoCodecUnknown; | 309 config.codec != kVideoCodecUnknown; |
413 } | 310 } |
414 | 311 |
415 } // namespace media | 312 } // namespace media |
416 } // namespace chromecast | 313 } // namespace chromecast |
417 | 314 |
418 #endif // CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ | 315 #endif // CHROMECAST_PUBLIC_MEDIA_DECODER_CONFIG_H_ |
OLD | NEW |