]> git.sesse.net Git - vlc/blob - modules/audio_output/windows_audio_common.h
mux/mpeg/ts.c: support for libdvbpsi >= 1.0.0
[vlc] / modules / audio_output / windows_audio_common.h
1 /*****************************************************************************
2  * windows_audio_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 it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software Foundation,
22  * 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 #include <dsound.h>
75
76 #ifndef SPEAKER_FRONT_LEFT
77 #   define SPEAKER_FRONT_LEFT             0x1
78 #   define SPEAKER_FRONT_RIGHT            0x2
79 #   define SPEAKER_FRONT_CENTER           0x4
80 #   define SPEAKER_LOW_FREQUENCY          0x8
81 #   define SPEAKER_BACK_LEFT              0x10
82 #   define SPEAKER_BACK_RIGHT             0x20
83 #   define SPEAKER_FRONT_LEFT_OF_CENTER   0x40
84 #   define SPEAKER_FRONT_RIGHT_OF_CENTER  0x80
85 #   define SPEAKER_BACK_CENTER            0x100
86 #   define SPEAKER_SIDE_LEFT              0x200
87 #   define SPEAKER_SIDE_RIGHT             0x400
88 #   define SPEAKER_TOP_CENTER             0x800
89 #   define SPEAKER_TOP_FRONT_LEFT         0x1000
90 #   define SPEAKER_TOP_FRONT_CENTER       0x2000
91 #   define SPEAKER_TOP_FRONT_RIGHT        0x4000
92 #   define SPEAKER_TOP_BACK_LEFT          0x8000
93 #   define SPEAKER_TOP_BACK_CENTER        0x10000
94 #   define SPEAKER_TOP_BACK_RIGHT         0x20000
95 #   define SPEAKER_RESERVED               0x80000000
96 #endif
97
98 #ifndef DSSPEAKER_DSSPEAKER_DIRECTOUT
99 #   define DSSPEAKER_DSSPEAKER_DIRECTOUT  0x00000000
100 #endif
101 #ifndef DSSPEAKER_HEADPHONE
102 #   define DSSPEAKER_HEADPHONE            0x00000001
103 #endif
104 #ifndef DSSPEAKER_MONO
105 #   define DSSPEAKER_MONO                 0x00000002
106 #endif
107 #ifndef DSSPEAKER_QUAD
108 #   define DSSPEAKER_QUAD                 0x00000003
109 #endif
110 #ifndef DSSPEAKER_STEREO
111 #   define DSSPEAKER_STEREO               0x00000004
112 #endif
113 #ifndef DSSPEAKER_SURROUND
114 #   define DSSPEAKER_SURROUND             0x00000005
115 #endif
116 #ifndef DSSPEAKER_5POINT1
117 #   define DSSPEAKER_5POINT1              0x00000006
118 #endif
119 #ifndef DSSPEAKER_5POINT1_BACK
120 #   define DSSPEAKER_5POINT1_BACK         DSSPEAKER_5POINT1
121 #endif
122 #ifndef DSSPEAKER_7POINT1
123 #   define DSSPEAKER_7POINT1              0x00000007
124 #endif
125 #ifndef DSSPEAKER_7POINT1_SURROUND
126 #   define DSSPEAKER_7POINT1_SURROUND     0x00000008
127 #endif
128 #ifndef DSSPEAKER_5POINT1_SURROUND
129 #   define DSSPEAKER_5POINT1_SURROUND     0x00000009
130 #endif
131 #ifndef DSSPEAKER_7POINT1_WIDE
132 #   define DSSPEAKER_7POINT1_WIDE         DSSPEAKER_7POINT1
133 #endif
134
135 static const uint32_t pi_channels_in[] =
136     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
137       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT,
138       SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT, SPEAKER_BACK_CENTER,
139       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY, 0 };
140 static const uint32_t pi_channels_out[] =
141     { SPEAKER_FRONT_LEFT, SPEAKER_FRONT_RIGHT,
142       SPEAKER_FRONT_CENTER, SPEAKER_LOW_FREQUENCY,
143       SPEAKER_BACK_LEFT, SPEAKER_BACK_RIGHT,
144       SPEAKER_BACK_CENTER,
145       SPEAKER_SIDE_LEFT, SPEAKER_SIDE_RIGHT, 0 };
146
147 #define FLOAT_TEXT N_("Use float32 output")
148 #define FLOAT_LONGTEXT N_( \
149     "The option allows you to enable or disable the high-quality float32 " \
150     "audio output mode (which is not well supported by some soundcards)." )
151