FreeRDP
audio.h
1 
20 #ifndef FREERDP_CODEC_AUDIO_H
21 #define FREERDP_CODEC_AUDIO_H
22 
23 #include <winpr/wlog.h>
24 
25 #include <freerdp/api.h>
26 #include <freerdp/types.h>
27 
28 #ifdef __cplusplus
29 extern "C"
30 {
31 #endif
32 
33  struct AUDIO_FORMAT
34  {
35  UINT16 wFormatTag;
36  UINT16 nChannels;
37  UINT32 nSamplesPerSec;
38  UINT32 nAvgBytesPerSec;
39  UINT16 nBlockAlign;
40  UINT16 wBitsPerSample;
41  UINT16 cbSize;
42  BYTE* data;
43  };
44  typedef struct AUDIO_FORMAT AUDIO_FORMAT;
45 
46 #define SNDC_CLOSE 1
47 #define SNDC_WAVE 2
48 #define SNDC_SETVOLUME 3
49 #define SNDC_SETPITCH 4
50 #define SNDC_WAVECONFIRM 5
51 #define SNDC_TRAINING 6
52 #define SNDC_FORMATS 7
53 #define SNDC_CRYPTKEY 8
54 #define SNDC_WAVEENCRYPT 9
55 #define SNDC_UDPWAVE 10
56 #define SNDC_UDPWAVELAST 11
57 #define SNDC_QUALITYMODE 12
58 #define SNDC_WAVE2 13
59 
60 #define TSSNDCAPS_ALIVE 1
61 #define TSSNDCAPS_VOLUME 2
62 #define TSSNDCAPS_PITCH 4
63 
64 #define DYNAMIC_QUALITY 0x0000
65 #define MEDIUM_QUALITY 0x0001
66 #define HIGH_QUALITY 0x0002
67 
68  /*
69  * Format Tags:
70  * http://tools.ietf.org/html/rfc2361
71  */
72 
73 #ifndef WAVE_FORMAT_UNKNOWN
74 #define WAVE_FORMAT_UNKNOWN 0x0000
75 #endif /* !WAVE_FORMAT_UNKNOWN */
76 
77 #ifndef WAVE_FORMAT_PCM
78 #define WAVE_FORMAT_PCM 0x0001
79 #endif /* !WAVE_FORMAT_PCM */
80 
81 #ifndef WAVE_FORMAT_ADPCM
82 #define WAVE_FORMAT_ADPCM 0x0002
83 #define WAVE_FORMAT_IEEE_FLOAT 0x0003
84 #define WAVE_FORMAT_VSELP 0x0004
85 #define WAVE_FORMAT_IBM_CVSD 0x0005
86 #define WAVE_FORMAT_ALAW 0x0006
87 #define WAVE_FORMAT_MULAW 0x0007
88 #define WAVE_FORMAT_OKI_ADPCM 0x0010
89 #define WAVE_FORMAT_DVI_ADPCM 0x0011
90 #define WAVE_FORMAT_MEDIASPACE_ADPCM 0x0012
91 #define WAVE_FORMAT_SIERRA_ADPCM 0x0013
92 #define WAVE_FORMAT_G723_ADPCM 0x0014
93 #define WAVE_FORMAT_DIGISTD 0x0015
94 #define WAVE_FORMAT_DIGIFIX 0x0016
95 #define WAVE_FORMAT_DIALOGIC_OKI_ADPCM 0x0017
96 #define WAVE_FORMAT_MEDIAVISION_ADPCM 0x0018
97 #define WAVE_FORMAT_CU_CODEC 0x0019
98 #define WAVE_FORMAT_YAMAHA_ADPCM 0x0020
99 #define WAVE_FORMAT_SONARC 0x0021
100 #define WAVE_FORMAT_DSPGROUP_TRUESPEECH 0x0022
101 #define WAVE_FORMAT_ECHOSC1 0x0023
102 #define WAVE_FORMAT_AUDIOFILE_AF36 0x0024
103 #define WAVE_FORMAT_APTX 0x0025
104 #define WAVE_FORMAT_AUDIOFILE_AF10 0x0026
105 #define WAVE_FORMAT_PROSODY_1612 0x0027
106 #define WAVE_FORMAT_LRC 0x0028
107 #define WAVE_FORMAT_DOLBY_AC2 0x0030
108 #define WAVE_FORMAT_GSM610 0x0031
109 #define WAVE_FORMAT_MSNAUDIO 0x0032
110 #define WAVE_FORMAT_ANTEX_ADPCME 0x0033
111 #define WAVE_FORMAT_CONTROL_RES_VQLPC 0x0034
112 #define WAVE_FORMAT_DIGIREAL 0x0035
113 #define WAVE_FORMAT_DIGIADPCM 0x0036
114 #define WAVE_FORMAT_CONTROL_RES_CR10 0x0037
115 #define WAVE_FORMAT_NMS_VBXADPCM 0x0038
116 #define WAVE_FORMAT_ROLAND_RDAC 0x0039
117 #define WAVE_FORMAT_ECHOSC3 0x003A
118 #define WAVE_FORMAT_ROCKWELL_ADPCM 0x003B
119 #define WAVE_FORMAT_ROCKWELL_DIGITALK 0x003C
120 #define WAVE_FORMAT_XEBEC 0x003D
121 #define WAVE_FORMAT_G721_ADPCM 0x0040
122 #define WAVE_FORMAT_G728_CELP 0x0041
123 #define WAVE_FORMAT_MSG723 0x0042
124 #define WAVE_FORMAT_MPEG 0x0050
125 #define WAVE_FORMAT_RT24 0x0052
126 #define WAVE_FORMAT_PAC 0x0053
127 #endif /* !WAVE_FORMAT_ADPCM */
128 
129 #ifndef WAVE_FORMAT_MPEGLAYER3
130 #define WAVE_FORMAT_MPEGLAYER3 0x0055
131 #endif
132 
133 #ifndef WAVE_FORMAT_LUCENT_G723
134 #define WAVE_FORMAT_LUCENT_G723 0x0059
135 #define WAVE_FORMAT_CIRRUS 0x0060
136 #define WAVE_FORMAT_ESPCM 0x0061
137 #define WAVE_FORMAT_VOXWARE 0x0062
138 #define WAVE_FORMAT_CANOPUS_ATRAC 0x0063
139 #define WAVE_FORMAT_G726_ADPCM 0x0064
140 #define WAVE_FORMAT_G722_ADPCM 0x0065
141 #define WAVE_FORMAT_DSAT 0x0066
142 #define WAVE_FORMAT_DSAT_DISPLAY 0x0067
143 #define WAVE_FORMAT_VOXWARE_BYTE_ALIGNED 0x0069
144 #define WAVE_FORMAT_VOXWARE_AC8 0x0070
145 #define WAVE_FORMAT_VOXWARE_AC10 0x0071
146 #define WAVE_FORMAT_VOXWARE_AC16 0x0072
147 #define WAVE_FORMAT_VOXWARE_AC20 0x0073
148 #define WAVE_FORMAT_VOXWARE_RT24 0x0074
149 #define WAVE_FORMAT_VOXWARE_RT29 0x0075
150 #define WAVE_FORMAT_VOXWARE_RT29HW 0x0076
151 #define WAVE_FORMAT_VOXWARE_VR12 0x0077
152 #define WAVE_FORMAT_VOXWARE_VR18 0x0078
153 #define WAVE_FORMAT_VOXWARE_TQ40 0x0079
154 #define WAVE_FORMAT_SOFTSOUND 0x0080
155 #define WAVE_FORMAT_VOXWARE_TQ60 0x0081
156 #define WAVE_FORMAT_MSRT24 0x0082
157 #define WAVE_FORMAT_G729A 0x0083
158 #define WAVE_FORMAT_MVI_MV12 0x0084
159 #define WAVE_FORMAT_DF_G726 0x0085
160 #define WAVE_FORMAT_DF_GSM610 0x0086
161 #define WAVE_FORMAT_ISIAUDIO 0x0088
162 #define WAVE_FORMAT_ONLIVE 0x0089
163 #define WAVE_FORMAT_SBC24 0x0091
164 #define WAVE_FORMAT_DOLBY_AC3_SPDIF 0x0092
165 #define WAVE_FORMAT_ZYXEL_ADPCM 0x0097
166 #define WAVE_FORMAT_PHILIPS_LPCBB 0x0098
167 #define WAVE_FORMAT_PACKED 0x0099
168 #define WAVE_FORMAT_RHETOREX_ADPCM 0x0100
169 #define WAVE_FORMAT_IRAT 0x0101
170 #define WAVE_FORMAT_VIVO_G723 0x0111
171 #define WAVE_FORMAT_VIVO_SIREN 0x0112
172 #define WAVE_FORMAT_DIGITAL_G723 0x0123
173 #define WAVE_FORMAT_WMAUDIO2 0x0161
174 #define WAVE_FORMAT_WMAUDIO3 0x0162
175 #define WAVE_FORMAT_WMAUDIO_LOSSLESS 0x0163
176 #define WAVE_FORMAT_CREATIVE_ADPCM 0x0200
177 #define WAVE_FORMAT_CREATIVE_FASTSPEECH8 0x0202
178 #define WAVE_FORMAT_CREATIVE_FASTSPEECH10 0x0203
179 #define WAVE_FORMAT_QUARTERDECK 0x0220
180 #define WAVE_FORMAT_FM_TOWNS_SND 0x0300
181 #define WAVE_FORMAT_BTV_DIGITAL 0x0400
182 #define WAVE_FORMAT_VME_VMPCM 0x0680
183 #define WAVE_FORMAT_OLIGSM 0x1000
184 #define WAVE_FORMAT_OLIADPCM 0x1001
185 #define WAVE_FORMAT_OLICELP 0x1002
186 #define WAVE_FORMAT_OLISBC 0x1003
187 #define WAVE_FORMAT_OLIOPR 0x1004
188 #define WAVE_FORMAT_LH_CODEC 0x1100
189 #define WAVE_FORMAT_NORRIS 0x1400
190 #define WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS 0x1500
191 #define WAVE_FORMAT_DVM 0x2000
192 #endif /* !WAVE_FORMAT_LUCENT_G723 */
193 
197 #define WAVE_FORMAT_OPUS 0x704F
198 #define WAVE_FORMAT_AAC_MS 0xA106
199 
200 #define WAVE_FORMAT_EXTENSIBLE 0xFFFE
201 
206  FREERDP_API UINT32 audio_format_compute_time_length(const AUDIO_FORMAT* format, size_t size);
207 
208  FREERDP_API const char* audio_format_get_tag_string(UINT16 wFormatTag);
209 
210  FREERDP_API void audio_format_print(wLog* log, DWORD level, const AUDIO_FORMAT* format);
211  FREERDP_API void audio_formats_print(wLog* log, DWORD level, const AUDIO_FORMAT* formats,
212  UINT16 count);
213 
214  FREERDP_API BOOL audio_format_read(wStream* s, AUDIO_FORMAT* format);
215  FREERDP_API BOOL audio_format_write(wStream* s, const AUDIO_FORMAT* format);
216  FREERDP_API BOOL audio_format_copy(const AUDIO_FORMAT* WINPR_RESTRICT srcFormat,
217  AUDIO_FORMAT* WINPR_RESTRICT dstFormat);
218  FREERDP_API BOOL audio_format_compatible(const AUDIO_FORMAT* with, const AUDIO_FORMAT* what);
219 
220  FREERDP_API void audio_format_free(AUDIO_FORMAT* format);
221  FREERDP_API void audio_formats_free(AUDIO_FORMAT* formats, size_t count);
222 
223  WINPR_ATTR_MALLOC(audio_formats_free, 1)
224  FREERDP_API AUDIO_FORMAT* audio_format_new(void);
225 
226  WINPR_ATTR_MALLOC(audio_formats_free, 1)
227  FREERDP_API AUDIO_FORMAT* audio_formats_new(size_t count);
228 
229 #ifdef __cplusplus
230 }
231 #endif
232 
233 #endif /* FREERDP_CODEC_AUDIO_H */