expand tabs
[platform/upstream/gstreamer.git] / gst-libs / gst / audio / multichannel.h
1 /* GStreamer Multichannel-Audio helper functions
2  * (c) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #ifndef __GST_AUDIO_MULTICHANNEL_H__
21 #define __GST_AUDIO_MULTICHANNEL_H__
22
23 #include <gst/audio/audio.h>
24 #include <gst/audio/multichannel-enumtypes.h>
25
26 G_BEGIN_DECLS
27
28 typedef enum {
29   GST_AUDIO_CHANNEL_POSITION_INVALID = -1,
30
31   /* Main front speakers. Mono and left/right are mututally exclusive! */
32   GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
33   GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
34   GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
35
36   /* rear. Left/right and center are mututally exclusive! */
37   GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
38   GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
39   GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
40
41   /* subwoofer/low-frequency */
42   GST_AUDIO_CHANNEL_POSITION_LFE,
43
44   /* Center front speakers. Center and left/right_of_center cannot be
45    * used together! */
46   GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
47   GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
48   GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
49
50   /* sides */
51   GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
52   GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
53
54   /* don't use - counter */
55   GST_AUDIO_CHANNEL_POSITION_NUM
56 } GstAudioChannelPosition;
57
58 /* Retrieves or sets the positions from/to a GstStructure. Only
59  * works with fixed caps, caller should check for that! Caller
60  * g_free()s result of the getter. */
61 GstAudioChannelPosition *
62         gst_audio_get_channel_positions (GstStructure *str);
63 void    gst_audio_set_channel_positions (GstStructure *str,
64                                          const GstAudioChannelPosition *pos);
65
66 /* Sets a (non-fixed) list of possible audio channel positions
67  * on a structure (this requires the "channels" property to
68  * be fixed!) or on a caps (here, the "channels" property may be
69  * unfixed and the caps may even contain multiple structures). */
70 void    gst_audio_set_structure_channel_positions_list
71                                         (GstStructure *str,
72                                          const GstAudioChannelPosition *pos,
73                                          gint          num_positions);
74 void    gst_audio_set_caps_channel_positions_list
75                                         (GstCaps      *caps,
76                                          const GstAudioChannelPosition *pos,
77                                          gint          num_positions);
78
79 /* Custom fixate function. Elements that implement some sort of
80  * channel conversion algorhithm should use this function for
81  * fixating on GstAudioChannelPosition properties. It will take
82  * care of equal channel positioning (left/right). Caller g_free()s
83  * the return value. The input properties may be (and are supposed
84  * to be) unfixed. */
85 GstAudioChannelPosition *
86         gst_audio_fixate_channel_positions (GstStructure *str);
87
88 G_END_DECLS
89
90 #endif /* __GST_AUDIO_MULTICHANNEL_H__ */