• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 #include "gstvorbiscommon.h"
25 
26 /* http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-800004.3.9 */
27 const GstAudioChannelPosition gst_vorbis_channel_positions[][8] = {
28   {                             /* Mono */
29       GST_AUDIO_CHANNEL_POSITION_MONO},
30   {                             /* Stereo */
31         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
32       GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
33   {                             /* Stereo + Centre */
34         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
35         GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
36       GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
37   {                             /* Quadraphonic */
38         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
39         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
40         GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
41         GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
42       },
43   {                             /* Stereo + Centre + rear stereo */
44         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
45         GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
46         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
47         GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
48         GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
49       },
50   {                             /* Full 5.1 Surround */
51         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
52         GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
53         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
54         GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
55         GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
56         GST_AUDIO_CHANNEL_POSITION_LFE1,
57       },
58   {                             /* 6.1 Surround, in Vorbis spec since 2010-01-13 */
59         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
60         GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
61         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
62         GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
63         GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
64         GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
65       GST_AUDIO_CHANNEL_POSITION_LFE1},
66   {                             /* 7.1 Surround, in Vorbis spec since 2010-01-13 */
67         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
68         GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
69         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
70         GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
71         GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
72         GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
73         GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
74       GST_AUDIO_CHANNEL_POSITION_LFE1},
75 };
76 
77 const GstAudioChannelPosition gst_vorbis_default_channel_positions[][8] = {
78   {                             /* Mono */
79       GST_AUDIO_CHANNEL_POSITION_MONO},
80   {                             /* Stereo */
81         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
82       GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
83   {                             /* Stereo + Centre */
84         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
85         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
86       GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER},
87   {                             /* Quadraphonic */
88         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
89         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
90         GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
91         GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
92       },
93   {                             /* Stereo + Centre + rear stereo */
94         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
95         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
96         GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
97         GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
98         GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
99       },
100   {                             /* Full 5.1 Surround */
101         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
102         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
103         GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
104         GST_AUDIO_CHANNEL_POSITION_LFE1,
105         GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
106         GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
107       },
108   {                             /* 6.1 Surround, in Vorbis spec since 2010-01-13 */
109         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
110         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
111         GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
112         GST_AUDIO_CHANNEL_POSITION_LFE1,
113         GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
114         GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
115         GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
116       },
117   {                             /* 7.1 Surround, in Vorbis spec since 2010-01-13 */
118         GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
119         GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
120         GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
121         GST_AUDIO_CHANNEL_POSITION_LFE1,
122         GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
123         GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
124         GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
125         GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
126       },
127 };
128 
129 #ifndef USE_TREMOLO
130 /* gst[i] = vorbis[reorder_map[i]] */
131 const gint gst_vorbis_reorder_map[][8] = {
132   {0},
133   {0, 1},
134   {0, 2, 1},
135   {0, 1, 2, 3},
136   {0, 2, 1, 3, 4},
137   {0, 2, 1, 5, 3, 4},
138   {0, 2, 1, 6, 5, 3, 4},
139   {0, 2, 1, 7, 5, 6, 3, 4}
140 };
141 #endif
142