summaryrefslogtreecommitdiff
path: root/gst/interleave
diff options
context:
space:
mode:
authorMichael Smith <msmith@rdio.com>2012-10-04 15:13:20 -0700
committerMichael Smith <msmith@rdio.com>2012-10-04 15:13:20 -0700
commit7522cd1595ba7aefe0928e6b6de24ac92d159106 (patch)
treef23702a4530874747b0f566c0479284322782044 /gst/interleave
parent47a8eb7ca89cb2339f5220fb674bc3d1affeadb8 (diff)
downloadgstreamer-plugins-good-7522cd1595ba7aefe0928e6b6de24ac92d159106.tar.gz
interleave: use gst_audio_channel_positions_to_mask instead of a local copy
of half of it. Handles some values more correctly.
Diffstat (limited to 'gst/interleave')
-rw-r--r--gst/interleave/interleave.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/gst/interleave/interleave.c b/gst/interleave/interleave.c
index 547b2d254..ebc189e66 100644
--- a/gst/interleave/interleave.c
+++ b/gst/interleave/interleave.c
@@ -254,7 +254,8 @@ gst_interleave_finalize (GObject * object)
}
static gboolean
-gst_interleave_check_channel_positions (GValueArray * positions)
+gst_interleave_channel_positions_to_mask (GValueArray * positions,
+ guint64 * mask)
{
gint i;
guint channels;
@@ -271,7 +272,7 @@ gst_interleave_check_channel_positions (GValueArray * positions)
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);
return ret;
@@ -280,18 +281,14 @@ gst_interleave_check_channel_positions (GValueArray * positions)
static void
gst_interleave_set_channel_positions (GstInterleave * self, GstStructure * s)
{
- gint i;
guint64 channel_mask = 0;
if (self->channel_positions != NULL &&
- self->channels == self->channel_positions->n_values
- && gst_interleave_check_channel_positions (self->channel_positions)) {
- GST_DEBUG_OBJECT (self, "Using provided channel positions");
- for (i = 0; i < self->channels; i++) {
- GValue *val;
-
- val = g_value_array_get_nth (self->channel_positions, i);
- channel_mask |= G_GUINT64_CONSTANT (1) << g_value_get_enum (val);
+ self->channels == self->channel_positions->n_values) {
+ if (!gst_interleave_channel_positions_to_mask (self->channel_positions,
+ &channel_mask)) {
+ GST_WARNING_OBJECT (self, "Invalid channel positions, using NONE");
+ channel_mask = 0;
}
} else {
GST_WARNING_OBJECT (self, "Using NONE channel positions");