mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
audio: Make sure 'channels' and 'channel-positions' are coherent
If channel-positions are present, check they match the reported 'channels' value.
This commit is contained in:
parent
70d967da7c
commit
b8219faa90
1 changed files with 11 additions and 0 deletions
|
@ -345,9 +345,13 @@ gst_audio_info_from_caps (GstAudioInfo * info, const GstCaps * caps)
|
|||
gst_audio_info_set_format (info, format, rate, channels);
|
||||
|
||||
pos_val_arr = gst_structure_get_value (str, "channel-positions");
|
||||
|
||||
if (pos_val_arr) {
|
||||
guint max_pos = MIN (channels, 64);
|
||||
|
||||
if (channels != gst_value_array_get_size (pos_val_arr))
|
||||
goto incoherent_channels;
|
||||
|
||||
for (i = 0; i < max_pos; i++) {
|
||||
pos_val_entry = gst_value_array_get_value (pos_val_arr, i);
|
||||
info->position[i] = g_value_get_enum (pos_val_entry);
|
||||
|
@ -385,6 +389,13 @@ no_channels:
|
|||
GST_ERROR ("no channels property given");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
incoherent_channels:
|
||||
{
|
||||
GST_ERROR ("There should be %d channels positions, but %d are present",
|
||||
channels, gst_value_array_get_size (pos_val_arr));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue