cta: Return a block struct for speaker locations

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
This commit is contained in:
Sebastian Wick 2024-06-11 14:50:15 +02:00 committed by Sebastian Wick
parent a274fed156
commit d013195750
3 changed files with 24 additions and 14 deletions

12
cta.c
View file

@ -1500,10 +1500,10 @@ parse_room_config_block(struct di_edid_cta *cta,
static bool
parse_speaker_location_block(struct di_edid_cta *cta,
struct di_cta_speaker_location_block *sldb,
struct di_cta_speaker_location_priv *sldb,
const uint8_t *data, size_t size)
{
struct di_cta_speaker_locations speaker_loc, *slp;
struct di_cta_speaker_location_descriptor speaker_loc, *slp;
if (size < 2) {
add_failure(cta, "Speaker Location Data Block: Empty Data Block with length %u.",
@ -1545,6 +1545,8 @@ parse_speaker_location_block(struct di_edid_cta *cta,
sldb->locations[sldb->locations_len++] = slp;
}
sldb->base.locations =
(const struct di_cta_speaker_location_descriptor *const *)sldb->locations;
return true;
}
@ -1602,7 +1604,7 @@ destroy_data_block(struct di_cta_data_block *data_block)
struct di_cta_video_block_priv *video;
struct di_cta_audio_block_priv *audio;
struct di_cta_infoframe_block_priv *infoframe;
struct di_cta_speaker_location_block *speaker_location;
struct di_cta_speaker_location_priv *speaker_location;
struct di_cta_video_format_pref_block *vfpdb;
struct di_cta_hdmi_audio_block_priv *hdmi_audio;
struct di_cta_ycbcr420_video_block_priv *ycbcr420;
@ -2100,13 +2102,13 @@ di_cta_data_block_get_infoframe(const struct di_cta_data_block *block)
return &block->infoframe.block;
}
const struct di_cta_speaker_locations *const *
const struct di_cta_speaker_location_block *
di_cta_data_block_get_speaker_locations(const struct di_cta_data_block *block)
{
if (block->tag != DI_CTA_DATA_BLOCK_SPEAKER_LOCATION) {
return NULL;
}
return (const struct di_cta_speaker_locations *const *) block->speaker_location.locations;
return &block->speaker_location.base;
}
const struct di_displayid_type_i_ii_vii_timing *

View file

@ -166,13 +166,15 @@ struct di_cta_hdmi_audio_block_priv {
struct di_cta_infoframe_block_priv {
struct di_cta_infoframe_block block;
/* NULL-terminated */
struct di_cta_infoframe_descriptor *infoframes[EDID_CTA_INFOFRAME_BLOCK_ENTRIES + 1];
size_t infoframes_len;
};
struct di_cta_speaker_location_block {
struct di_cta_speaker_location_priv {
struct di_cta_speaker_location_block base;
/* NULL-terminated */
struct di_cta_speaker_locations *locations[EDID_CTA_MAX_SPEAKER_LOCATION_BLOCK_ENTRIES + 1];
struct di_cta_speaker_location_descriptor *locations[EDID_CTA_MAX_SPEAKER_LOCATION_BLOCK_ENTRIES + 1];
size_t locations_len;
};
@ -214,7 +216,7 @@ struct di_cta_data_block {
/* Used for DI_CTA_DATA_BLOCK_ROOM_CONFIG */
struct di_cta_room_configuration_block room_config;
/* Used for DI_CTA_DATA_BLOCK_SPEAKER_LOCATION */
struct di_cta_speaker_location_block speaker_location;
struct di_cta_speaker_location_priv speaker_location;
/* Used for DI_CTA_DATA_BLOCK_VIDEO_FORMAT_PREF */
struct di_cta_video_format_pref_block video_format_pref;
/* Used for DI_CTA_DATA_BLOCK_DISPLAYID_VIDEO_TIMING_VII */

View file

@ -1096,9 +1096,9 @@ enum di_cta_speaker_placement {
};
/**
* Speaker Location Data Block, defined in section 7.5.16.
* Speaker Location Descriptor, defined in section 7.5.16.
*/
struct di_cta_speaker_locations {
struct di_cta_speaker_location_descriptor {
/* Index of the audio channel where the audio for the described speaker
* is to be transmitted. */
int channel_index;
@ -1113,13 +1113,19 @@ struct di_cta_speaker_locations {
};
/**
* Get an array of Speaker Locations.
* Speaker Location Data Block, defined in section 7.5.16.
*/
struct di_cta_speaker_location_block {
/* Speaker Location Descriptors. The array is NULL-terminated. */
const struct di_cta_speaker_location_descriptor *const *locations;
};
/**
* Get the Speaker Locations from a CTA data block.
*
* Returns NULL if the data block tag is not DI_CTA_DATA_BLOCK_SPEAKER_LOCATION.
*
* The returned array is NULL-terminated.
*/
const struct di_cta_speaker_locations *const *
const struct di_cta_speaker_location_block *
di_cta_data_block_get_speaker_locations(const struct di_cta_data_block *block);
/**