| GStreamer Base Plugins 1.0 Library Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <gst/audio/audio-channels.h> enum GstAudioChannelPosition; #define GST_AUDIO_CHANNEL_POSITION_MASK (pos) gboolean gst_audio_channel_positions_to_mask (const GstAudioChannelPosition *position,gint channels,gboolean force_order,guint64 *channel_mask); gboolean gst_audio_channel_positions_from_mask (gint channels,guint64 channel_mask,GstAudioChannelPosition *position); gboolean gst_audio_channel_positions_to_valid_order (GstAudioChannelPosition *position,gint channels); gboolean gst_audio_check_valid_channel_positions (const GstAudioChannelPosition *position,gint channels,gboolean force_order); gboolean gst_audio_buffer_reorder_channels (GstBuffer *buffer,GstAudioFormat format,gint channels,const GstAudioChannelPosition *from,const GstAudioChannelPosition *to); gboolean gst_audio_reorder_channels (gpointer data,gsize size,GstAudioFormat format,gint channels,const GstAudioChannelPosition *from,const GstAudioChannelPosition *to); gboolean gst_audio_get_channel_reorder_map (gint channels,const GstAudioChannelPosition *from,const GstAudioChannelPosition *to,gint *reorder_map);
typedef enum {
/* These get negative indices to allow to use
* the enum values of the normal cases for the
* bit-mask position */
GST_AUDIO_CHANNEL_POSITION_NONE = -3,
GST_AUDIO_CHANNEL_POSITION_MONO = -2,
GST_AUDIO_CHANNEL_POSITION_INVALID = -1,
/* Normal cases */
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT = 0,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_LFE1,
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
GST_AUDIO_CHANNEL_POSITION_LFE2,
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_TOP_CENTER,
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT,
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT,
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT,
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT,
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER,
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER,
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT,
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT,
GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT,
GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT,
GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT,
GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT
} GstAudioChannelPosition;
Audio channel positions.
These are the channels defined in SMPTE 2036-2-2008 Table 1 for 22.2 audio systems with the Surround and Wide channels from DTS Coherent Acoustics (v.1.3.1) and 10.2 and 7.1 layouts. In the caps the actual channel layout is expressed with a channel count and a channel mask, which describes the existing channels. The positions in the bit mask correspond to the enum values. For negotiation it is allowed to have more bits set in the channel mask than the number of channels to specify the allowed channel positions but this is not allowed in negotiated caps. It is not allowed in any situation other than the one mentioned below to have less bits set in the channel mask than the number of channels.
GST_AUDIO_CHANNEL_POSITION_MONO can only be used with a single mono channel that
has no direction information and would be mixed into all directional channels.
This is expressed in caps by having a single channel and no channel mask.
GST_AUDIO_CHANNEL_POSITION_NONE can only be used if all channels have this position.
This is expressed in caps by having a channel mask with no bits set.
As another special case it is allowed to have two channels without a channel mask. This implicitely means that this is a stereo stream with a front left and front right channel.
| used for position-less channels, e.g. from a sound card that records 1024 channels; mutually exclusive with any other channel position | |
| Mono without direction; can only be used with 1 channel | |
| invalid position | |
| Front left | |
| Front right | |
| Front center | |
| Low-frequency effects 1 (subwoofer) | |
| Rear left | |
| Rear right | |
| Front left of center | |
| Front right of center | |
| Rear center | |
| Low-frequency effects 2 (subwoofer) | |
| Side left | |
| Side right | |
| Top front left | |
| Top front right | |
| Top front center | |
| Top center | |
| Top rear left | |
| Top rear right | |
| Top side right | |
| Top rear right | |
| Top rear center | |
| Bottom front center | |
| Bottom front left | |
| Bottom front right | |
| Wide left (between front left and side left) | |
| Wide right (between front right and side right) | |
| Surround left (between rear left and side left) | |
| Surround right (between rear right and side right) |
#define GST_AUDIO_CHANNEL_POSITION_MASK(pos) (G_GUINT64_CONSTANT(1)<< GST_AUDIO_CHANNEL_POSITION_ ## pos)
gboolean gst_audio_channel_positions_to_mask (const GstAudioChannelPosition *position,gint channels,gboolean force_order,guint64 *channel_mask);
Convert the position array of channels channels to a bitmask.
If force_order is TRUE it additionally checks if the channels are
in the order required by GStreamer.
|
The GstAudioChannelPositions. [array length=channels]
|
|
The number of channels. |
|
Only consider the GStreamer channel order. |
|
the output channel mask. [array] |
Returns : |
TRUE if the channel positions are valid and could be converted. |
gboolean gst_audio_channel_positions_from_mask (gint channels,guint64 channel_mask,GstAudioChannelPosition *position);
Convert the channels present in channel_mask to a position array
(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.
|
The number of channels |
|
The input channel_mask |
|
The
GstAudioChannelPositions. [array length=channels]
|
Returns : |
TRUE if channel and channel mask are valid and could be converted |
gboolean gst_audio_channel_positions_to_valid_order (GstAudioChannelPosition *position,gint channels);
Reorders the channel positions in position from any order to
the GStreamer channel order.
|
The channel positions to reorder to. [array length=channels] |
|
The number of channels. |
Returns : |
TRUE if the channel positions are valid and reordering
was successful. |
gboolean gst_audio_check_valid_channel_positions (const GstAudioChannelPosition *position,gint channels,gboolean force_order);
Checks if position contains valid channel positions for
channels channels. If force_order is TRUE it additionally
checks if the channels are in the order required by GStreamer.
|
The GstAudioChannelPositions
to check. [array length=channels]
|
|
The number of channels. |
|
Only consider the GStreamer channel order. |
Returns : |
TRUE if the channel positions are valid. |
gboolean gst_audio_buffer_reorder_channels (GstBuffer *buffer,GstAudioFormat format,gint channels,const GstAudioChannelPosition *from,const GstAudioChannelPosition *to);
Reorders buffer from the channel positions from to the channel
positions to. from and to must contain the same number of
positions and the same positions, only in a different order.
buffer must be writable.
|
The buffer to reorder. |
|
The GstAudioFormat of the buffer. |
|
The number of channels. |
|
The channel positions in the buffer. [array] |
|
The channel positions to convert to. [array] |
Returns : |
TRUE if the reordering was possible. |
gboolean gst_audio_reorder_channels (gpointer data,gsize size,GstAudioFormat format,gint channels,const GstAudioChannelPosition *from,const GstAudioChannelPosition *to);
Reorders data from the channel positions from to the channel
positions to. from and to must contain the same number of
positions and the same positions, only in a different order.
|
The pointer to the memory. [array length=size][element-type guint8] |
|
The size of the memory. |
|
The GstAudioFormat of the buffer. |
|
The number of channels. |
|
The channel positions in the buffer. [array] |
|
The channel positions to convert to. [array] |
Returns : |
TRUE if the reordering was possible. |
gboolean gst_audio_get_channel_reorder_map (gint channels,const GstAudioChannelPosition *from,const GstAudioChannelPosition *to,gint *reorder_map);
Returns a reorder map for from to to that can be used in
custom channel reordering code, e.g. to convert from or to the
GStreamer channel order. from and to must contain the same
number of positions and the same positions, only in a
different order.
The resulting reorder_map can be used for reordering by assigning
channel i of the input to channel reorder_map[i] of the output.
|
The number of channels. |
|
The channel positions to reorder from. [array] |
|
The channel positions to reorder to. [array] |
|
Pointer to the reorder map. [array] |
Returns : |
TRUE if the channel positions are valid and reordering
is possible. |