cta: Return a block struct for type vii timings

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
This commit is contained in:
Sebastian Wick 2024-06-11 15:23:40 +02:00 committed by Sebastian Wick
parent 9534dea0df
commit 211fa636a3
4 changed files with 24 additions and 8 deletions

9
cta.c
View file

@ -1553,7 +1553,7 @@ parse_speaker_location_block(struct di_edid_cta *cta,
static bool
parse_did_type_vii_timing(struct di_edid_cta *cta,
struct di_displayid_type_i_ii_vii_timing *t,
struct di_cta_type_vii_timing_priv *t,
const uint8_t *data, size_t size)
{
uint8_t revision;
@ -1590,11 +1590,12 @@ parse_did_type_vii_timing(struct di_edid_cta *cta,
data += 1;
size -= 1;
if (!_di_displayid_parse_type_1_7_timing(t, cta->logger,
if (!_di_displayid_parse_type_1_7_timing(&t->timing, cta->logger,
"DisplayID Type VII Video Timing Data Block",
data, true))
return false;
t->base.timing = &t->timing;
return true;
}
@ -2112,13 +2113,13 @@ di_cta_data_block_get_speaker_locations(const struct di_cta_data_block *block)
return &block->speaker_location.base;
}
const struct di_displayid_type_i_ii_vii_timing *
const struct di_cta_type_vii_timing_block *
di_cta_data_block_get_did_type_vii_timing(const struct di_cta_data_block *block)
{
if (block->tag != DI_CTA_DATA_BLOCK_DISPLAYID_VIDEO_TIMING_VII) {
return NULL;
}
return &block->did_vii_timing;
return &block->did_vii_timing.base;
}
const struct di_edid_detailed_timing_def *const *

View file

@ -906,7 +906,7 @@ print_cta(const struct di_edid_cta *cta)
const struct di_cta_infoframe_block *infoframe;
const struct di_cta_video_format_pref_block *video_format_pref;
const struct di_edid_detailed_timing_def *const *detailed_timing_defs;
const struct di_displayid_type_i_ii_vii_timing *type_vii_timing;
const struct di_cta_type_vii_timing_block *type_vii_timing;
const struct di_cta_hdmi_audio_block *hdmi_audio;
size_t i;
int vtdb_index = 0;
@ -1024,7 +1024,7 @@ print_cta(const struct di_edid_cta *cta)
break;
case DI_CTA_DATA_BLOCK_DISPLAYID_VIDEO_TIMING_VII:
type_vii_timing = di_cta_data_block_get_did_type_vii_timing(data_block);
print_did_type_vii_timing(type_vii_timing, vtdb_index);
print_did_type_vii_timing(type_vii_timing->timing, vtdb_index);
vtdb_index++;
break;
case DI_CTA_DATA_BLOCK_HDMI_AUDIO:

View file

@ -185,6 +185,11 @@ struct di_cta_video_format_pref_priv {
size_t svrs_len;
};
struct di_cta_type_vii_timing_priv {
struct di_cta_type_vii_timing_block base;
struct di_displayid_type_i_ii_vii_timing timing;
};
struct di_cta_data_block {
enum di_cta_data_block_tag tag;
@ -221,7 +226,7 @@ struct di_cta_data_block {
/* Used for DI_CTA_DATA_BLOCK_VIDEO_FORMAT_PREF */
struct di_cta_video_format_pref_priv video_format_pref;
/* Used for DI_CTA_DATA_BLOCK_DISPLAYID_VIDEO_TIMING_VII */
struct di_displayid_type_i_ii_vii_timing did_vii_timing;
struct di_cta_type_vii_timing_priv did_vii_timing;
};
extern const struct di_cta_video_format _di_cta_video_formats[];

View file

@ -1128,13 +1128,23 @@ struct di_cta_speaker_location_block {
const struct di_cta_speaker_location_block *
di_cta_data_block_get_speaker_locations(const struct di_cta_data_block *block);
/* See <libdisplay-info/displayid.h> */
struct di_displayid_type_i_ii_vii_timing;
/**
* Type VII Video Timing Data Block, defined in section 7.5.17.1
*/
struct di_cta_type_vii_timing_block {
const struct di_displayid_type_i_ii_vii_timing *timing;
};
/**
* Get the DisplayID Type VII Video Timing from a CTA data block.
*
* Returns NULL if the data block tag is not
* DI_CTA_DATA_BLOCK_DISPLAYID_VIDEO_TIMING_VII.
*/
const struct di_displayid_type_i_ii_vii_timing *
const struct di_cta_type_vii_timing_block *
di_cta_data_block_get_did_type_vii_timing(const struct di_cta_data_block *block);
enum di_cta_svr_type {