1 /* GStreamer Multichannel-Audio helper functions
2 * (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __GST_AUDIO_MULTICHANNEL_H__
21 #define __GST_AUDIO_MULTICHANNEL_H__
23 #include <gst/audio/audio.h>
24 #include <gst/audio/audio-enumtypes.h>
29 * GstAudioChannelPosition:
30 * @GST_AUDIO_CHANNEL_POSITION_FRONT_MONO: front mono
31 * @GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT: front left
32 * @GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT: front right
33 * @GST_AUDIO_CHANNEL_POSITION_REAR_CENTER: rear center
34 * @GST_AUDIO_CHANNEL_POSITION_REAR_LEFT: rear left
35 * @GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT: rear right
36 * @GST_AUDIO_CHANNEL_POSITION_LFE: subwoofer
37 * @GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER: front center
38 * @GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER: front left of center
39 * @GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER: front right of center
40 * @GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT: side left
41 * @GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT: side right
42 * @GST_AUDIO_CHANNEL_POSITION_NONE: used for position-less channels, e.g.
43 * from a sound card that records 1024 channels; mutually exclusive with
44 * any other channel position
47 GST_AUDIO_CHANNEL_POSITION_INVALID = -1,
49 /* Main front speakers. Mono and left/right are mututally exclusive! */
50 GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
51 GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
52 GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
54 /* rear. Left/right and center are mututally exclusive! */
55 GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
56 GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
57 GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
59 /* subwoofer/low-frequency */
60 GST_AUDIO_CHANNEL_POSITION_LFE,
62 /* Center front speakers. Center and left/right_of_center cannot be
64 GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
65 GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
66 GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
69 GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
70 GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
72 /* for multi-channel input and output with more than 8 channels,
73 * incompatible with all other positions, either all positions
74 * are defined or all positions are undefined, but can't mix'n'match */
75 GST_AUDIO_CHANNEL_POSITION_NONE,
77 /* don't use - counter */
78 GST_AUDIO_CHANNEL_POSITION_NUM
79 } GstAudioChannelPosition;
81 /* Retrieves or sets the positions from/to a GstStructure. Only
82 * works with fixed caps, caller should check for that! Caller
83 * g_free()s result of the getter. */
84 GstAudioChannelPosition *
85 gst_audio_get_channel_positions (GstStructure *str);
86 void gst_audio_set_channel_positions (GstStructure *str,
87 const GstAudioChannelPosition *pos);
89 /* Sets a (non-fixed) list of possible audio channel positions
90 * on a structure (this requires the "channels" property to
91 * be fixed!) or on a caps (here, the "channels" property may be
92 * unfixed and the caps may even contain multiple structures). */
93 void gst_audio_set_structure_channel_positions_list
95 const GstAudioChannelPosition *pos,
97 void gst_audio_set_caps_channel_positions_list
99 const GstAudioChannelPosition *pos,
102 /* Custom fixate function. Elements that implement some sort of
103 * channel conversion algorhithm should use this function for
104 * fixating on GstAudioChannelPosition properties. It will take
105 * care of equal channel positioning (left/right). Caller g_free()s
106 * the return value. The input properties may be (and are supposed
108 GstAudioChannelPosition *
109 gst_audio_fixate_channel_positions (GstStructure *str);
111 gboolean gst_audio_check_channel_positions (const GstAudioChannelPosition * pos, guint channels);
115 #endif /* __GST_AUDIO_MULTICHANNEL_H__ */