Initialize Tizen 2.3
[framework/multimedia/gst-plugins-base0.10.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 #include <gst/audio/audio.h>
21 #include <gst/audio/audio-enumtypes.h>
22
23 #ifndef __GST_AUDIO_MULTICHANNEL_H__
24 #define __GST_AUDIO_MULTICHANNEL_H__
25
26 G_BEGIN_DECLS
27
28 /**
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
45  * @GST_AUDIO_CHANNEL_POSITION_INVALID: invalid position
46  *
47  * Audio channel positions.
48  */
49 typedef enum {
50   GST_AUDIO_CHANNEL_POSITION_INVALID = -1,
51
52   /* Main front speakers. Mono and left/right are mututally exclusive! */
53   GST_AUDIO_CHANNEL_POSITION_FRONT_MONO,
54   GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
55   GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
56
57   /* rear. Left/right and center are mututally exclusive! */
58   GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
59   GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
60   GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
61
62   /* subwoofer/low-frequency */
63   GST_AUDIO_CHANNEL_POSITION_LFE,
64
65   /* Center front speakers. Center and left/right_of_center cannot be
66    * used together! */
67   GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
68   GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
69   GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
70
71   /* sides */
72   GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
73   GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
74
75   /* for multi-channel input and output with more than 8 channels,
76    * incompatible with all other positions, either all positions
77    * are defined or all positions are undefined, but can't mix'n'match  */
78   GST_AUDIO_CHANNEL_POSITION_NONE,
79
80   /*< private >*/
81   /* don't use - counter */
82   GST_AUDIO_CHANNEL_POSITION_NUM
83 } GstAudioChannelPosition;
84
85 /* Retrieves or sets the positions from/to a GstStructure. Only
86  * works with fixed caps, caller should check for that! Caller
87  * g_free()s result of the getter. */
88 GstAudioChannelPosition *
89         gst_audio_get_channel_positions (GstStructure *str);
90 void    gst_audio_set_channel_positions (GstStructure *str,
91                                          const GstAudioChannelPosition *pos);
92
93 /* Sets a (non-fixed) list of possible audio channel positions
94  * on a structure (this requires the "channels" property to
95  * be fixed!) or on a caps (here, the "channels" property may be
96  * unfixed and the caps may even contain multiple structures). */
97 void    gst_audio_set_structure_channel_positions_list
98                                         (GstStructure *str,
99                                          const GstAudioChannelPosition *pos,
100                                          gint          num_positions);
101 void    gst_audio_set_caps_channel_positions_list
102                                         (GstCaps      *caps,
103                                          const GstAudioChannelPosition *pos,
104                                          gint          num_positions);
105
106 /* Custom fixate function. Elements that implement some sort of
107  * channel conversion algorithm should use this function for
108  * fixating on GstAudioChannelPosition properties. It will take
109  * care of equal channel positioning (left/right). Caller g_free()s
110  * the return value. The input properties may be (and are supposed
111  * to be) unfixed. */
112 GstAudioChannelPosition *
113         gst_audio_fixate_channel_positions (GstStructure *str);
114
115 gboolean gst_audio_check_channel_positions (const GstAudioChannelPosition * pos, guint channels);
116
117 G_END_DECLS
118
119 #endif /* __GST_AUDIO_MULTICHANNEL_H__ */