Top |
#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.
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.
A partially valid channel_mask
with less bits set than the number
of channels is considered valid.
channels |
The number of channels |
|
channel_mask |
The input channel_mask |
|
position |
The
|
[array length=channels] |
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.
guint64
gst_audio_channel_get_fallback_mask (gint channels
);
Get the fallback channel-mask for the given number of channels.
This function returns a reasonable fallback channel-mask and should be called as a last resort when the specific channel map is unknown.
Since: 1.8
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.
position |
The |
[array length=channels] |
channels |
The number of channels. |
|
force_order |
Only consider the GStreamer channel order. |
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.
buffer |
The buffer to reorder. |
|
format |
The |
|
channels |
The number of channels. |
|
from |
The channel positions in the buffer. |
[array] |
to |
The channel positions to convert to. |
[array] |
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.
data |
The pointer to the memory. |
[array length=size][element-type guint8] |
size |
The size of the memory. |
|
format |
The |
|
channels |
The number of channels. |
|
from |
The channel positions in the buffer. |
[array] |
to |
The channel positions to convert to. |
[array] |
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.
gchar * gst_audio_channel_positions_to_string (const GstAudioChannelPosition *position
,gint channels
);
Converts position
to a human-readable string representation for
debugging purposes.
position |
The |
[array length=channels] |
channels |
The number of channels. |
GstAudioChannelMixer * gst_audio_channel_mixer_new (GstAudioChannelMixerFlags flags
,GstAudioFormat format
,gint in_channels
,GstAudioChannelPosition *in_position
,gint out_channels
,GstAudioChannelPosition *out_position
);
void
gst_audio_channel_mixer_free (GstAudioChannelMixer *mix
);
Free memory allocated by mix
.
gboolean
gst_audio_channel_mixer_is_passthrough
(GstAudioChannelMixer *mix
);
Check if mix
is in passthrough.
void gst_audio_channel_mixer_samples (GstAudioChannelMixer *mix
,const gpointer in[]
,gpointer out[]
,gint samples
);
In case the samples are interleaved, in
and out
must point to an
array with a single element pointing to a block of interleaved samples.
If non-interleaved samples are used, in
and out
must point to an
array with pointers to memory blocks, one for each channel.
Perform channel mixing on in_data
and write the result to out_data
.
in_data
and out_data
need to be in format
and layout
.
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) |
Flags passed to gst_audio_channel_mixer_new()