Debian Codegraph @

lib/common/wave_type.c

raw
1 #include "utils.h"
2 #include "formats.h"
3 #include <string.h>
4 #include <stdio.h>
5
6 const char* avm_wave_format_name(short fmt)
7 {
8 unsigned i;
9 const struct s_t {
10 fourcc_t format;
11 const char* name;
12 } const formats[] = {
13 { 0x0000, "Microsoft Unknown Wave Format" },
14 { WAVE_FORMAT_PCM, "Microsoft PCM" },
15 { WAVE_FORMAT_ADPCM, "Microsoft ADPCM" },
16 { WAVE_FORMAT_IEEE_FLOAT, "IEEE Float" },
17 { WAVE_FORMAT_VSELP, "Compaq Computer VSELP Ima-0ADPCM" },
18 { WAVE_FORMAT_IBM_CVSD, "IBM CVSD" },
19 { WAVE_FORMAT_ALAW, "Microsoft ALAW (CCITT A-Law)" },
20 { WAVE_FORMAT_MULAW, "Microsoft MULAW (CCITT u-Law)" },
21 { WAVE_FORMAT_DVI_ADPCM, "DVI ADPCM" },
22 { WAVE_FORMAT_GSM610, "MS GSM 6.10" },
23 { WAVE_FORMAT_MSNAUDIO, "MSN Audio" },
24 { WAVE_FORMAT_MPEG, "MPEG Layer-1/2" },
25 { WAVE_FORMAT_MPEGLAYER3, "MPEG Layer-3" },
26 { WAVE_FORMAT_VOXWARE_BYTE_ALIGNED, },
27 { WAVE_FORMAT_VOXWARE_AC8, },
28 { WAVE_FORMAT_VOXWARE_AC10, },
29 { WAVE_FORMAT_VOXWARE_AC16, },
30 { WAVE_FORMAT_VOXWARE_RT24, },
31 { WAVE_FORMAT_VOXWARE_RT29HW, },
32 { WAVE_FORMAT_VOXWARE_VR12, },
33 { WAVE_FORMAT_VOXWARE_VR18, },
34 { WAVE_FORMAT_VOXWARE_RT29, "Voxware Metasound" },
35 { WAVE_FORMAT_SIPROLAB_ACELP4800, },
36 { WAVE_FORMAT_SIPROLAB_ACELP8V3, },
37 { WAVE_FORMAT_SIPROLAB_G729, },
38 { WAVE_FORMAT_SIPROLAB_G729A, },
39 { WAVE_FORMAT_SIPROLAB_KELVIN, },
40 { WAVE_FORMAT_SIPROLAB_ACEPLNET, "ACELP.net" },
41 { WAVE_FORMAT_MSAUDIO1, "WMA v1" },
42 { 0x0161, "WMA v2" },
43 { 0x0162, "WMA v3" },
44 { 0x0401, "Intel Music Coder" },
45 { 0x181c, "VoxWare RT24 Speech codec" },
46 { 0x1fc4, "ALF2" },
47 { WAVE_FORMAT_DVM, "AC3 DVM" },
48 { WAVE_FORMAT_EXTENSIBLE, "Extended" }
49 };
50
51 for (i = 0; i < (sizeof(formats)/sizeof(formats[0])); ++i)
52 if (fmt == formats[i].format) {
53 if (formats[i].name != 0)
54 return formats[i].name;
55 fmt = formats[i + 1].format; // use next string
56 }
57 return "unknown?";
58
59 #if 0
60 * 0x0008 Microsoft DTS
61 * 0x0009 Microsoft DRM
62 * 0x0010 OKI ADPCM
63 * 0x0011 Intel DVI ADPCM (IMA ADPCM)
64 * 0x0012 Videologic MediaSpace ADPCM
65 * 0x0013 Sierra Semiconductor ADPCM
66 * 0x0014 Antex Electronics G.723 ADPCM
67 * 0x0015 DSP Solutions DigiSTD
68 * 0x0016 DSP Solutions DigiFIX
69 * 0x0017 Dialogic OKI ADPCM
70 * 0x0018 MediaVision ADPCM
71 * 0x0019 Hewlett-Packard CU codec
72 * 0x0020 Yamaha ADPCM
73 * 0x0021 Speech Compression SONARC
74 * 0x0022 DSP Group True Speech
75 * 0x0023 Echo Speech EchoSC1
76 * 0x0024 Audiofile AF36
77 * 0x0025 Audio Processing Technology APTX
78 * 0x0026 AudioFile AF10
79 * 0x0027 Prosody 1612 codec for CTI Speech Card
80 * 0x0028 Merging Technologies S.A. LRC
81 * 0x0030 Dolby Labs AC2
82 * 0x0031 Microsoft GSM 6.10
83 * 0x0032 MSNAudio
84 * 0x0033 Antex Electronics ADPCME
85 * 0x0034 Control Resources VQLPC
86 * 0x0035 DSP Solutions DigiREAL
87 * 0x0036 DSP Solutions DigiADPCM
88 * 0x0037 Control Resources CR10
89 * 0x0038 Natural MicroSystems VBXADPCM
90 * 0x0039 Roland RDAC (Crystal Semiconductor IMA ADPCM)
91 * 0x003A Echo Speech EchoSC3
92 * 0x003B Rockwell ADPCM
93 * 0x003C Rockwell Digit LK
94 * 0x003D Xebec Multimedia Solutions
95 * 0x0040 Antex Electronics G.721 ADPCM
96 * 0x0041 Antex Electronics G.728 CELP
97 * 0x0042 Microsoft MSG723
98 * 0x0043 IBM AVC ADPCM
99 * 0x0045 ITU-T G.726 ADPCM
100 * 0x0050 MPEG-1 layer 1, 2
101 * 0x0052 InSoft RT24 (ACM codec is an alternative codec)
102 * 0x0053 InSoft PAC
103 * 0x0055 MPEG-1 Layer 3 (MP3)
104 * 0x0059 Lucent G.723
105 * 0x0060 Cirrus Logic
106 * 0x0061 ESS Technology ESPCM / Duck DK4 ADPCM
107 * 0x0062 Voxware file-mode codec / Duck DK3 ADPCM
108 * 0x0063 Canopus Atrac
109 * 0x0064 APICOM G.726 ADPCM
110 * 0x0065 APICOM G.722 ADPCM
111 * 0x0066 Microsoft DSAT
112 * 0x0067 Microsoft DSAT Display
113 * 0x0069 Voxware Byte Aligned (bitstream-mode codec)
114 * 0x0070 Voxware AC8 (Lernout & Hauspie CELP 4.8 kbps)
115 * 0x0071 Voxware AC10 (Lernout & Hauspie CBS 8kbps)
116 * 0x0072 Voxware AC16 (Lernout & Hauspie CBS 12kbps)
117 * 0x0073 Voxware AC20 (Lernout & Hauspie CBS 16kbps)
118 * 0x0074 Voxware MetaVoice (file and stream oriented)
119 * 0x0075 Voxware MetaSound (file and stream oriented)
120 * 0x0076 Voxware RT29HW
121 * 0x0077 Voxware VR12
122 * 0x0078 Voxware VR18
123 * 0x0079 Voxware TQ40
124 * 0x0080 Softsound
125 * 0x0081 Voxware TQ60
126 * 0x0082 Microsoft MSRT24 (ACM codec is an alternative codec)
127 * 0x0083 AT&T Labs G.729A
128 * 0x0084 Motion Pixels MVI MV12
129 * 0x0085 DataFusion Systems G.726
130 * 0x0086 DataFusion Systems GSM610
131 * 0x0088 Iterated Systems ISIAudio
132 * 0x0089 Onlive
133 * 0x0091 Siemens Business Communications SBC24
134 * 0x0092 Sonic Foundry Dolby AC3 SPDIF
135 * 0x0093 MediaSonic G.723
136 * 0x0094 Aculab PLC Prosody 8KBPS
137 * 0x0097 ZyXEL ADPCM
138 * 0x0098 Philips LPCBB
139 * 0x0099 Studer Professional Audio AG Packed
140 * 0x00A0 Malden Electronics PHONYTALK
141 * 0x00FF AAC
142 * 0x0100 Rhetorex ADPCM
143 * 0x0101 IBM mu-law / BeCubed Software IRAT
144 * 0x0102 IBM A-law
145 * 0x0103 IBM AVC ADPCM
146 * 0x0111 Vivo G.723
147 * 0x0112 Vivo Siren
148 * 0x0123 Digital G.723
149 * 0x0125 Sanyo LD ADPCM
150 * 0x0130 Sipro Lab Telecom ACELP.net
151 * 0x0131 Sipro Lab Telecom ACELP.4800
152 * 0x0132 Sipro Lab Telecom ACELP.8V3
153 * 0x0133 Sipro Lab Telecom ACELP.G.729
154 * 0x0134 Sipro Lab Telecom ACELP.G.729A
155 * 0x0135 Sipro Lab Telecom ACELP.KELVIN
156 * 0x0140 Dictaphone G.726 ADPCM
157 * 0x0150 Qualcomm PureVoice
158 * 0x0151 Qualcomm HalfRate
159 * 0x0155 Ring Zero Systems TUB GSM
160 * 0x0160 Windows Media Audio V1 / DivX audio (WMA)
161 * 0x0161 Windows Media Audio V2 V7 V8 V9 / DivX audio (WMA) / Alex AC3 Audio
162 * 0x0162 Windows Media Audio Professional V9
163 * 0x0163 Windows Media Audio Lossless V9
164 * 0x0170 UNISYS NAP ADPCM
165 * 0x0171 UNISYS NAP ULAW
166 * 0x0172 UNISYS NAP ALAW
167 * 0x0173 UNISYS NAP 16K
168 * 0x0200 Creative Labs ADPCM
169 * 0x0202 Creative Labs FastSpeech8
170 * 0x0203 Creative Labs FastSpeech10
171 * 0x0210 UHER Informatic ADPCM
172 * 0x0215 Ulead DV ACM
173 * 0x0216 Ulead DV ACM
174 * 0x0220 Quarterdeck
175 * 0x0230 I-link Worldwide ILINK VC
176 * 0x0240 Aureal Semiconductor RAW SPORT
177 * 0x0241 ESST AC3
178 * 0x0250 Interactive Products HSX
179 * 0x0251 Interactive Products RPELP
180 * 0x0260 Consistent Software CS2
181 * 0x0270 Sony ATRAC3 (SCX, same as MiniDisk LP2)
182 * 0x0300 Fujitsu FM TOWNS SND
183 * 0x0400 BTV Digital (Brooktree digital audio format)
184 * 0x0401 Intel Music Coder (IMC)
185 * 0x0402 Ligos Indeo Audio
186 * 0x0450 QDesign Music
187 * 0x0680 AT&T Labs VME VMPCM
188 * 0x0681 AT&T Labs TPC
189 * 0x0700 YMPEG Alpha (dummy for MPEG-2 compressor)
190 * 0x08AE ClearJump LiteWave
191 * 0x1000 Olivetti GSM
192 * 0x1001 Olivetti ADPCM
193 * 0x1002 Olivetti CELP
194 * 0x1003 Olivetti SBC
195 * 0x1004 Olivetti OPR
196 * 0x1100 Lernout & Hauspie codec
197 * 0x1101 Lernout & Hauspie CELP codec
198 * 0x1102 Lernout & Hauspie SBC codec
199 * 0x1103 Lernout & Hauspie SBC codec
200 * 0x1104 Lernout & Hauspie SBC codec
201 * 0x1400 Norris Communication
202 * 0x1401 AT&T Labs ISIAudio
203 * 0x1500 AT&T Labs Soundspace Music Compression
204 * 0x181C VoxWare RT24 speech codec
205 * 0x181E Lucent elemedia AX24000P Music codec
206 * 0x1C07 Lucent SX8300P speech codec
207 * 0x1C0C Lucent SX5363S G.723 compliant codec
208 * 0x1F03 CUseeMe DigiTalk (ex-Rocwell)
209 * 0x1FC4 NCT Soft ALF2CD ACM
210 * 0x2000 Dolby AC3 / FAST Multimedia AG DVM
211 * 0x2001 Dolby DTS (Digital Theater System)
212 * 0x2002 RealAudio 1 / 2 14.4
213 * 0x2003 RealAudio 1 / 2 28.8
214 * 0x2004 RealAudio G2 / 8 Cook (low bitrate)
215 * 0x2005 RealAudio 3 / 4 / 5 Music (DNET)
216 * 0x2006 RealAudio 10 AAC (RAAC)
217 * 0x2007 RealAudio 10 AAC+ (RACP)
218 * 0x3313 makeAVIS (ffvfw fake AVI sound from AviSynth scripts)
219 * 0x4143 Divio MPEG-4 AAC audio
220 * 0x434C LEAD Speech
221 * 0x564C LEAD Vorbis
222 * 0x674f Ogg Vorbis (mode 1)
223 * 0x6750 Ogg Vorbis (mode 2)
224 * 0x6751 Ogg Vorbis (mode 3)
225 * 0x676f Ogg Vorbis (mode 1+)
226 * 0x6770 Ogg Vorbis (mode 2+)
227 * 0x6771 Ogg Vorbis (mode 3+)
228 * 0x7A21 GSM-AMR (CBR, no SID)
229 * 0x7A22 GSM-AMR (VBR, including SID)
230 * 0xDFAC DebugMode SonicFoundry Vegas FrameServer ACM Codec
231 * 0xF1AC Free Lossless Audio Codec FLAC
232 * 0xFFFE Extensible wave format
233 * 0xFFFF In Development / Unregistered
234 #endif
235 }
236
237 char* avm_wave_format(char* buf, size_t s, const WAVEFORMATEX* wfx)
238 {
239 if (buf && s > 0)
240 {
241 char b[200];
242 int c = sprintf(b, "fmt=0x%02x %uch %uHz %2ub %6uB/s balign=%u cbsz=%u",
243 wfx->wFormatTag, wfx->nChannels, wfx->nSamplesPerSec,
244 wfx->wBitsPerSample, wfx->nAvgBytesPerSec,
245 wfx->nBlockAlign, wfx->cbSize);
246 if (c >= --s)
247 b[s] = 0;
248 strcpy(buf, b);
249 }
250 return buf;
251 }
252
253 char* avm_mp3wave_format(char* buf, size_t s, const MPEGLAYER3WAVEFORMAT* wfx)
254 {
255 if (buf && s > 0)
256 {
257 const char ids[][18] = { "Unknown", "MPEG", "ConstanFrameSize" };
258 const char flags[][12] = { "PaddingISO", "PaddingOn", "PaddingOff" };
259 char b[200];
260
261 int c = sprintf(b, "ID=%d (%s) flags=%d (%s) blocksize=%d frms/blk=%d delay=%d",
262 wfx->wID, ids[wfx->wID], wfx->fdwFlags, flags[wfx->fdwFlags],
263 wfx->nBlockSize, wfx->nFramesPerBlock, wfx->nCodecDelay);
264 if (c >= --s)
265 b[s] = 0;
266 strcpy(buf, b);
267 }
268 return buf;
269 }