audio-channels: rename get_default_mask

Rename _get_default_mask() to _get_fallback_mask() to make it more
clear that the function only provides a fallback if nothing else can be
done. Also clarify this in the documentation.

API: gst_audio_channel_get_fallback_mask()
This commit is contained in:
Wim Taymans 2015-11-05 12:42:56 +01:00
parent 9c7d3c8ab2
commit a7789854d5
5 changed files with 11 additions and 8 deletions

View file

@ -492,18 +492,21 @@ static const guint64 default_masks[] = {
};
/**
* gst_audio_channel_get_default_mask:
* gst_audio_channel_get_fallback_mask:
* @channels: the number of channels
*
* Get the default channel-mask for the given number of channels.
* Get the fallback channel-mask for the given number of channels.
*
* Returns: the default channel-mask for @channels or 0 when there is no default
* This function returns a reasonable fallback channel-mask and should be
* called as a last resort when the specific channel map is unknown.
*
* Returns: a fallback channel-mask for @channels or 0 when there is no
* mask.
*
* Since: 1.8
*/
guint64
gst_audio_channel_get_default_mask (gint channels)
gst_audio_channel_get_fallback_mask (gint channels)
{
g_return_val_if_fail (channels > 0, 0);

View file

@ -160,7 +160,7 @@ gboolean gst_audio_get_channel_reorder_map (gint channels,
const GstAudioChannelPosition * from,
const GstAudioChannelPosition * to,
gint *reorder_map);
guint64 gst_audio_channel_get_default_mask (gint channels);
guint64 gst_audio_channel_get_fallback_mask (gint channels);
G_END_DECLS

View file

@ -2005,7 +2005,7 @@ gst_audio_decoder_negotiate_default_caps (GstAudioDecoder * dec)
/* Need to add a channel-mask if channels > 2 */
gst_structure_get_int (structure, "channels", &channels);
if (channels > 2 && !gst_structure_has_field (structure, "channel-mask")) {
channel_mask = gst_audio_channel_get_default_mask (channels);
channel_mask = gst_audio_channel_get_fallback_mask (channels);
if (channel_mask != 0) {
gst_structure_set (structure, "channel-mask",
GST_TYPE_BITMASK, channel_mask, NULL);

View file

@ -621,7 +621,7 @@ gst_audio_convert_fixate_channels (GstBaseTransform * base, GstStructure * ins,
* layout based on LFE-presence in input layout, but let's save that for
* another day) */
if (out_chans > 0
&& (out_mask = gst_audio_channel_get_default_mask (out_chans))) {
&& (out_mask = gst_audio_channel_get_fallback_mask (out_chans))) {
GST_DEBUG_OBJECT (base, "using default channel layout as fallback");
gst_structure_set (outs, "channel-mask", GST_TYPE_BITMASK, out_mask, NULL);
} else {

View file

@ -27,7 +27,7 @@ EXPORTS
gst_audio_cd_src_add_track
gst_audio_cd_src_get_type
gst_audio_cd_src_mode_get_type
gst_audio_channel_get_default_mask
gst_audio_channel_get_fallback_mask
gst_audio_channel_position_get_type
gst_audio_channel_positions_from_mask
gst_audio_channel_positions_to_mask