mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
audio-converter: support more numerical types for mix matrix
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7363>
This commit is contained in:
parent
c5e7ffcd1b
commit
015af606b6
1 changed files with 22 additions and 3 deletions
|
@ -786,8 +786,13 @@ check_mix_matrix (guint in_channels, guint out_channels, const GValue * value)
|
|||
const GValue *itm;
|
||||
|
||||
itm = gst_value_array_get_value (row, i);
|
||||
if (!G_VALUE_HOLDS_FLOAT (itm)) {
|
||||
GST_ERROR ("Invalid mix matrix element type, should be float");
|
||||
if (!G_VALUE_HOLDS_FLOAT (itm) &&
|
||||
!G_VALUE_HOLDS_DOUBLE (itm) &&
|
||||
!G_VALUE_HOLDS_INT (itm) &&
|
||||
!G_VALUE_HOLDS_INT64 (itm) &&
|
||||
!G_VALUE_HOLDS_UINT (itm) && !G_VALUE_HOLDS_UINT64 (itm)) {
|
||||
GST_ERROR
|
||||
("Invalid mix matrix element type, should be float or double or integer");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -817,7 +822,21 @@ mix_matrix_from_g_value (guint in_channels, guint out_channels,
|
|||
gfloat coefficient;
|
||||
|
||||
itm = gst_value_array_get_value (row, i);
|
||||
coefficient = g_value_get_float (itm);
|
||||
if (G_VALUE_HOLDS_FLOAT (itm))
|
||||
coefficient = g_value_get_float (itm);
|
||||
else if (G_VALUE_HOLDS_DOUBLE (itm))
|
||||
coefficient = g_value_get_double (itm);
|
||||
else if (G_VALUE_HOLDS_INT (itm))
|
||||
coefficient = g_value_get_int (itm);
|
||||
else if (G_VALUE_HOLDS_INT64 (itm))
|
||||
coefficient = g_value_get_int64 (itm);
|
||||
else if (G_VALUE_HOLDS_UINT (itm))
|
||||
coefficient = g_value_get_uint (itm);
|
||||
else if (G_VALUE_HOLDS_UINT64 (itm))
|
||||
coefficient = g_value_get_uint64 (itm);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
matrix[i][j] = coefficient;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue