1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520
//! Enums exposed in the API.
/// The Matrix Coefficients of the video used to derive luma and chroma values
/// from red, green, and blue color primaries.
///
/// For clarity, the value and meanings for `MatrixCoefficients` are adopted from
/// Table 4 of ISO/IEC 23001-8:2016 or ITU-T H.273.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum MatrixCoefficients {
/// Unknown,
Unknown,
/// Identity.
Identity,
/// ITU-R BT.709.
Bt709,
/// US FCC 73.682.
Fcc73682,
/// ITU-R BT.470BG.
Bt470bg,
/// SMPTE 170M.
Smpte170,
/// SMPTE 240M.
Smpte240,
/// YCoCg.
YCoCg,
/// BT2020 Non-constant Luminance.
Bt2020Ncl,
/// BT2020 Constant Luminance.
Bt2020Cl,
/// SMPTE ST 2085.
SmpteSt2085,
/// Chroma-derived Non-constant Luminance.
ChromaDerivedNcl,
/// Chroma-derived Constant Luminance.
ChromaDerivedCl,
/// ITU-R BT.2100-0.
Bt2100,
}
impl From<u64> for MatrixCoefficients {
fn from(d: u64) -> Self {
match d {
0 => MatrixCoefficients::Identity,
1 => MatrixCoefficients::Bt709,
4 => MatrixCoefficients::Fcc73682,
5 => MatrixCoefficients::Bt470bg,
6 => MatrixCoefficients::Smpte170,
7 => MatrixCoefficients::Smpte240,
8 => MatrixCoefficients::YCoCg,
9 => MatrixCoefficients::Bt2020Ncl,
10 => MatrixCoefficients::Bt2020Cl,
11 => MatrixCoefficients::SmpteSt2085,
12 => MatrixCoefficients::ChromaDerivedNcl,
13 => MatrixCoefficients::ChromaDerivedCl,
14 => MatrixCoefficients::Bt2100,
_ => MatrixCoefficients::Unknown,
}
}
}
/// How `DisplayWidth` & `DisplayHeight` are interpreted.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum DisplayUnit {
/// In pixels.
Pixels,
/// In centimeters.
Centimeters,
/// In inches.
Inches,
/// By using the aspect ratio.
DisplayAspectRatio,
/// Unknown.
Unknown,
}
impl From<u64> for DisplayUnit {
fn from(d: u64) -> Self {
match d {
0 => DisplayUnit::Pixels,
1 => DisplayUnit::Centimeters,
2 => DisplayUnit::Inches,
3 => DisplayUnit::DisplayAspectRatio,
_ => DisplayUnit::Unknown,
}
}
}
/// Specify the possible modifications to the aspect ratio.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum AspectRatioType {
/// Unknown.
Unknown,
/// Allow free resizing.
FreeResizing,
/// Keep the aspect ratio.
KeepAspectRatio,
/// Fixed size.
Fixed,
}
impl From<u64> for AspectRatioType {
fn from(d: u64) -> Self {
match d {
0 => AspectRatioType::FreeResizing,
1 => AspectRatioType::KeepAspectRatio,
2 => AspectRatioType::Fixed,
_ => AspectRatioType::Unknown,
}
}
}
/// Type of the track.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum TrackType {
/// Unknown.
Unknown,
/// Video track.
Video,
/// Audio track.
Audio,
/// A complex track.
Complex,
/// A logo.
Logo,
/// Subtitles.
Subtitle,
/// Buttons.
Buttons,
/// Controls.
Control,
/// Metadata.
Metadata,
}
impl From<u64> for TrackType {
fn from(d: u64) -> Self {
match d {
1 => TrackType::Video,
2 => TrackType::Audio,
3 => TrackType::Complex,
16 => TrackType::Logo,
17 => TrackType::Subtitle,
18 => TrackType::Buttons,
32 => TrackType::Control,
33 => TrackType::Metadata,
_ => TrackType::Unknown,
}
}
}
/// A flag to declare if the video is known to be progressive or interlaced.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum FlagInterlaced {
/// Unknown.
Unknown,
/// Interlaced.
Interlaced,
/// Progressive.
Progressive,
}
impl From<u64> for FlagInterlaced {
fn from(d: u64) -> Self {
match d {
1 => FlagInterlaced::Interlaced,
2 => FlagInterlaced::Progressive,
_ => FlagInterlaced::Unknown,
}
}
}
/// Declare the field ordering of the video.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum FieldOrder {
/// Unknown.
Unknown,
/// Progressive.
Progressive,
/// Top Field First.
Tff,
/// Bottom Field First.
Bff,
/// Top Field First (swapped).
BffSwapped,
/// Bottom Field First (swapped).
TffSwapped,
}
impl From<u64> for FieldOrder {
fn from(d: u64) -> Self {
match d {
0 => FieldOrder::Progressive,
1 => FieldOrder::Tff,
6 => FieldOrder::Bff,
9 => FieldOrder::BffSwapped,
14 => FieldOrder::TffSwapped,
_ => FieldOrder::Unknown,
}
}
}
/// Stereo-3D video mode.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum StereoMode {
/// Unknown.
Unknown,
/// Mono.
Mono,
/// Side by side (left eye first).
SideBySideLeftEyeFirst,
/// Top - bottom (right eye is first).
TopBottomRightEyeFirst,
/// Top - bottom (left eye is first).
TopBottomLeftEyeFirst,
/// Checkboard (right eye is first).
CheckboardRightEyeFirst,
/// Checkboard (left eye is first).
CheckboardLeftEyeFirst,
/// Row interleaved (right eye is first).
RowInterleavedRightEyeFirst,
/// Row interleaved (left eye is first).
RowInterleavedLeftEyeFirst,
/// Column interleaved (right eye is first).
ColumnInterleavedRightEyeFirst,
/// Column interleaved (left eye is first).
ColumnInterleavedLeftEyeFirst,
/// Anaglyph (cyan/red).
AnaglyphCyanRed,
/// Side by side (right eye first).
SideBySideRightEyeFirst,
/// Anaglyph (green/magenta).
AnaglyphGreenMagenta,
/// Both eyes laced in one Block (left eye is first).
LacedLeftEyeFirst,
/// Both eyes laced in one Block (right eye is first).
LacedRightEyeFirst,
}
impl From<u64> for StereoMode {
fn from(d: u64) -> Self {
match d {
0 => StereoMode::Mono,
1 => StereoMode::SideBySideLeftEyeFirst,
2 => StereoMode::TopBottomRightEyeFirst,
3 => StereoMode::TopBottomLeftEyeFirst,
4 => StereoMode::CheckboardRightEyeFirst,
5 => StereoMode::CheckboardLeftEyeFirst,
6 => StereoMode::RowInterleavedRightEyeFirst,
7 => StereoMode::RowInterleavedLeftEyeFirst,
8 => StereoMode::ColumnInterleavedRightEyeFirst,
9 => StereoMode::ColumnInterleavedLeftEyeFirst,
10 => StereoMode::AnaglyphCyanRed,
11 => StereoMode::SideBySideRightEyeFirst,
12 => StereoMode::AnaglyphGreenMagenta,
13 => StereoMode::LacedLeftEyeFirst,
14 => StereoMode::LacedRightEyeFirst,
_ => StereoMode::Unknown,
}
}
}
/// How chroma is sub sampled horizontally.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ChromaSitingHorz {
/// Unknown.
Unknown,
/// Left collocated.
LeftCollated,
/// Half.
Half,
}
impl From<u64> for ChromaSitingHorz {
fn from(d: u64) -> Self {
match d {
1 => ChromaSitingHorz::LeftCollated,
2 => ChromaSitingHorz::Half,
_ => ChromaSitingHorz::Unknown,
}
}
}
/// How chroma is sub sampled vertically.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ChromaSitingVert {
/// Unknown.
Unknown,
/// Left collocated.
LeftCollated,
/// Half.
Half,
}
impl From<u64> for ChromaSitingVert {
fn from(d: u64) -> Self {
match d {
1 => ChromaSitingVert::LeftCollated,
2 => ChromaSitingVert::Half,
_ => ChromaSitingVert::Unknown,
}
}
}
/// Clipping of the color ranges.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Range {
/// Unknown.
Unknown,
/// Broadcast range.
Broadcast,
/// Full range (no clipping).
Full,
/// Defined by MatrixCoefficients / TransferCharacteristics.
Defined,
}
impl From<u64> for Range {
fn from(d: u64) -> Self {
match d {
1 => Range::Broadcast,
2 => Range::Full,
3 => Range::Defined,
_ => Range::Unknown,
}
}
}
/// The transfer characteristics of the video.
///
/// For clarity, the value and meanings for `TransferCharacteristics` are adopted
/// from Table 3 of ISO/IEC 23091-4 or ITU-T H.273.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum TransferCharacteristics {
/// Unknown.
Unknown,
/// ITU-R BT.709.
Bt709,
/// Gamma 2.2 curve - BT.470M.
Bt407m,
/// Gamma 2.8 curve - BT.470BG.
Bt407bg,
/// SMPTE 170M.
Smpte170,
/// SMPTE 240M.
Smpte240,
/// Linear.
Linear,
/// Log.
Log,
/// Log Sqrt,
LogSqrt,
/// IEC 61966-2-4.
Iec61966_2_4,
/// ITU-R BT.1361 Extended Colour Gamut.
Bt1361,
/// IEC 61966-2-1.
Iec61966_2_1,
/// ITU-R BT.2020 10 bit.
Bt220_10,
/// ITU-R BT.2020 12 bit.
Bt220_12,
/// ITU-R BT.2100 Perceptual Quantization.
Bt2100,
/// SMPTE ST 428-1.
SmpteSt428_1,
/// ARIB STD-B67 (HLG).
Hlg,
}
impl From<u64> for TransferCharacteristics {
fn from(d: u64) -> Self {
match d {
1 => TransferCharacteristics::Bt709,
4 => TransferCharacteristics::Bt407m,
5 => TransferCharacteristics::Bt407bg,
6 => TransferCharacteristics::Smpte170,
7 => TransferCharacteristics::Smpte240,
8 => TransferCharacteristics::Linear,
9 => TransferCharacteristics::Log,
10 => TransferCharacteristics::LogSqrt,
11 => TransferCharacteristics::Iec61966_2_4,
12 => TransferCharacteristics::Bt1361,
13 => TransferCharacteristics::Iec61966_2_1,
14 => TransferCharacteristics::Bt220_10,
15 => TransferCharacteristics::Bt220_12,
16 => TransferCharacteristics::Bt2100,
17 => TransferCharacteristics::SmpteSt428_1,
18 => TransferCharacteristics::Hlg,
_ => TransferCharacteristics::Unknown,
}
}
}
/// The colour primaries of the video.
///
/// For clarity, the value and meanings for `Primaries` are adopted
/// from Table 2 of ISO/IEC 23091-4 or ITU-T H.273.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Primaries {
/// Unknown.
Unknown,
/// ITU-R BT.709.
Bt709,
/// ITU-R BT.470M.
Bt470m,
/// ITU-R BT.470BG - BT.601 625.
Bt601,
/// ITU-R BT.601 525 - SMPTE 170M.
Smpte170,
/// SMPTE 240M.
Smpte240,
/// FILM.
Film,
/// ITU-R BT.2020.
Bt2020,
/// SMPTE ST 428-1.
SmpteSt428_1,
/// SMPTE RP 432-2.
SmpteRp432_2,
/// SMPTE EG 432-2.
SmpteEg432_2,
/// EBU Tech. 3213-E - JEDEC P22 phosphors.
JedecP22,
}
impl From<u64> for Primaries {
fn from(d: u64) -> Self {
match d {
1 => Primaries::Bt709,
4 => Primaries::Bt470m,
5 => Primaries::Bt601,
6 => Primaries::Smpte170,
7 => Primaries::Smpte240,
8 => Primaries::Film,
9 => Primaries::Bt2020,
10 => Primaries::SmpteSt428_1,
11 => Primaries::SmpteRp432_2,
12 => Primaries::SmpteEg432_2,
22 => Primaries::JedecP22,
_ => Primaries::Unknown,
}
}
}
/// Describing what kind of transformation is applied.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ContentEncodingType {
/// Unknown.
Unknown,
/// Transformation is a compression.
Compression,
/// Transformation is a encryption.
Encryption,
}
impl From<u64> for ContentEncodingType {
fn from(d: u64) -> Self {
match d {
0 => ContentEncodingType::Compression,
1 => ContentEncodingType::Encryption,
_ => ContentEncodingType::Unknown,
}
}
}
/// The encryption algorithm used.
///
/// `NotEncrypted` means that the contents have not been encrypted but only signed.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ContentEncAlgo {
/// Unknown.
Unknown,
/// Not encrypted.
NotEncrypted,
/// DES - FIPS 46-3.
Des,
/// Triple DES - RFC 1851.
TripleDes,
/// Twofish.
Twofish,
/// Blowfish.
Blowfish,
/// AES - FIPS 187.
Aes,
}
impl From<u64> for ContentEncAlgo {
fn from(d: u64) -> Self {
match d {
0 => ContentEncAlgo::NotEncrypted,
1 => ContentEncAlgo::Des,
2 => ContentEncAlgo::TripleDes,
3 => ContentEncAlgo::Twofish,
4 => ContentEncAlgo::Blowfish,
5 => ContentEncAlgo::Aes,
_ => ContentEncAlgo::Unknown,
}
}
}
/// The AES cipher mode used in the encryption.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum AesSettingsCipherMode {
/// Unknown.
Unknown,
/// AES-CTR / Counter, NIST SP 800-38A.
Ctr,
/// AES-CBC / Cipher Block Chaining, NIST SP 800-38A.
Cbc,
}
impl From<u64> for AesSettingsCipherMode {
fn from(d: u64) -> Self {
match d {
0 => AesSettingsCipherMode::Ctr,
1 => AesSettingsCipherMode::Cbc,
_ => AesSettingsCipherMode::Unknown,
}
}
}