diff options
author | Peter G. Baum <peter@dr-baum.net> | 2014-10-03 12:54:17 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-10-14 10:29:56 +0200 |
commit | c734fbc1393976665f9f4a92dcf22b60994c0280 (patch) | |
tree | 65f7e6d3f70d1b626552e51446adfa82e978e4a3 | |
parent | a0b25a570aa470c520343fea4b70e5ac1cbc4519 (diff) |
audio-channels: allow partially valid channel_mask
Since WAVEFORMATEXTENSIBLE allows to have more channels than
bits in the channel mask we should allow this, too, to avoid
loss of information.
https://bugzilla.gnome.org/show_bug.cgi?id=733405
-rw-r--r-- | gst-libs/gst/audio/audio-channels.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/gst-libs/gst/audio/audio-channels.c b/gst-libs/gst/audio/audio-channels.c index e5d2a555c..515eb940c 100644 --- a/gst-libs/gst/audio/audio-channels.c +++ b/gst-libs/gst/audio/audio-channels.c @@ -301,6 +301,8 @@ gst_audio_channel_positions_to_mask (const GstAudioChannelPosition * position, * (which should have at least @channels entries ensured by caller). * If @channel_mask is set to 0, it is considered as 'not present' for purpose * of conversion. + * A partially valid @channel_mask with less bits set than the number + * of channels is considered valid. * * Returns: %TRUE if channel and channel mask are valid and could be converted */ @@ -331,14 +333,12 @@ gst_audio_channel_positions_from_mask (gint channels, guint64 channel_mask, if ((channel_mask & (G_GUINT64_CONSTANT (1) << i))) { if (j < channels) position[j] = default_channel_order[i]; - if (default_channel_order[i] == GST_AUDIO_CHANNEL_POSITION_INVALID) - goto invalid_channel_mask; j++; } } - if (j != channels) - goto invalid_channel_mask; + GST_WARNING ("Only partially valid channel mask 0x%016" G_GINT64_MODIFIER + "x for %d channels", channel_mask, channels); } return TRUE; @@ -349,12 +349,6 @@ no_channel_mask: GST_ERROR ("no channel-mask property given"); return FALSE; } -invalid_channel_mask: - { - GST_ERROR ("Invalid channel mask 0x%016" G_GINT64_MODIFIER - "x for %d channels", channel_mask, channels); - return FALSE; - } } |