]> git.sesse.net Git - vlc/blob - modules/audio_output/windows_audio_common.h
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / audio_output / windows_audio_common.h
1 /*****************************************************************************
2  * windows_common.h: Windows Audio common code
3  *****************************************************************************
4  * Copyright (C) 2001-2009 VideoLAN
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #include <windows.h>
26 #include <mmsystem.h>
27
28 /*****************************************************************************
29  * DirectSound GUIDs.
30  * Defining them here allows us to get rid of the dxguid library during
31  * the linking stage.
32  *****************************************************************************/
33
34 #define INITGUID /* Doesn't define the DEFINE_GUID as extern */
35 #include <initguid.h>
36
37 #ifndef WAVE_FORMAT_IEEE_FLOAT
38 #   define WAVE_FORMAT_IEEE_FLOAT 0x0003
39 #endif
40
41 #ifndef WAVE_FORMAT_DOLBY_AC3_SPDIF
42 #   define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092
43 #endif
44
45 #ifndef WAVE_FORMAT_EXTENSIBLE
46 #define  WAVE_FORMAT_EXTENSIBLE   0xFFFE
47 #endif
48
49 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
50 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_PCM, WAVE_FORMAT_PCM, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
51 DEFINE_GUID( _KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF, WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 );
52
53 static const GUID __KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = {WAVE_FORMAT_IEEE_FLOAT, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
54 static const GUID __KSDATAFORMAT_SUBTYPE_PCM = {WAVE_FORMAT_PCM, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
55 static const GUID __KSDATAFORMAT_SUBTYPE_DOLBY_AC3_SPDIF = {WAVE_FORMAT_DOLBY_AC3_SPDIF, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
56
57
58 #define FRAMES_NUM 8                                      /* Needs to be > 3 */
59
60 #ifndef _WAVEFORMATEXTENSIBLE_
61 typedef struct {
62     WAVEFORMATEX    Format;
63     union {
64         WORD wValidBitsPerSample;       /* bits of precision  */
65         WORD wSamplesPerBlock;          /* valid if wBitsPerSample==0 */
66         WORD wReserved;                 /* If neither applies, set to zero. */
67     } Samples;
68     DWORD           dwChannelMask;      /* which channels are */
69                                         /* present in stream  */
70     GUID            SubFormat;
71 } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
72 #endif
73
74
75 #ifndef SPEAKER_FRONT_LEFT
76 #   define SPEAKER_FRONT_LEFT             0x1
77 #   define SPEAKER_FRONT_RIGHT            0x2
78 #   define SPEAKER_FRONT_CENTER           0x4
79 #   define SPEAKER_LOW_FREQUENCY          0x8
80 #   define SPEAKER_BACK_LEFT              0x10
81 #   define SPEAKER_BACK_RIGHT             0x20
82 #   define SPEAKER_FRONT_LEFT_OF_CENTER   0x40
83 #   define SPEAKER_FRONT_RIGHT_OF_CENTER  0x80
84 #   define SPEAKER_BACK_CENTER            0x100
85 #   define SPEAKER_SIDE_LEFT              0x200
86 #   define SPEAKER_SIDE_RIGHT             0x400
87 #   define SPEAKER_TOP_CENTER             0x800
88 #   define SPEAKER_TOP_FRONT_LEFT         0x1000
89 #   define SPEAKER_TOP_FRONT_CENTER       0x2000
90 #   define SPEAKER_TOP_FRONT_RIGHT        0x4000
91 #   define SPEAKER_TOP_BACK_LEFT          0x8000
92 #   define SPEAKER_TOP_BACK_CENTER        0x10000
93 #   define SPEAKER_TOP_BACK_RIGHT         0x20000
94 #   define SPEAKER_RESERVED               0x80000000
95 #endif
96
97 #ifndef DSSPEAKER_DSSPEAKER_DIRECTOUT
98 #   define DSSPEAKER_DSSPEAKER_DIRECTOUT         0x00000000
99 #endif
100 #ifndef DSSPEAKER_HEADPHONE
101 #   define DSSPEAKER_HEADPHONE         0x00000001
102 #endif
103 #ifndef DSSPEAKER_MONO
104 #   define DSSPEAKER_MONO              0x00000002
105 #endif
106 #ifndef DSSPEAKER_QUAD
107 #   define DSSPEAKER_QUAD              0x00000003
108 #endif
109 #ifndef DSSPEAKER_STEREO
110 #   define DSSPEAKER_STEREO            0x00000004
111 #endif
112 #ifndef DSSPEAKER_SURROUND
113 #   define DSSPEAKER_SURROUND          0x00000005
114 #endif
115 #ifndef DSSPEAKER_5POINT1
116 #   define DSSPEAKER_5POINT1           0x00000006
117 #endif
118 #ifndef DSSPEAKER_7POINT1
119 #   define DSSPEAKER_7POINT1           0x00000007
120 #endif
121 #ifndef DSSPEAKER_7POINT1_SURROUND
122 #   define DSSPEAKER_7POINT1_SURROUND           0x00000008
123 #endif
124 #ifndef DSSPEAKER_7POINT1_WIDE
125 #   define DSSPEAKER_7POINT1_WIDE           DSSPEAKER_7POINT1
126 #endif
127
128 static const uint32_t pi_channels_src[] =
129     { AOUT_CHAN_LEFT, AOUT_CHAN_RIGHT,
130       AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT,
131       AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REARCENTER,
132       AOUT_CHAN_CENTER, AOUT_CHAN_LFE, 0 };
133 static const uint32_t pi_channels_in[] =
134     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
135       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT,
136       SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
137       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0 };
138 static const uint32_t pi_channels_out[] =
139     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
140       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY,
141       SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
142       SPEAKER_BACK_CENTER,
143       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0 };
144
145 #define FLOAT_TEXT N_("Use float32 output")
146 #define FLOAT_LONGTEXT N_( \
147     "The option allows you to enable or disable the high-quality float32 " \
148     "audio output mode (which is not well supported by some soundcards)." )
149