1 #ifndef DI_CTA_H 2 #define DI_CTA_H 3 4 /** 5 * libdisplay-info's low-level API for Consumer Technology Association 6 * standards. 7 * 8 * The library implements CTA-861-H, available at: 9 * https://shop.cta.tech/collections/standards/products/a-dtv-profile-for-uncompressed-high-speed-digital-interfaces-cta-861-h 10 */ 11 12 #include <stdbool.h> 13 #include <stdint.h> 14 #include <stddef.h> 15 16 /** 17 * CTA video format picture aspect ratio. 18 */ 19 enum di_cta_video_format_picture_aspect_ratio { 20 DI_CTA_VIDEO_FORMAT_PICTURE_ASPECT_RATIO_4_3, /* 4:3 */ 21 DI_CTA_VIDEO_FORMAT_PICTURE_ASPECT_RATIO_16_9, /* 16:9 */ 22 DI_CTA_VIDEO_FORMAT_PICTURE_ASPECT_RATIO_64_27, /* 64:27 */ 23 DI_CTA_VIDEO_FORMAT_PICTURE_ASPECT_RATIO_256_135, /* 256:135 */ 24 }; 25 26 /** 27 * CTA video format sync pulse polarity. 28 */ 29 enum di_cta_video_format_sync_polarity { 30 DI_CTA_VIDEO_FORMAT_SYNC_NEGATIVE, /* Negative */ 31 DI_CTA_VIDEO_FORMAT_SYNC_POSITIVE, /* Positive */ 32 }; 33 34 /** 35 * A CTA-861 video format, defined in section 4. 36 */ 37 struct di_cta_video_format { 38 /* Video Identification Code (VIC) */ 39 uint8_t vic; 40 /* Horizontal/vertical active pixels/lines */ 41 int32_t h_active, v_active; 42 /* Horizontal/vertical front porch */ 43 int32_t h_front, v_front; 44 /* Horizontal/vertical sync pulse */ 45 int32_t h_sync, v_sync; 46 /* Horizontal/vertical back porch */ 47 int32_t h_back, v_back; 48 /* Horizontal/vertical sync pulse polarity */ 49 enum di_cta_video_format_sync_polarity h_sync_polarity, v_sync_polarity; 50 /* Pixel clock in Hz */ 51 int64_t pixel_clock_hz; 52 /* Whether this timing is interlaced */ 53 bool interlaced; 54 /* Picture aspect ratio */ 55 enum di_cta_video_format_picture_aspect_ratio picture_aspect_ratio; 56 }; 57 58 /** 59 * Get a CTA-861 video format from a VIC. 60 * 61 * Returns NULL if the VIC is unknown. 62 */ 63 const struct di_cta_video_format * 64 di_cta_video_format_from_vic(uint8_t vic); 65 66 /** 67 * EDID CTA-861 extension block. 68 */ 69 struct di_edid_cta; 70 71 /** 72 * Get the CTA extension revision (also referred to as "version" by the 73 * specification). 74 */ 75 int 76 di_edid_cta_get_revision(const struct di_edid_cta *cta); 77 78 /** 79 * Miscellaneous EDID CTA flags, defined in section 7.3.3. 80 * 81 * For CTA revision 1, all of the fields are zero. 82 */ 83 struct di_edid_cta_flags { 84 /* Sink underscans IT Video Formats by default */ 85 bool it_underscan; 86 /* Sink supports Basic Audio */ 87 bool basic_audio; 88 /* Sink supports YCbCr 4:4:4 in addition to RGB */ 89 bool ycc444; 90 /* Sink supports YCbCr 4:2:2 in addition to RGB */ 91 bool ycc422; 92 /* Total number of native detailed timing descriptors */ 93 int native_dtds; 94 }; 95 96 /** 97 * Get miscellaneous CTA flags. 98 */ 99 const struct di_edid_cta_flags * 100 di_edid_cta_get_flags(const struct di_edid_cta *cta); 101 102 /** 103 * CTA data block, defined in section 7.4. 104 */ 105 struct di_cta_data_block; 106 107 /** 108 * Get CTA data blocks. 109 * 110 * The returned array is NULL-terminated. 111 */ 112 const struct di_cta_data_block *const * 113 di_edid_cta_get_data_blocks(const struct di_edid_cta *cta); 114 115 /** 116 * CTA data block tag. 117 * 118 * Note, the enum values don't match the specification. 119 */ 120 enum di_cta_data_block_tag { 121 /* Audio Data Block */ 122 DI_CTA_DATA_BLOCK_AUDIO = 1, 123 /* Video Data Block */ 124 DI_CTA_DATA_BLOCK_VIDEO, 125 /* Speaker Allocation Data Block */ 126 DI_CTA_DATA_BLOCK_SPEAKER_ALLOC, 127 /* VESA Display Transfer Characteristic Data Block */ 128 DI_CTA_DATA_BLOCK_VESA_DISPLAY_TRANSFER_CHARACTERISTIC, 129 /* Video Format Data Block */ 130 DI_CTA_DATA_BLOCK_VIDEO_FORMAT, 131 132 /* Video Capability Data Block */ 133 DI_CTA_DATA_BLOCK_VIDEO_CAP, 134 /* VESA Display Device Data Block */ 135 DI_CTA_DATA_BLOCK_VESA_DISPLAY_DEVICE, 136 /* Colorimetry Data Block */ 137 DI_CTA_DATA_BLOCK_COLORIMETRY, 138 /* HDR Static Metadata Data Block */ 139 DI_CTA_DATA_BLOCK_HDR_STATIC_METADATA, 140 /* HDR Dynamic Metadata Data Block */ 141 DI_CTA_DATA_BLOCK_HDR_DYNAMIC_METADATA, 142 /* Native Video Resolution Data Block */ 143 DI_CTA_DATA_BLOCK_NATIVE_VIDEO_RESOLUTION, 144 /* Video Format Preference Data Block */ 145 DI_CTA_DATA_BLOCK_VIDEO_FORMAT_PREF, 146 /* YCbCr 4:2:0 Video Data Block */ 147 DI_CTA_DATA_BLOCK_YCBCR420, 148 /* YCbCr 4:2:0 Capability Map Data Block */ 149 DI_CTA_DATA_BLOCK_YCBCR420_CAP_MAP, 150 /* HDMI Audio Data Block */ 151 DI_CTA_DATA_BLOCK_HDMI_AUDIO, 152 /* Room Configuration Data Block */ 153 DI_CTA_DATA_BLOCK_ROOM_CONFIG, 154 /* Speaker Location Data Block */ 155 DI_CTA_DATA_BLOCK_SPEAKER_LOCATION, 156 /* InfoFrame Data Block */ 157 DI_CTA_DATA_BLOCK_INFOFRAME, 158 /* DisplayID Type VII Video Timing Data Block */ 159 DI_CTA_DATA_BLOCK_DISPLAYID_VIDEO_TIMING_VII, 160 /* DisplayID Type VIII Video Timing Data Block */ 161 DI_CTA_DATA_BLOCK_DISPLAYID_VIDEO_TIMING_VIII, 162 /* DisplayID Type X Video Timing Data Block */ 163 DI_CTA_DATA_BLOCK_DISPLAYID_VIDEO_TIMING_X, 164 /* HDMI Forum EDID Extension Override Data Block */ 165 DI_CTA_DATA_BLOCK_HDMI_EDID_EXT_OVERRIDE, 166 /* HDMI Forum Sink Capability Data Block */ 167 DI_CTA_DATA_BLOCK_HDMI_SINK_CAP, 168 }; 169 170 /** 171 * Get the tag of the CTA data block. 172 */ 173 enum di_cta_data_block_tag 174 di_cta_data_block_get_tag(const struct di_cta_data_block *block); 175 176 /** 177 * Audio formats, defined in tables 37 and 39. 178 * 179 * Note, the enum values don't match the specification. 180 */ 181 enum di_cta_audio_format { 182 /* L-PCM */ 183 DI_CTA_AUDIO_FORMAT_LPCM = 1, 184 /* AC-3 */ 185 DI_CTA_AUDIO_FORMAT_AC3, 186 /* MPEG-1 (layers 1 & 2) */ 187 DI_CTA_AUDIO_FORMAT_MPEG1, 188 /* MP3 */ 189 DI_CTA_AUDIO_FORMAT_MP3, 190 /* MPEG-2 */ 191 DI_CTA_AUDIO_FORMAT_MPEG2, 192 /* AAC LC */ 193 DI_CTA_AUDIO_FORMAT_AAC_LC, 194 /* DTS */ 195 DI_CTA_AUDIO_FORMAT_DTS, 196 /* ATRAC */ 197 DI_CTA_AUDIO_FORMAT_ATRAC, 198 /* One Bit Audio */ 199 DI_CTA_AUDIO_FORMAT_ONE_BIT_AUDIO, 200 /* Enhanced AC-3 */ 201 DI_CTA_AUDIO_FORMAT_ENHANCED_AC3, 202 /* DTS-HD and DTS-UHD */ 203 DI_CTA_AUDIO_FORMAT_DTS_HD, 204 /* MAT */ 205 DI_CTA_AUDIO_FORMAT_MAT, 206 /* DST */ 207 DI_CTA_AUDIO_FORMAT_DST, 208 /* WMA Pro */ 209 DI_CTA_AUDIO_FORMAT_WMA_PRO, 210 211 /* MPEG-4 HE AAC */ 212 DI_CTA_AUDIO_FORMAT_MPEG4_HE_AAC, 213 /* MPEG-4 HE AAC v2 */ 214 DI_CTA_AUDIO_FORMAT_MPEG4_HE_AAC_V2, 215 /* MPEG-4 AAC LC */ 216 DI_CTA_AUDIO_FORMAT_MPEG4_AAC_LC, 217 /* DRA */ 218 DI_CTA_AUDIO_FORMAT_DRA, 219 /* MPEG-4 HE AAC + MPEG Surround */ 220 DI_CTA_AUDIO_FORMAT_MPEG4_HE_AAC_MPEG_SURROUND, 221 /* MPEG-4 AAC LC + MPEG Surround */ 222 DI_CTA_AUDIO_FORMAT_MPEG4_AAC_LC_MPEG_SURROUND, 223 /* MPEG-H 3D Audio */ 224 DI_CTA_AUDIO_FORMAT_MPEGH_3D, 225 /* AC-4 */ 226 DI_CTA_AUDIO_FORMAT_AC4, 227 /* L-PCM 3D Audio */ 228 DI_CTA_AUDIO_FORMAT_LPCM_3D, 229 }; 230 231 struct di_cta_sad_sample_rates { 232 bool has_192_khz; /* 192 kHz */ 233 bool has_176_4_khz; /* 176.4 kHz */ 234 bool has_96_khz; /* 96 kHz */ 235 bool has_88_2_khz; /* 88.2 kHz */ 236 bool has_48_khz; /* 48 kHz */ 237 bool has_44_1_khz; /* 44.1 kHz */ 238 bool has_32_khz; /* 32 kHz */ 239 }; 240 241 enum di_cta_sad_mpegh_3d_level { 242 DI_CTA_SAD_MPEGH_3D_LEVEL_UNSPECIFIED = 0, 243 DI_CTA_SAD_MPEGH_3D_LEVEL_1 = 1, 244 DI_CTA_SAD_MPEGH_3D_LEVEL_2 = 2, 245 DI_CTA_SAD_MPEGH_3D_LEVEL_3 = 3, 246 DI_CTA_SAD_MPEGH_3D_LEVEL_4 = 4, 247 DI_CTA_SAD_MPEGH_3D_LEVEL_5 = 5, 248 }; 249 250 struct di_cta_sad_mpegh_3d { 251 /* Maximum supported MPEG-H 3D level, zero if unspecified */ 252 enum di_cta_sad_mpegh_3d_level level; 253 /* True if MPEG-H 3D Audio Low Complexity Profile is supported */ 254 bool low_complexity_profile; 255 /* True if MPEG-H 3D Audio Baseline Profile is supported */ 256 bool baseline_profile; 257 }; 258 259 struct di_cta_sad_mpeg_aac { 260 /* True if AAC audio frame lengths of 960 samples is supported */ 261 bool has_frame_length_960; 262 /* True if AAC audio frame lengths of 1024 samples is supported */ 263 bool has_frame_length_1024; 264 }; 265 266 enum di_cta_sad_mpeg_surround_signaling { 267 /* Only implicitly signaled MPEG Surround data supported */ 268 DI_CTA_SAD_MPEG_SURROUND_SIGNALING_IMPLICIT = 0, 269 /* Implicitly and explicitly signaled MPEG Surround data supported */ 270 DI_CTA_SAD_MPEG_SURROUND_SIGNALING_IMPLICIT_AND_EXPLICIT = 1, 271 }; 272 273 struct di_cta_sad_mpeg_surround { 274 /* MPEG Surround signaling */ 275 enum di_cta_sad_mpeg_surround_signaling signaling; 276 }; 277 278 struct di_cta_sad_mpeg_aac_le { 279 /* True if Rec. ITU-R BS.2051 System H 22.2 multichannel sound is supported */ 280 bool supports_multichannel_sound; 281 }; 282 283 struct di_cta_sad_lpcm { 284 bool has_sample_size_24_bits; /* 24 bits */ 285 bool has_sample_size_20_bits; /* 20 bits */ 286 bool has_sample_size_16_bits; /* 16 bits */ 287 }; 288 289 struct di_cta_sad_enhanced_ac3 { 290 bool supports_joint_object_coding; 291 bool supports_joint_object_coding_ACMOD28; 292 }; 293 294 struct di_cta_sad_mat { 295 bool supports_object_audio_and_channel_based; 296 bool requires_hash_calculation; 297 }; 298 299 struct di_cta_sad_wma_pro { 300 int profile; 301 }; 302 303 /** 304 * A CTA short audio descriptor (SAD), defined in section 7.5.2. 305 */ 306 struct di_cta_sad { 307 /* Format */ 308 enum di_cta_audio_format format; 309 /* Maximum number of channels, zero if unset */ 310 int32_t max_channels; 311 /* Supported sample rates */ 312 const struct di_cta_sad_sample_rates *supported_sample_rates; 313 /* Maximum bitrate (kb/s), zero if unset */ 314 int32_t max_bitrate_kbs; 315 /* Additional metadata for LPCM, NULL unless format is 316 * DI_CTA_AUDIO_FORMAT_LPCM or DI_CTA_AUDIO_FORMAT_LPCM_3D */ 317 const struct di_cta_sad_lpcm *lpcm; 318 /* Additional metadata for MPEG-H 3D Audio, NULL unless format is 319 * DI_CTA_AUDIO_FORMAT_MPEGH_3D */ 320 const struct di_cta_sad_mpegh_3d *mpegh_3d; 321 /* Additional metadata for MPEG4 AAC, NULL unless format is 322 * DI_CTA_AUDIO_FORMAT_MPEG4_HE_AAC or 323 * DI_CTA_AUDIO_FORMAT_MPEG4_HE_AAC_V2 or 324 * DI_CTA_AUDIO_FORMAT_MPEG4_AAC_LC or 325 * DI_CTA_AUDIO_FORMAT_MPEG4_HE_AAC_MPEG_SURROUND or 326 * DI_CTA_AUDIO_FORMAT_MPEG4_AAC_LC_MPEG_SURROUND */ 327 const struct di_cta_sad_mpeg_aac *mpeg_aac; 328 /* Additional metadata for MPEG4 Surround, NULL unless format is 329 * DI_CTA_AUDIO_FORMAT_MPEG4_HE_AAC_MPEG_SURROUND or 330 * DI_CTA_AUDIO_FORMAT_MPEG4_AAC_LC_MPEG_SURROUND */ 331 const struct di_cta_sad_mpeg_surround *mpeg_surround; 332 /* Additional metadata for MPEG4 AAC LC, NULL unless format is 333 * DI_CTA_AUDIO_FORMAT_MPEG4_AAC_LC */ 334 const struct di_cta_sad_mpeg_aac_le *mpeg_aac_le; 335 /* Additional metadata for Enhanced AC-3, NULL unless format is 336 * DI_CTA_AUDIO_FORMAT_ENHANCED_AC3 */ 337 const struct di_cta_sad_enhanced_ac3 *enhanced_ac3; 338 /* Additional metadata for Dolby MAT, NULL unless format is 339 * DI_CTA_AUDIO_FORMAT_MAT */ 340 const struct di_cta_sad_mat *mat; 341 /* Additional metadata for WMA Pro, NULL unless format is 342 * DI_CTA_AUDIO_FORMAT_WMA_PRO */ 343 const struct di_cta_sad_wma_pro *wma_pro; 344 }; 345 346 /** 347 * Get an array of short audio descriptors from a CTA data block. 348 * 349 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_AUDIO. 350 * 351 * The returned array is NULL-terminated. 352 */ 353 const struct di_cta_sad *const * 354 di_cta_data_block_get_sads(const struct di_cta_data_block *data_block); 355 356 /** 357 * Indicates which speakers are present. See figure 6 for the meaning of the 358 * fields. 359 */ 360 struct di_cta_speaker_allocation { 361 bool flw_frw; /* FLw/FRw - Front Left/Right Wide */ 362 bool flc_frc; /* FLc/FRc - Front Left/Right of Center */ 363 bool bc; /* BC - Back Center */ 364 bool bl_br; /* BL/BR - Back Left/Right */ 365 bool fc; /* FC - Front Center */ 366 bool lfe1; /* LFE1 - Low Frequency Effects 1 */ 367 bool fl_fr; /* FL/FR - Front Left/Right */ 368 bool tpsil_tpsir; /* TpSiL/TpSiR - Top Side Left/Right */ 369 bool sil_sir; /* SiL/SiR - Side Left/Right */ 370 bool tpbc; /* TpBC - Top Back Center */ 371 bool lfe2; /* LFE2 - Low Frequency Effects 2 */ 372 bool ls_rs; /* LS/RS - Left/Right Surround*/ 373 bool tpfc; /* TpFC - Top Front Center */ 374 bool tpc; /* TpC - Top Center*/ 375 bool tpfl_tpfr; /* TpFL/TpFR - Top Front Left/Right */ 376 bool btfl_btfr; /* BtFL/BtFR - Bottom Front Left/Right */ 377 bool btfc; /* BtFC - Bottom Front Center */ 378 bool tpbl_tpbr; /* TpBL/TpBR - Top Back Left/Right */ 379 }; 380 381 /** 382 * Speaker allocation data block (SADB), defined in section 7.5.3. 383 */ 384 struct di_cta_speaker_alloc_block { 385 /* Present speakers */ 386 struct di_cta_speaker_allocation speakers; 387 }; 388 389 /** 390 * Get the speaker allocation from a CTA data block. 391 * 392 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_SPEAKER_ALLOC. 393 */ 394 const struct di_cta_speaker_alloc_block * 395 di_cta_data_block_get_speaker_alloc(const struct di_cta_data_block *block); 396 397 /** 398 * Over- and underscan capability. 399 */ 400 enum di_cta_video_cap_over_underscan { 401 /* No data */ 402 DI_CTA_VIDEO_CAP_UNKNOWN_OVER_UNDERSCAN = 0x00, 403 /* Always overscanned */ 404 DI_CTA_VIDEO_CAP_ALWAYS_OVERSCAN = 0x01, 405 /* Always underscanned */ 406 DI_CTA_VIDEO_CAP_ALWAYS_UNDERSCAN = 0x02, 407 /* Supports both over- and underscan */ 408 DI_CTA_VIDEO_CAP_BOTH_OVER_UNDERSCAN = 0x03, 409 }; 410 411 /** 412 * Video capability data block (VCDB), defined in section 7.5.6. 413 */ 414 struct di_cta_video_cap_block { 415 /* If set to true, YCC quantization range is selectable (via AVI YQ). */ 416 bool selectable_ycc_quantization_range; 417 /* If set to true, RGB quantization range is selectable (via AVI Q). */ 418 bool selectable_rgb_quantization_range; 419 /* Overscan/underscan behavior for PT video formats (if set to unknown, 420 * use the IT/CE behavior) */ 421 enum di_cta_video_cap_over_underscan pt_over_underscan; 422 /* Overscan/underscan behavior for IT video formats */ 423 enum di_cta_video_cap_over_underscan it_over_underscan; 424 /* Overscan/underscan behavior for CE video formats */ 425 enum di_cta_video_cap_over_underscan ce_over_underscan; 426 }; 427 428 /** 429 * Get the video capabilities from a CTA data block. 430 * 431 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_VIDEO_CAP. 432 */ 433 const struct di_cta_video_cap_block * 434 di_cta_data_block_get_video_cap(const struct di_cta_data_block *block); 435 436 /** 437 * Interface types, defined in VESA DDDB section 2.3.1 and 2.3.2. 438 * 439 * Note, the enum values don't match the specification. 440 */ 441 enum di_cta_vesa_dddb_interface_type { 442 DI_CTA_VESA_DDDB_INTERFACE_VGA, /* 15HD/VGA */ 443 DI_CTA_VESA_DDDB_INTERFACE_NAVI_V, /* VESA NAVI-V */ 444 DI_CTA_VESA_DDDB_INTERFACE_NAVI_D, /* VESA NAVI-D */ 445 DI_CTA_VESA_DDDB_INTERFACE_LVDS, /* LVDS */ 446 DI_CTA_VESA_DDDB_INTERFACE_RSDS, /* RSDS */ 447 DI_CTA_VESA_DDDB_INTERFACE_DVI_D, /* DVI-D */ 448 DI_CTA_VESA_DDDB_INTERFACE_DVI_I_ANALOG, /* DVI-I analog */ 449 DI_CTA_VESA_DDDB_INTERFACE_DVI_I_DIGITAL, /* DVI-I digital */ 450 DI_CTA_VESA_DDDB_INTERFACE_HDMI_A, /* HDMI-A */ 451 DI_CTA_VESA_DDDB_INTERFACE_HDMI_B, /* HDMI-B */ 452 DI_CTA_VESA_DDDB_INTERFACE_MDDI, /* MDDI */ 453 DI_CTA_VESA_DDDB_INTERFACE_DISPLAYPORT, /* DisplayPort */ 454 DI_CTA_VESA_DDDB_INTERFACE_IEEE_1394, /* IEEE-1394 */ 455 DI_CTA_VESA_DDDB_INTERFACE_M1_ANALOG, /* M1 analog */ 456 DI_CTA_VESA_DDDB_INTERFACE_M1_DIGITAL, /* M1 digital */ 457 }; 458 459 enum di_cta_vesa_dddb_content_protection { 460 DI_CTA_VESA_DDDB_CONTENT_PROTECTION_NONE = 0x00, /* None */ 461 DI_CTA_VESA_DDDB_CONTENT_PROTECTION_HDCP = 0x01, /* HDCP */ 462 DI_CTA_VESA_DDDB_CONTENT_PROTECTION_DTCP = 0x02, /* DTCP */ 463 DI_CTA_VESA_DDDB_CONTENT_PROTECTION_DPCP = 0x03, /* DPCP */ 464 }; 465 466 enum di_cta_vesa_dddb_default_orientation { 467 DI_CTA_VESA_DDDB_DEFAULT_ORIENTATION_LANDSCAPE = 0, /* Landscape */ 468 DI_CTA_VESA_DDDB_DEFAULT_ORIENTATION_PORTAIT = 1, /* Portrait */ 469 DI_CTA_VESA_DDDB_DEFAULT_ORIENTATION_UNFIXED = 2, /* Not fixed, may be rotated by the user */ 470 DI_CTA_VESA_DDDB_DEFAULT_ORIENTATION_UNDEFINED = 3, /* Undefined */ 471 }; 472 473 enum di_cta_vesa_dddb_rotation_cap { 474 DI_CTA_VESA_DDDB_ROTATION_CAP_NONE = 0, /* No rotation capability */ 475 DI_CTA_VESA_DDDB_ROTATION_CAP_90DEG_CLOCKWISE = 1, /* 90 degrees clockwise */ 476 DI_CTA_VESA_DDDB_ROTATION_CAP_90DEG_COUNTERCLOCKWISE = 2, /* 90 degrees counterclockwise */ 477 DI_CTA_VESA_DDDB_ROTATION_CAP_90DEG_EITHER = 3, /* 90 degrees in either direction */ 478 }; 479 480 enum di_cta_vesa_dddb_zero_pixel_location { 481 DI_CTA_VESA_DDDB_ZERO_PIXEL_UPPER_LEFT = 0, /* Upper left corner */ 482 DI_CTA_VESA_DDDB_ZERO_PIXEL_UPPER_RIGHT = 1, /* Upper right corner */ 483 DI_CTA_VESA_DDDB_ZERO_PIXEL_LOWER_LEFT = 2, /* Lower left corner */ 484 DI_CTA_VESA_DDDB_ZERO_PIXEL_LOWER_RIGHT = 3, /* Lower right corner */ 485 }; 486 487 enum di_cta_vesa_dddb_scan_direction { 488 /* Undefined */ 489 DI_CTA_VESA_DDDB_SCAN_DIRECTION_UNDEFINED = 0, 490 /* Fast (line) scan is along the long axis, slow (frame or field) scan 491 * is along the short axis */ 492 DI_CTA_VESA_DDDB_SCAN_DIRECTION_FAST_LONG_SLOW_SHORT = 1, 493 /* Fast (line) scan is along the short axis, slow (frame or field) scan 494 * is along the long axis */ 495 DI_CTA_VESA_DDDB_SCAN_DIRECTION_FAST_SHORT_SLOW_LONG = 2, 496 }; 497 498 /** 499 * Subpixel layout, defined in VESA DDDB section 2.9. 500 * 501 * For layouts with more than 3 subpixels, the color coordinates of the 502 * additional subpixels are defined in the additional primary chromaticities. 503 */ 504 enum di_cta_vesa_dddb_subpixel_layout { 505 /* Undefined */ 506 DI_CTA_VESA_DDDB_SUBPIXEL_UNDEFINED = 0x00, 507 /* Red, green, blue vertical stripes */ 508 DI_CTA_VESA_DDDB_SUBPIXEL_RGB_VERT = 0x01, 509 /* Red, green, blue horizontal stripes */ 510 DI_CTA_VESA_DDDB_SUBPIXEL_RGB_HORIZ = 0x02, 511 /* Vertical stripes with the primary ordering given by the order of the 512 * chromaticity information in the base EDID */ 513 DI_CTA_VESA_DDDB_SUBPIXEL_EDID_CHROM_VERT = 0x03, 514 /* Horizontal stripes with the primary ordering given by the order of 515 * the chromaticity information in the base EDID */ 516 DI_CTA_VESA_DDDB_SUBPIXEL_EDID_CHROM_HORIZ = 0x04, 517 /* Quad subpixels: 518 * R G 519 * G B 520 */ 521 DI_CTA_VESA_DDDB_SUBPIXEL_QUAD_RGGB = 0x05, 522 /* Quad subpixels: 523 * G B 524 * R G 525 */ 526 DI_CTA_VESA_DDDB_SUBPIXEL_QUAD_GBRG = 0x06, 527 /* Delta (triad) RGB subpixels */ 528 DI_CTA_VESA_DDDB_SUBPIXEL_DELTA_RGB = 0x07, 529 /* Mosaic */ 530 DI_CTA_VESA_DDDB_SUBPIXEL_MOSAIC = 0x08, 531 /* Quad subpixels: one each of red, green, blue, and one additional 532 * color (including white) in any order */ 533 DI_CTA_VESA_DDDB_SUBPIXEL_QUAD_ANY = 0x09, 534 /* Five subpixels, including RGB subpixels aligned as in the case of 535 * DI_CTA_VESA_DDDB_SUBPIXEL_RGB_VERT, with two additional subpixels 536 * located above or below this group */ 537 DI_CTA_VESA_DDDB_SUBPIXEL_FIVE = 0x0A, 538 /* Six subpixels, including RGB subpixels aligned as in the case of 539 * DI_CTA_VESA_DDDB_SUBPIXEL_RGB_VERT, with three additional subpixels 540 * located above or below this group */ 541 DI_CTA_VESA_DDDB_SUBPIXEL_SIX = 0x0B, 542 /* Clairvoyante, Inc. PenTile Matrix™ layout */ 543 DI_CTA_VESA_DDDB_SUBPIXEL_CLAIRVOYANTE_PENTILE = 0x0C, 544 }; 545 546 enum di_cta_vesa_dddb_dithering_type { 547 DI_CTA_VESA_DDDB_DITHERING_NONE = 0, /* None */ 548 DI_CTA_VESA_DDDB_DITHERING_SPACIAL = 1, /* Spacial */ 549 DI_CTA_VESA_DDDB_DITHERING_TEMPORAL = 2, /* Temporal */ 550 DI_CTA_VESA_DDDB_DITHERING_SPATIAL_AND_TEMPORAL = 3, /* Spacial and temporal */ 551 }; 552 553 struct di_cta_vesa_dddb_additional_primary_chromaticity { 554 float x, y; 555 }; 556 557 enum di_cta_vesa_dddb_frame_rate_conversion { 558 /* No dedicated rate conversion hardware is provided */ 559 DI_CTA_VESA_DDDB_FRAME_RATE_CONVERSION_NONE = 0, 560 /* Frame rate conversion is supported, tearing or other artifacts may 561 * be visible */ 562 DI_CTA_VESA_DDDB_FRAME_RATE_CONVERSION_SINGLE_BUFFERING = 1, 563 /* Frame rate conversion is supported, input frames may be duplicated or 564 * dropped */ 565 DI_CTA_VESA_DDDB_FRAME_RATE_CONVERSION_DOUBLE_BUFFERING = 2, 566 /* Frame rate conversion is supported via a more advanced technique 567 * (e.g. inter-frame interpolation) */ 568 DI_CTA_VESA_DDDB_FRAME_RATE_CONVERSION_ADVANCED = 3, 569 }; 570 571 enum di_cta_vesa_dddb_resp_time_transition { 572 DI_CTA_VESA_DDDB_RESP_TIME_BLACK_TO_WHITE = 0, /* Black to white */ 573 DI_CTA_VESA_DDDB_RESP_TIME_WHITE_TO_BLACK = 1, /* White to black */ 574 }; 575 576 /** 577 * VESA Display Device Data Block (DDDB), defined in VESA Display Device Data 578 * Block (DDDB) Standard version 1. 579 */ 580 struct di_cta_vesa_dddb { 581 /* Interface type */ 582 enum di_cta_vesa_dddb_interface_type interface_type; 583 /* Number of lanes/channels, zero if N/A */ 584 int32_t num_channels; 585 /* Interface standard version and release number */ 586 int32_t interface_version, interface_release; 587 /* Content protection support */ 588 enum di_cta_vesa_dddb_content_protection content_protection; 589 /* Minimum and maximum clock frequency (in mega-hertz), zero if unset 590 * (ie. maximum and minimum as permitted under the appropriate interface 591 * specification or standard) */ 592 int32_t min_clock_freq_mhz, max_clock_freq_mhz; 593 /* Device native pixel format, zero if unset */ 594 int32_t native_horiz_pixels, native_vert_pixels; 595 /* Aspect ratio taken as long axis divided by short axis */ 596 float aspect_ratio; 597 /* Default orientation */ 598 enum di_cta_vesa_dddb_default_orientation default_orientation; 599 /* Rotation capability */ 600 enum di_cta_vesa_dddb_rotation_cap rotation_cap; 601 /* Zero pixel location */ 602 enum di_cta_vesa_dddb_zero_pixel_location zero_pixel_location; 603 /* Scan direction */ 604 enum di_cta_vesa_dddb_scan_direction scan_direction; 605 /* Subpixel layout */ 606 enum di_cta_vesa_dddb_subpixel_layout subpixel_layout; 607 /* Horizontal and vertical dot/pixel pitch (in millimeters) */ 608 float horiz_pitch_mm, vert_pitch_mm; 609 /* Dithering type */ 610 enum di_cta_vesa_dddb_dithering_type dithering_type; 611 /* Direct drive: no scaling, de-interlacing, frame-rate conversion, etc. 612 * between this interface and the panel or other display device */ 613 bool direct_drive; 614 /* Overdrive not recommended: the source should not apply "overdrive" to 615 * the video signal */ 616 bool overdrive_not_recommended; 617 /* Display can deinterlaced video input */ 618 bool deinterlacing; 619 /* Video interface supports audio */ 620 bool audio_support; 621 /* Audio inputs are provided separately from the video interface */ 622 bool separate_audio_inputs; 623 /* Audio information received via the video interface will automatically 624 * override any other audio input channels provided */ 625 bool audio_input_override; 626 /* True if audio delay information is provided */ 627 bool audio_delay_provided; 628 /* Audio delay (in milliseconds, may be negative), with the maximum 629 * absolute value of 254 ms */ 630 int32_t audio_delay_ms; 631 /* Frame rate/mode conversion */ 632 enum di_cta_vesa_dddb_frame_rate_conversion frame_rate_conversion; 633 /* Frame rate range (in Hz), with the maximum value of 63 Hz */ 634 int32_t frame_rate_range_hz; 635 /* Native/nominal rate (in Hz) */ 636 int32_t frame_rate_native_hz; 637 /* Color bit depth for the interface and display device */ 638 int32_t bit_depth_interface, bit_depth_display; 639 /* Number of additional primary color chromaticities */ 640 size_t additional_primary_chromaticities_len; 641 /* Additional primary color chromaticities given as 1931 CIE xy color 642 * space coordinates (also defines the color of subpixels for some 643 * subpixel layouts) */ 644 struct di_cta_vesa_dddb_additional_primary_chromaticity additional_primary_chromaticities[3]; 645 /* Response time transition */ 646 enum di_cta_vesa_dddb_resp_time_transition resp_time_transition; 647 /* Response time (in milliseconds), with the maximum value of 127 ms */ 648 int32_t resp_time_ms; 649 /* Overscan horizontal and vertical percentage */ 650 int32_t overscan_horiz_pct, overscan_vert_pct; 651 }; 652 653 /** 654 * Get the VESA Display Device Data Block (DDDB) from a CTA data block. 655 * 656 * Returns NULL if the data block tag is not 657 * DI_CTA_DATA_BLOCK_VESA_DISPLAY_DEVICE. 658 */ 659 const struct di_cta_vesa_dddb * 660 di_cta_data_block_get_vesa_dddb(const struct di_cta_data_block *block); 661 662 /** 663 * CTA colorimetry data block, defined in section 7.5.5. 664 */ 665 struct di_cta_colorimetry_block { 666 /* Standard Definition Colorimetry based on IEC 61966-2-4 */ 667 bool xvycc_601; 668 /* High Definition Colorimetry based on IEC 61966-2-4 */ 669 bool xvycc_709; 670 /* Colorimetry based on IEC 61966-2-1/Amendment 1 */ 671 bool sycc_601; 672 /* Colorimetry based on IEC 61966-2-5, Annex A */ 673 bool opycc_601; 674 /* Colorimetry based on IEC 61966-2-5 */ 675 bool oprgb; 676 /* Colorimetry based on Rec. ITU-R BT.2020 Y'cC'bcC'rc */ 677 bool bt2020_cycc; 678 /* Colorimetry based on Rec. ITU-R BT.2020 Y'C'bC'r */ 679 bool bt2020_ycc; 680 /* Colorimetry based on Rec. ITU-R BT.2020 R'G'B' */ 681 bool bt2020_rgb; 682 /* Colorimetry based on SMPTE ST 2113 R'G'B' */ 683 bool st2113_rgb; 684 /* Colorimetry based on Rec. ITU-R BT.2100 ICtCp */ 685 bool ictcp; 686 }; 687 688 /** 689 * Get the colorimetry data from a CTA data block. 690 * 691 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_COLORIMETRY. 692 */ 693 const struct di_cta_colorimetry_block * 694 di_cta_data_block_get_colorimetry(const struct di_cta_data_block *block); 695 696 /** 697 * Supported Electro-Optical Transfer Functions for a CTA HDR static metadata 698 * block. 699 */ 700 struct di_cta_hdr_static_metadata_block_eotfs { 701 /* Traditional gamma - SDR luminance range */ 702 bool traditional_sdr; 703 /* Traditional gamma - HDR luminance range */ 704 bool traditional_hdr; 705 /* Perceptual Quantization (PQ) based on SMPTE ST 2084 */ 706 bool pq; 707 /* Hybrid Log-Gamma (HLG) based on Rec. ITU-R BT.2100 */ 708 bool hlg; 709 }; 710 711 /** 712 * Supported static metadata descriptors for a CTA HDR static metadata block. 713 */ 714 struct di_cta_hdr_static_metadata_block_descriptors { 715 /* Static Metadata Type 1 */ 716 bool type1; 717 }; 718 719 /** 720 * CTA HDR static metadata block, defined in section 7.5.13. 721 */ 722 struct di_cta_hdr_static_metadata_block { 723 /* Desired content max luminance (cd/m²), zero if unset */ 724 float desired_content_max_luminance; 725 /* Desired content max frame-average luminance (cd/m²), zero if unset */ 726 float desired_content_max_frame_avg_luminance; 727 /* Desired content min luminance (cd/m²), zero if unset */ 728 float desired_content_min_luminance; 729 /* Supported EOFTs */ 730 const struct di_cta_hdr_static_metadata_block_eotfs *eotfs; 731 /* Supported descriptors */ 732 const struct di_cta_hdr_static_metadata_block_descriptors *descriptors; 733 }; 734 735 /** 736 * Get the HDR static metadata from a CTA data block. 737 * 738 * Returns NULL if the data block tag is not 739 * DI_CTA_DATA_BLOCK_HDR_STATIC_METADATA. 740 */ 741 const struct di_cta_hdr_static_metadata_block * 742 di_cta_data_block_get_hdr_static_metadata(const struct di_cta_data_block *block); 743 744 /* Additional HDR Dynamic Metadata Type 1 information */ 745 struct di_cta_hdr_dynamic_metadata_block_type1 { 746 uint8_t type_1_hdr_metadata_version; 747 }; 748 749 /* Additional HDR Dynamic Metadata Type 2 (ETSI TS 103 433-1) information. 750 * Defined in ETSI TS 103 433-1 Annex G.2 HDR Dynamic Metadata Data Block. */ 751 struct di_cta_hdr_dynamic_metadata_block_type2 { 752 uint8_t ts_103_433_spec_version; 753 bool ts_103_433_1_capable; 754 bool ts_103_433_2_capable; 755 bool ts_103_433_3_capable; 756 }; 757 758 /* Additional HDR Dynamic Metadata Type 3 information */ 759 struct di_cta_hdr_dynamic_metadata_block_type3; 760 761 /* Additional HDR Dynamic Metadata Type 4 information */ 762 struct di_cta_hdr_dynamic_metadata_block_type4 { 763 uint8_t type_4_hdr_metadata_version; 764 }; 765 766 /* Additional HDR Dynamic Metadata Type 256 information */ 767 struct di_cta_hdr_dynamic_metadata_block_type256 { 768 uint8_t graphics_overlay_flag_version; 769 }; 770 771 /** 772 * CTA HDR dynamic metadata block, defined in section 7.5.14. 773 */ 774 struct di_cta_hdr_dynamic_metadata_block { 775 /* non-NULL if Dynamic Metadata Type 1 is supported. */ 776 const struct di_cta_hdr_dynamic_metadata_block_type1 *type1; 777 /* non-NULL if Dynamic Metadata Type 2 is supported. */ 778 const struct di_cta_hdr_dynamic_metadata_block_type2 *type2; 779 /* non-NULL if Dynamic Metadata Type 3 is supported. */ 780 const struct di_cta_hdr_dynamic_metadata_block_type3 *type3; 781 /* non-NULL if Dynamic Metadata Type 4 is supported. */ 782 const struct di_cta_hdr_dynamic_metadata_block_type4 *type4; 783 /* non-NULL if Dynamic Metadata Type 256 (0x0100) is supported. */ 784 const struct di_cta_hdr_dynamic_metadata_block_type256 *type256; 785 }; 786 787 /** 788 * Get the HDR dynamic metadata from a CTA data block. 789 * 790 * Returns NULL if the data block tag is not 791 * DI_CTA_DATA_BLOCK_HDR_DYNAMIC_METADATA. 792 */ 793 const struct di_cta_hdr_dynamic_metadata_block * 794 di_cta_data_block_get_hdr_dynamic_metadata(const struct di_cta_data_block *block); 795 796 /** 797 * A Short Video Descriptor (SVD). 798 */ 799 struct di_cta_svd { 800 /* Video Identification Code (VIC) */ 801 uint8_t vic; 802 /* Whether this is a native video format */ 803 bool native; 804 }; 805 806 /** 807 * Get an array of short video descriptors from a CTA data block. 808 * 809 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_VIDEO. 810 * 811 * The returned array is NULL-terminated. 812 */ 813 const struct di_cta_svd *const * 814 di_cta_data_block_get_svds(const struct di_cta_data_block *block); 815 816 /** 817 * Get an array of short video descriptors which only allow YCbCr 4:2:0 sampling 818 * mode from a CTA data block. 819 * 820 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_YCBCR420. 821 * 822 * The returned array is NULL-terminated. 823 */ 824 const struct di_cta_svd *const * 825 di_cta_data_block_get_ycbcr420_svds(const struct di_cta_data_block *block); 826 827 enum di_cta_vesa_transfer_characteristics_usage { 828 /* White transfer characteristic */ 829 DI_CTA_VESA_TRANSFER_CHARACTERISTIC_USAGE_WHITE = 0, 830 /* Red transfer characteristic */ 831 DI_CTA_VESA_TRANSFER_CHARACTERISTIC_USAGE_RED = 1, 832 /* Green transfer characteristic */ 833 DI_CTA_VESA_TRANSFER_CHARACTERISTIC_USAGE_GREEN = 2, 834 /* Blue transfer characteristic */ 835 DI_CTA_VESA_TRANSFER_CHARACTERISTIC_USAGE_BLUE = 3, 836 }; 837 838 /** 839 * VESA Display Transfer Characteristic Data Block, defined in VESA Display 840 * Transfer Characteristics Data Block Standard Version 1.0 841 * 842 * Contains 8, 16 or 32 evenly distributed points on the input axis describing 843 * the normalized relative luminance at that input. The first value includes the 844 * relative black level luminance. 845 */ 846 struct di_cta_vesa_transfer_characteristics { 847 enum di_cta_vesa_transfer_characteristics_usage usage; 848 uint8_t points_len; 849 float points[32]; 850 }; 851 852 /** 853 * Get the Display Transfer Characteristic from a CTA data block. 854 * 855 * Returns NULL if the data block tag is not 856 * DI_CTA_DATA_BLOCK_VESA_DISPLAY_TRANSFER_CHARACTERISTIC. 857 * 858 * Upstream is not aware of any EDID blob containing a Display Transfer 859 * Characteristic data block. 860 * If such a blob is found, please share it with upstream! 861 */ 862 const struct di_cta_vesa_transfer_characteristics * 863 di_cta_data_block_get_vesa_transfer_characteristics(const struct di_cta_data_block *block); 864 865 /** 866 * CTA YCbCr 4:2:0 Capability Map block, defined in section 7.5.11. 867 */ 868 struct di_cta_ycbcr420_cap_map; 869 870 /** 871 * Returns true if the SVD in regular Video Data Blocks at index `svd_index` 872 * supports YCbCr 4:2:0 subsampling. 873 */ 874 bool 875 di_cta_ycbcr420_cap_map_supported(const struct di_cta_ycbcr420_cap_map *cap_map, 876 size_t svd_index); 877 878 /** 879 * Get the YCbCr 4:2:0 Capability Map from a CTA data block. 880 * 881 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_YCBCR420_CAP_MAP. 882 */ 883 const struct di_cta_ycbcr420_cap_map * 884 di_cta_data_block_get_ycbcr420_cap_map(const struct di_cta_data_block *block); 885 886 enum di_cta_hdmi_audio_3d_channels { 887 DI_CTA_HDMI_AUDIO_3D_CHANNELS_UNKNOWN = 0, 888 DI_CTA_HDMI_AUDIO_3D_CHANNELS_10_2 = 1, 889 DI_CTA_HDMI_AUDIO_3D_CHANNELS_22_2 = 2, 890 DI_CTA_HDMI_AUDIO_3D_CHANNELS_30_2 = 3, 891 }; 892 893 /** 894 * HDMI 3D Audio 895 */ 896 struct di_cta_hdmi_audio_3d { 897 /* Supported formats. The array is NULL-terminated. */ 898 const struct di_cta_sad *const *sads; 899 /* Channels */ 900 enum di_cta_hdmi_audio_3d_channels channels; 901 /* Speakers */ 902 struct di_cta_speaker_allocation speakers; 903 }; 904 905 /** 906 * HDMI Multi-Stream Audio 907 */ 908 struct di_cta_hdmi_audio_multi_stream { 909 /* Supports 2 up to max_streams different streams */ 910 int max_streams; 911 /* Supports non-mixed main/supplementary audio streams */ 912 bool supports_non_mixed; 913 }; 914 915 /** 916 * HDMI Audio 917 */ 918 struct di_cta_hdmi_audio_block { 919 /* Multi-Stream Audio, NULL if unsupported */ 920 const struct di_cta_hdmi_audio_multi_stream *multi_stream; 921 /* 3D Audio, NULL if unsupported */ 922 const struct di_cta_hdmi_audio_3d *audio_3d; 923 }; 924 925 /** 926 * Get the HDMI Audio information from a CTA data block. 927 * 928 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_HDMI_AUDIO. 929 */ 930 const struct di_cta_hdmi_audio_block * 931 di_cta_data_block_get_hdmi_audio(const struct di_cta_data_block *block); 932 933 /** 934 * InfoFrame types, defined in table 7. 935 * 936 * Note, the enum values don't match the specification. 937 */ 938 enum di_cta_infoframe_type { 939 /* Auxiliary Video Information, defined in section 6.4. */ 940 DI_CTA_INFOFRAME_TYPE_AUXILIARY_VIDEO_INFORMATION, 941 /* Source Product Description, defined in section 6.5. */ 942 DI_CTA_INFOFRAME_TYPE_SOURCE_PRODUCT_DESCRIPTION, 943 /* Audio, defined in section 6.6. */ 944 DI_CTA_INFOFRAME_TYPE_AUDIO, 945 /* MPEG Source, defined in section 6.7. */ 946 DI_CTA_INFOFRAME_TYPE_MPEG_SOURCE, 947 /* NTSC VBI, defined in section 6.8. */ 948 DI_CTA_INFOFRAME_TYPE_NTSC_VBI, 949 /* Dynamic Range and Mastering, defined in section 6.9. */ 950 DI_CTA_INFOFRAME_TYPE_DYNAMIC_RANGE_AND_MASTERING, 951 }; 952 953 /** 954 * CTA InfoFrame descriptor, defined in section 7.5.9. 955 */ 956 struct di_cta_infoframe_descriptor { 957 /* Type of InfoFrame */ 958 enum di_cta_infoframe_type type; 959 }; 960 961 /** 962 * CTA InfoFrame processing, defined in section 7.5.9. 963 */ 964 struct di_cta_infoframe_block { 965 /* Number of Vendor-specific InfoFrames that can be received 966 * simultaneously */ 967 int num_simultaneous_vsifs; 968 /* Supported InfoFrames. The array is NULL-terminated. */ 969 const struct di_cta_infoframe_descriptor *const *infoframes; 970 }; 971 972 /** 973 * Get the InfoFrame information from a CTA data block. 974 * 975 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_INFOFRAME. 976 */ 977 const struct di_cta_infoframe_block * 978 di_cta_data_block_get_infoframe(const struct di_cta_data_block *block); 979 980 /** 981 * Room Configuration Data Block, defined in section 7.5.15. 982 */ 983 struct di_cta_room_configuration { 984 /* Present speakers */ 985 struct di_cta_speaker_allocation speakers; 986 /* Total number of L-PCM channels */ 987 int speaker_count; 988 /* All speakers are defined by Speaker Location Descriptors */ 989 bool has_speaker_location_descriptors; 990 /* Rectangular box that contains all of the components of interest 991 * centered on the Primary Listening Position. 992 * See 7.5.16.1 Room Coordinate System 993 * Only valid if any Speaker Location Descriptor has coordinates set. */ 994 int max_x; /* in dm */ 995 int max_y; /* in dm */ 996 int max_z; /* in dm */ 997 /* The position of the center of the display in normalized coordinates. 998 * Only valid if any Speaker Location Descriptor has coordinates set. */ 999 double display_x; /* normalized to max_x */ 1000 double display_y; /* normalized to max_y */ 1001 double display_z; /* normalized to max_z */ 1002 }; 1003 1004 /** 1005 * Get the Room Configuration from a CTA data block. 1006 * 1007 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_ROOM_CONFIG. 1008 */ 1009 const struct di_cta_room_configuration * 1010 di_cta_data_block_get_room_configuration(const struct di_cta_data_block *block); 1011 1012 enum di_cta_speaker_placement { 1013 /* FL - Front Left */ 1014 DI_CTA_SPEAKER_PLACEMENT_FL = 0x00, 1015 /* FR - Front Right */ 1016 DI_CTA_SPEAKER_PLACEMENT_FR = 0x01, 1017 /* FC - Front Center */ 1018 DI_CTA_SPEAKER_PLACEMENT_FC = 0x02, 1019 /* LFE1 - Low Frequency Effects 1 */ 1020 DI_CTA_SPEAKER_PLACEMENT_LFE1 = 0x03, 1021 /* BL - Back Left */ 1022 DI_CTA_SPEAKER_PLACEMENT_BL = 0x04, 1023 /* BR - Back Right */ 1024 DI_CTA_SPEAKER_PLACEMENT_BR = 0x05, 1025 /* FLc - Front Left of Center */ 1026 DI_CTA_SPEAKER_PLACEMENT_FLC = 0x06, 1027 /* FRc - Front Right of Center */ 1028 DI_CTA_SPEAKER_PLACEMENT_FRC = 0x07, 1029 /* BC - Back Center */ 1030 DI_CTA_SPEAKER_PLACEMENT_BC = 0x08, 1031 /* LFE2 - Low Frequency Effects 2 */ 1032 DI_CTA_SPEAKER_PLACEMENT_LFE2 = 0x09, 1033 /* SiL - Side Left */ 1034 DI_CTA_SPEAKER_PLACEMENT_SIL = 0x0a, 1035 /* SiR - Side Right */ 1036 DI_CTA_SPEAKER_PLACEMENT_SIR = 0x0b, 1037 /* TpFL - Top Front Left */ 1038 DI_CTA_SPEAKER_PLACEMENT_TPFL = 0x0c, 1039 /* TpFR - Top Front Right */ 1040 DI_CTA_SPEAKER_PLACEMENT_TPFR = 0x0d, 1041 /* TpFC - Top Front Center */ 1042 DI_CTA_SPEAKER_PLACEMENT_TPFC = 0x0e, 1043 /* TpC - Top Center */ 1044 DI_CTA_SPEAKER_PLACEMENT_TPC = 0x0f, 1045 /* TpBL - Top Back Left */ 1046 DI_CTA_SPEAKER_PLACEMENT_TPBL = 0x10, 1047 /* TpBR - Top Back Right */ 1048 DI_CTA_SPEAKER_PLACEMENT_TPBR = 0x11, 1049 /* TpSiL - Top Side Left */ 1050 DI_CTA_SPEAKER_PLACEMENT_TPSIL = 0x12, 1051 /* TpSiR - Top Side Right */ 1052 DI_CTA_SPEAKER_PLACEMENT_TPSIR = 0x13, 1053 /* TpBC - Top Back Center */ 1054 DI_CTA_SPEAKER_PLACEMENT_TPBC = 0x14, 1055 /* BtFC - Bottom Front Center */ 1056 DI_CTA_SPEAKER_PLACEMENT_BTFC = 0x15, 1057 /* BtFL - Bottom Front Left */ 1058 DI_CTA_SPEAKER_PLACEMENT_BTFL = 0x16, 1059 /* BtFR - Bottom Front Right */ 1060 DI_CTA_SPEAKER_PLACEMENT_BRFR = 0x17, 1061 /* FLw - Front Left Wide */ 1062 DI_CTA_SPEAKER_PLACEMENT_FLW = 0x18, 1063 /* FRw - Front Right Wide */ 1064 DI_CTA_SPEAKER_PLACEMENT_FRW = 0x19, 1065 /* LS - Left Surround */ 1066 DI_CTA_SPEAKER_PLACEMENT_LS = 0x1a, 1067 /* RS - Right Surround */ 1068 DI_CTA_SPEAKER_PLACEMENT_RS = 0x1b, 1069 }; 1070 1071 /** 1072 * Speaker Location Data Block, defined in section 7.5.16. 1073 */ 1074 struct di_cta_speaker_locations { 1075 /* Index of the audio channel where the audio for the described speaker 1076 * is to be transmitted. */ 1077 int channel_index; 1078 /* If the channel shall be rendered on a speaker by the Sink. */ 1079 bool is_active; 1080 /* If the speaker has coordinates instead of a named speaker placement. */ 1081 bool has_coords; 1082 /* The position of the speaker in normalized coordinates. */ 1083 double x, y, z; 1084 /* The named location of the speaker. Only valid if has_coords is false. */ 1085 enum di_cta_speaker_placement speaker_id; 1086 }; 1087 1088 /** 1089 * Get an array of Speaker Locations. 1090 * 1091 * Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_SPEAKER_LOCATION. 1092 * 1093 * The returned array is NULL-terminated. 1094 */ 1095 const struct di_cta_speaker_locations *const * 1096 di_cta_data_block_get_speaker_locations(const struct di_cta_data_block *block); 1097 1098 /** 1099 * Get the DisplayID Type VII Video Timing from a CTA data block. 1100 * 1101 * Returns NULL if the data block tag is not 1102 * DI_CTA_DATA_BLOCK_DISPLAYID_VIDEO_TIMING_VII. 1103 */ 1104 const struct di_displayid_type_i_ii_vii_timing * 1105 di_cta_data_block_get_did_type_vii_timing(const struct di_cta_data_block *block); 1106 1107 /** 1108 * Get a list of EDID detailed timing definitions. 1109 * 1110 * The returned array is NULL-terminated. 1111 */ 1112 const struct di_edid_detailed_timing_def *const * 1113 di_edid_cta_get_detailed_timing_defs(const struct di_edid_cta *cta); 1114 1115 enum di_cta_svr_type { 1116 /* reference contains a VIC */ 1117 DI_CTA_SVR_TYPE_VIC, 1118 /* reference contains an index into DTDs */ 1119 DI_CTA_SVR_TYPE_DTD_INDEX, 1120 /* reference contains an index into T7VTDB (DisplayID Type VII Video 1121 * Timing Data Block) DTDs and T10VTDB (DisplayID Type X Video Timing 1122 * Data Block) CVT descriptors */ 1123 DI_CTA_SVR_TYPE_T7T10VTDB, 1124 /* references the first code of the first T8VTDB (DisplayID Type VIII 1125 * Video Timing Data Block) */ 1126 DI_CTA_SVR_TYPE_FIRST_T8VTDB, 1127 }; 1128 1129 /** 1130 * Short Video Reference, defined in section 7.5.12. 1131 */ 1132 struct di_cta_svr { 1133 enum di_cta_svr_type type; 1134 /* A VIC if type is DI_CTA_SVR_TYPE_VIC */ 1135 uint8_t vic; 1136 /* The index into DTDs in order of appearance if type is 1137 * DI_CTA_SVR_TYPE_DTD_INDEX */ 1138 uint8_t dtd_index; 1139 /* The index into T7VTDB and T10VTDB in order of appearance if type is 1140 * DI_CTA_SVR_TYPE_T7T10VTDB */ 1141 uint8_t t7_t10_vtdb_index; 1142 }; 1143 1144 /** 1145 * Get an array of Short Video References (SVRs) from a CTA data block. The 1146 * first SVR refers to the most-preferred Video Format, while the next SVRs 1147 * are listed in order of decreasing preference. 1148 * 1149 * Returns NULL if the data block tag is not 1150 * DI_CTA_DATA_BLOCK_VIDEO_FORMAT_PREF. 1151 * 1152 * The returned array is NULL-terminated. 1153 */ 1154 const struct di_cta_svr *const * 1155 di_cta_data_block_get_svrs(const struct di_cta_data_block *block); 1156 1157 #endif 1158