pulling trunk
[ardour.git] / libs / libsndfile / src / wav_w64.h
1 /*
2 ** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
3 **
4 ** This program is free software; you can redistribute it and/or modify
5 ** it under the terms of the GNU Lesser General Public License as published by
6 ** the Free Software Foundation; either version 2.1 of the License, or
7 ** (at your option) any later version.
8 **
9 ** This program 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
12 ** GNU Lesser General Public License for more details.
13 **
14 ** You should have received a copy of the GNU Lesser General Public License
15 ** along with this program; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 /* This file contains definitions commong to WAV and W64 files. */
20
21
22 #ifndef WAV_W64_H_INCLUDED
23 #define WAV_W64_H_INCLUDED
24
25 /*------------------------------------------------------------------------------
26 ** List of known WAV format tags
27 */
28
29 enum
30 {
31   /* keep sorted for wav_w64_format_str() */
32         WAVE_FORMAT_UNKNOWN                                     = 0x0000,               /* Microsoft Corporation */
33         WAVE_FORMAT_PCM                                         = 0x0001,               /* Microsoft PCM format */
34         WAVE_FORMAT_MS_ADPCM                            = 0x0002,               /* Microsoft ADPCM */
35         WAVE_FORMAT_IEEE_FLOAT                          = 0x0003,               /* Micrososft 32 bit float format */
36         WAVE_FORMAT_VSELP                                       = 0x0004,               /* Compaq Computer Corporation */
37         WAVE_FORMAT_IBM_CVSD                            = 0x0005,               /* IBM Corporation */
38         WAVE_FORMAT_ALAW                                        = 0x0006,               /* Microsoft Corporation */
39         WAVE_FORMAT_MULAW                                       = 0x0007,               /* Microsoft Corporation */
40         WAVE_FORMAT_OKI_ADPCM                           = 0x0010,               /* OKI */
41         WAVE_FORMAT_IMA_ADPCM                           = 0x0011,               /* Intel Corporation */
42         WAVE_FORMAT_MEDIASPACE_ADPCM            = 0x0012,               /* Videologic */
43         WAVE_FORMAT_SIERRA_ADPCM                        = 0x0013,               /* Sierra Semiconductor Corp */
44         WAVE_FORMAT_G723_ADPCM                          = 0x0014,               /* Antex Electronics Corporation */
45         WAVE_FORMAT_DIGISTD                                     = 0x0015,               /* DSP Solutions, Inc. */
46         WAVE_FORMAT_DIGIFIX                                     = 0x0016,               /* DSP Solutions, Inc. */
47         WAVE_FORMAT_DIALOGIC_OKI_ADPCM          = 0x0017,               /*  Dialogic Corporation  */
48         WAVE_FORMAT_MEDIAVISION_ADPCM           = 0x0018,               /*  Media Vision, Inc. */
49         WAVE_FORMAT_CU_CODEC                            = 0x0019,               /* Hewlett-Packard Company */
50         WAVE_FORMAT_YAMAHA_ADPCM                        = 0x0020,               /* Yamaha Corporation of America */
51         WAVE_FORMAT_SONARC                                      = 0x0021,               /* Speech Compression */
52         WAVE_FORMAT_DSPGROUP_TRUESPEECH         = 0x0022,               /* DSP Group, Inc */
53         WAVE_FORMAT_ECHOSC1                                     = 0x0023,               /* Echo Speech Corporation */
54         WAVE_FORMAT_AUDIOFILE_AF36                      = 0x0024,               /* Audiofile, Inc. */
55         WAVE_FORMAT_APTX                                        = 0x0025,               /* Audio Processing Technology */
56         WAVE_FORMAT_AUDIOFILE_AF10                      = 0x0026,               /* Audiofile, Inc. */
57         WAVE_FORMAT_PROSODY_1612                        = 0x0027,               /* Aculab plc */
58         WAVE_FORMAT_LRC                                         = 0x0028,               /* Merging Technologies S.A. */
59         WAVE_FORMAT_DOLBY_AC2                           = 0x0030,               /* Dolby Laboratories */
60         WAVE_FORMAT_GSM610                                      = 0x0031,               /* Microsoft Corporation */
61         WAVE_FORMAT_MSNAUDIO                            = 0x0032,               /* Microsoft Corporation */
62         WAVE_FORMAT_ANTEX_ADPCME                        = 0x0033,               /* Antex Electronics Corporation */
63         WAVE_FORMAT_CONTROL_RES_VQLPC           = 0x0034,               /* Control Resources Limited */
64         WAVE_FORMAT_DIGIREAL                            = 0x0035,               /* DSP Solutions, Inc. */
65         WAVE_FORMAT_DIGIADPCM                           = 0x0036,               /* DSP Solutions, Inc. */
66         WAVE_FORMAT_CONTROL_RES_CR10            = 0x0037,               /* Control Resources Limited */
67         WAVE_FORMAT_NMS_VBXADPCM                        = 0x0038,               /* Natural MicroSystems */
68         WAVE_FORMAT_ROLAND_RDAC                         = 0x0039,               /* Roland */
69         WAVE_FORMAT_ECHOSC3                                     = 0x003A,               /* Echo Speech Corporation */
70         WAVE_FORMAT_ROCKWELL_ADPCM                      = 0x003B,               /* Rockwell International */
71         WAVE_FORMAT_ROCKWELL_DIGITALK           = 0x003C,               /* Rockwell International */
72         WAVE_FORMAT_XEBEC                                       = 0x003D,               /* Xebec Multimedia Solutions Limited */
73         WAVE_FORMAT_G721_ADPCM                          = 0x0040,               /* Antex Electronics Corporation */
74         WAVE_FORMAT_G728_CELP                           = 0x0041,               /* Antex Electronics Corporation */
75         WAVE_FORMAT_MSG723                                      = 0x0042,               /* Microsoft Corporation */
76         WAVE_FORMAT_MPEG                                        = 0x0050,               /* Microsoft Corporation */
77         WAVE_FORMAT_RT24                                        = 0x0052,               /* InSoft Inc. */
78         WAVE_FORMAT_PAC                                         = 0x0053,               /* InSoft Inc. */
79         WAVE_FORMAT_MPEGLAYER3                          = 0x0055,               /* MPEG 3 Layer 1 */
80         WAVE_FORMAT_LUCENT_G723                         = 0x0059,               /* Lucent Technologies */
81         WAVE_FORMAT_CIRRUS                                      = 0x0060,               /* Cirrus Logic */
82         WAVE_FORMAT_ESPCM                                       = 0x0061,               /* ESS Technology */
83         WAVE_FORMAT_VOXWARE                                     = 0x0062,               /* Voxware Inc */
84         WAVE_FORMAT_CANOPUS_ATRAC                       = 0x0063,               /* Canopus, Co., Ltd. */
85         WAVE_FORMAT_G726_ADPCM                          = 0x0064,               /* APICOM */
86         WAVE_FORMAT_G722_ADPCM                          = 0x0065,               /* APICOM */
87         WAVE_FORMAT_DSAT                                        = 0x0066,               /* Microsoft Corporation */
88         WAVE_FORMAT_DSAT_DISPLAY                        = 0x0067,               /* Microsoft Corporation */
89         WAVE_FORMAT_VOXWARE_BYTE_ALIGNED        = 0x0069,               /* Voxware Inc. */
90         WAVE_FORMAT_VOXWARE_AC8                         = 0x0070,               /* Voxware Inc. */
91         WAVE_FORMAT_VOXWARE_AC10                        = 0x0071,               /* Voxware Inc. */
92         WAVE_FORMAT_VOXWARE_AC16                        = 0x0072,               /* Voxware Inc. */
93         WAVE_FORMAT_VOXWARE_AC20                        = 0x0073,               /* Voxware Inc. */
94         WAVE_FORMAT_VOXWARE_RT24                        = 0x0074,               /* Voxware Inc. */
95         WAVE_FORMAT_VOXWARE_RT29                        = 0x0075,               /* Voxware Inc. */
96         WAVE_FORMAT_VOXWARE_RT29HW                      = 0x0076,               /* Voxware Inc. */
97         WAVE_FORMAT_VOXWARE_VR12                        = 0x0077,               /* Voxware Inc. */
98         WAVE_FORMAT_VOXWARE_VR18                        = 0x0078,               /* Voxware Inc. */
99         WAVE_FORMAT_VOXWARE_TQ40                        = 0x0079,               /* Voxware Inc. */
100         WAVE_FORMAT_SOFTSOUND                           = 0x0080,               /* Softsound, Ltd. */
101         WAVE_FORMAT_VOXARE_TQ60                         = 0x0081,               /* Voxware Inc. */
102         WAVE_FORMAT_MSRT24                                      = 0x0082,               /* Microsoft Corporation */
103         WAVE_FORMAT_G729A                                       = 0x0083,               /* AT&T Laboratories */
104         WAVE_FORMAT_MVI_MV12                            = 0x0084,               /* Motion Pixels */
105         WAVE_FORMAT_DF_G726                                     = 0x0085,               /* DataFusion Systems (Pty) (Ltd) */
106         WAVE_FORMAT_DF_GSM610                           = 0x0086,               /* DataFusion Systems (Pty) (Ltd) */
107         /* removed because duplicate */
108         /* WAVE_FORMAT_ISIAUDIO                         = 0x0088, */    /* Iterated Systems, Inc. */
109         WAVE_FORMAT_ONLIVE                                      = 0x0089,               /* OnLive! Technologies, Inc. */
110         WAVE_FORMAT_SBC24                                       = 0x0091,               /* Siemens Business Communications Systems */
111         WAVE_FORMAT_DOLBY_AC3_SPDIF                     = 0x0092,               /* Sonic Foundry */
112         WAVE_FORMAT_ZYXEL_ADPCM                         = 0x0097,               /* ZyXEL Communications, Inc. */
113         WAVE_FORMAT_PHILIPS_LPCBB                       = 0x0098,               /* Philips Speech Processing */
114         WAVE_FORMAT_PACKED                                      = 0x0099,               /* Studer Professional Audio AG */
115         WAVE_FORMAT_RHETOREX_ADPCM                      = 0x0100,               /* Rhetorex, Inc. */
116
117         /* removed because of the following */
118         /* WAVE_FORMAT_IRAT                                     = 0x0101,*/             /* BeCubed Software Inc. */
119
120         /* these three are unofficial */
121         IBM_FORMAT_MULAW                                        = 0x0101,               /* IBM mu-law format */
122         IBM_FORMAT_ALAW                                         = 0x0102,               /* IBM a-law format */
123         IBM_FORMAT_ADPCM                                        = 0x0103,               /* IBM AVC Adaptive Differential PCM format */
124
125         WAVE_FORMAT_VIVO_G723                           = 0x0111,               /* Vivo Software */
126         WAVE_FORMAT_VIVO_SIREN                          = 0x0112,               /* Vivo Software */
127         WAVE_FORMAT_DIGITAL_G723                        = 0x0123,               /* Digital Equipment Corporation */
128         WAVE_FORMAT_CREATIVE_ADPCM                      = 0x0200,               /* Creative Labs, Inc */
129         WAVE_FORMAT_CREATIVE_FASTSPEECH8        = 0x0202,               /* Creative Labs, Inc */
130         WAVE_FORMAT_CREATIVE_FASTSPEECH10       = 0x0203,               /* Creative Labs, Inc */
131         WAVE_FORMAT_QUARTERDECK                         = 0x0220,               /* Quarterdeck Corporation */
132         WAVE_FORMAT_FM_TOWNS_SND                        = 0x0300,               /* Fujitsu Corporation */
133         WAVE_FORMAT_BZV_DIGITAL                         = 0x0400,               /* Brooktree Corporation */
134         WAVE_FORMAT_VME_VMPCM                           = 0x0680,               /* AT&T Labs, Inc. */
135         WAVE_FORMAT_OLIGSM                                      = 0x1000,               /* Ing C. Olivetti & C., S.p.A. */
136         WAVE_FORMAT_OLIADPCM                            = 0x1001,               /* Ing C. Olivetti & C., S.p.A. */
137         WAVE_FORMAT_OLICELP                                     = 0x1002,               /* Ing C. Olivetti & C., S.p.A. */
138         WAVE_FORMAT_OLISBC                                      = 0x1003,               /* Ing C. Olivetti & C., S.p.A. */
139         WAVE_FORMAT_OLIOPR                                      = 0x1004,               /* Ing C. Olivetti & C., S.p.A. */
140         WAVE_FORMAT_LH_CODEC                            = 0x1100,               /* Lernout & Hauspie */
141         WAVE_FORMAT_NORRIS                                      = 0x1400,               /* Norris Communications, Inc. */
142         /* removed because duplicate */
143         /* WAVE_FORMAT_ISIAUDIO                         = 0x1401, */    /* AT&T Labs, Inc. */
144         WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS     = 0x1500,               /* AT&T Labs, Inc. */
145         WAVE_FORMAT_DVM                                         = 0x2000,               /* FAST Multimedia AG */
146         WAVE_FORMAT_INTERWAV_VSC112                     = 0x7150,               /* ????? */
147         WAVE_FORMAT_EXTENSIBLE                          = 0xFFFE
148 } ;
149
150 typedef struct
151 {       unsigned short  format ;
152         unsigned short  channels ;
153         unsigned int    samplerate ;
154         unsigned int    bytespersec ;
155         unsigned short  blockalign ;
156         unsigned short  bitwidth ;
157 } MIN_WAV_FMT ;
158
159 typedef struct
160 {       unsigned short  format ;
161         unsigned short  channels ;
162         unsigned int    samplerate ;
163         unsigned int    bytespersec ;
164         unsigned short  blockalign ;
165         unsigned short  bitwidth ;
166         unsigned short  extrabytes ;
167         unsigned short  dummy ;
168 } WAV_FMT_SIZE20 ;
169
170 typedef struct
171 {       unsigned short  format ;
172         unsigned short  channels ;
173         unsigned int    samplerate ;
174         unsigned int    bytespersec ;
175         unsigned short  blockalign ;
176         unsigned short  bitwidth ;
177         unsigned short  extrabytes ;
178         unsigned short  samplesperblock ;
179         unsigned short  numcoeffs ;
180         struct
181         {       short   coeff1 ;
182                 short   coeff2 ;
183         }       coeffs [7] ;
184 } MS_ADPCM_WAV_FMT ;
185
186 typedef struct
187 {       unsigned short  format ;
188         unsigned short  channels ;
189         unsigned int    samplerate ;
190         unsigned int    bytespersec ;
191         unsigned short  blockalign ;
192         unsigned short  bitwidth ;
193         unsigned short  extrabytes ;
194         unsigned short  samplesperblock ;
195 } IMA_ADPCM_WAV_FMT ;
196
197 typedef struct
198 {       unsigned short  format ;
199         unsigned short  channels ;
200         unsigned int    samplerate ;
201         unsigned int    bytespersec ;
202         unsigned short  blockalign ;
203         unsigned short  bitwidth ;
204         unsigned short  extrabytes ;
205         unsigned short  auxblocksize ;
206 } G72x_ADPCM_WAV_FMT ;
207
208
209 typedef struct
210 {       unsigned short  format ;
211         unsigned short  channels ;
212         unsigned int    samplerate ;
213         unsigned int    bytespersec ;
214         unsigned short  blockalign ;
215         unsigned short  bitwidth ;
216         unsigned short  extrabytes ;
217         unsigned short  samplesperblock ;
218 } GSM610_WAV_FMT ;
219
220 typedef struct
221 {       unsigned int    esf_field1 ;
222         unsigned short  esf_field2 ;
223         unsigned short  esf_field3 ;
224         char                    esf_field4 [8] ;
225 } EXT_SUBFORMAT ;
226
227 typedef struct
228 {       unsigned short  format ;
229         unsigned short  channels ;
230         unsigned int    samplerate ;
231         unsigned int    bytespersec ;
232         unsigned short  blockalign ;
233         unsigned short  bitwidth ;
234         unsigned short  extrabytes ;
235         unsigned short  validbits ;
236         unsigned int    channelmask ;
237         EXT_SUBFORMAT   esf ;
238 } EXTENSIBLE_WAV_FMT ;
239
240 typedef union
241 {       unsigned short          format ;
242         MIN_WAV_FMT                     min ;
243         IMA_ADPCM_WAV_FMT       ima ;
244         MS_ADPCM_WAV_FMT        msadpcm ;
245         G72x_ADPCM_WAV_FMT      g72x ;
246         EXTENSIBLE_WAV_FMT      ext ;
247         GSM610_WAV_FMT          gsm610 ;
248         WAV_FMT_SIZE20          size20 ;
249         char                            padding [512] ;
250 } WAV_FMT ;
251
252 typedef struct
253 {       int frames ;
254 } FACT_CHUNK ;
255
256 #define         WAV_W64_GSM610_BLOCKSIZE        65
257 #define         WAV_W64_GSM610_SAMPLES          320
258
259 /*------------------------------------------------------------------------------------
260 **      Functions defined in wav_ms_adpcm.c
261 */
262
263 #define MSADPCM_ADAPT_COEFF_COUNT       7
264
265 void    msadpcm_write_adapt_coeffs (SF_PRIVATE *psf) ;
266
267 /*------------------------------------------------------------------------------------
268 **      Functions defined in wav_w64.c
269 */
270
271 int     wav_w64_srate2blocksize (int srate_chan_product) ;
272 char const* wav_w64_format_str (int k) ;
273 int             wav_w64_read_fmt_chunk (SF_PRIVATE *psf, WAV_FMT *wav_fmt, int structsize) ;
274 void    wavex_write_guid (SF_PRIVATE *psf, const EXT_SUBFORMAT * subformat) ;
275
276 #endif
277 /*
278 ** Do not edit or modify anything in this comment block.
279 ** The arch-tag line is a file identity tag for the GNU Arch 
280 ** revision control system.
281 **
282 ** arch-tag: 877fde12-9be3-4a31-8a5a-fdae39958613
283 */