mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-13 10:55:34 +00:00
interleave: use gst_audio_channel_positions_to_mask instead of a local copy
of half of it. Handles some values more correctly.
This commit is contained in:
parent
47a8eb7ca8
commit
7522cd1595
1 changed files with 8 additions and 11 deletions
|
@ -254,7 +254,8 @@ gst_interleave_finalize (GObject * object)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_interleave_check_channel_positions (GValueArray * positions)
|
gst_interleave_channel_positions_to_mask (GValueArray * positions,
|
||||||
|
guint64 * mask)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
guint channels;
|
guint channels;
|
||||||
|
@ -271,7 +272,7 @@ gst_interleave_check_channel_positions (GValueArray * positions)
|
||||||
pos[i] = g_value_get_enum (val);
|
pos[i] = g_value_get_enum (val);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gst_audio_check_valid_channel_positions (pos, channels, FALSE);
|
ret = gst_audio_channel_positions_to_mask (pos, channels, FALSE, mask);
|
||||||
g_free (pos);
|
g_free (pos);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -280,18 +281,14 @@ gst_interleave_check_channel_positions (GValueArray * positions)
|
||||||
static void
|
static void
|
||||||
gst_interleave_set_channel_positions (GstInterleave * self, GstStructure * s)
|
gst_interleave_set_channel_positions (GstInterleave * self, GstStructure * s)
|
||||||
{
|
{
|
||||||
gint i;
|
|
||||||
guint64 channel_mask = 0;
|
guint64 channel_mask = 0;
|
||||||
|
|
||||||
if (self->channel_positions != NULL &&
|
if (self->channel_positions != NULL &&
|
||||||
self->channels == self->channel_positions->n_values
|
self->channels == self->channel_positions->n_values) {
|
||||||
&& gst_interleave_check_channel_positions (self->channel_positions)) {
|
if (!gst_interleave_channel_positions_to_mask (self->channel_positions,
|
||||||
GST_DEBUG_OBJECT (self, "Using provided channel positions");
|
&channel_mask)) {
|
||||||
for (i = 0; i < self->channels; i++) {
|
GST_WARNING_OBJECT (self, "Invalid channel positions, using NONE");
|
||||||
GValue *val;
|
channel_mask = 0;
|
||||||
|
|
||||||
val = g_value_array_get_nth (self->channel_positions, i);
|
|
||||||
channel_mask |= G_GUINT64_CONSTANT (1) << g_value_get_enum (val);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (self, "Using NONE channel positions");
|
GST_WARNING_OBJECT (self, "Using NONE channel positions");
|
||||||
|
|
Loading…
Reference in a new issue