advapi32: Explicitly initialize nested array element.
[wine] / dlls / winemp3.acm / mpegl3.c
1 /*
2  * MPEG Layer 3 handling
3  *
4  *      Copyright (C) 2002              Eric Pouech
5  *
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include <assert.h>
23 #include <stdarg.h>
24 #include <string.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "mmsystem.h"
31 #include "mmreg.h"
32 #include "msacm.h"
33 #include "msacmdrv.h"
34 #include "mpg123.h"
35 #include "mpglib.h"
36
37 #include "wine/debug.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(mpeg3);
40
41 /***********************************************************************
42  *           MPEG3_drvOpen
43  */
44 static LRESULT MPEG3_drvOpen(LPCSTR str)
45 {
46     return 1;
47 }
48
49 /***********************************************************************
50  *           MPEG3_drvClose
51  */
52 static LRESULT MPEG3_drvClose(DWORD_PTR dwDevID)
53 {
54     return 1;
55 }
56
57 typedef struct tagAcmMpeg3Data
58 {
59     void (*convert)(PACMDRVSTREAMINSTANCE adsi,
60                     const unsigned char*, LPDWORD, unsigned char*, LPDWORD);
61     struct mpstr mp;
62 } AcmMpeg3Data;
63
64 /* table to list all supported formats... those are the basic ones. this
65  * also helps given a unique index to each of the supported formats
66  */
67 typedef struct
68 {
69     int         nChannels;
70     int         nBits;
71     int         rate;
72 } Format;
73
74 static const Format PCM_Formats[] =
75 {
76     {1,  8,  8000}, {2,  8,  8000}, {1, 16,  8000}, {2, 16,  8000},
77     {1,  8, 11025}, {2,  8, 11025}, {1, 16, 11025}, {2, 16, 11025},
78     {1,  8, 22050}, {2,  8, 22050}, {1, 16, 22050}, {2, 16, 22050},
79     {1,  8, 44100}, {2,  8, 44100}, {1, 16, 44100}, {2, 16, 44100},
80 };
81
82 static const Format MPEG3_Formats[] =
83 {
84     {1,  0,  8000}, {2, 0,  8000},  {1,  0, 11025}, {2,  0, 11025},
85     {1,  0, 22050}, {2, 0, 22050},  {1,  0, 44100}, {2,  0, 44100},
86 };
87
88 #define NUM_PCM_FORMATS         (sizeof(PCM_Formats) / sizeof(PCM_Formats[0]))
89 #define NUM_MPEG3_FORMATS       (sizeof(MPEG3_Formats) / sizeof(MPEG3_Formats[0]))
90
91 /***********************************************************************
92  *           MPEG3_GetFormatIndex
93  */
94 static  DWORD   MPEG3_GetFormatIndex(LPWAVEFORMATEX wfx)
95 {
96     int         i, hi;
97     const Format *fmts;
98
99     switch (wfx->wFormatTag)
100     {
101     case WAVE_FORMAT_PCM:
102         hi = NUM_PCM_FORMATS;
103         fmts = PCM_Formats;
104         break;
105     case WAVE_FORMAT_MPEGLAYER3:
106         hi = NUM_MPEG3_FORMATS;
107         fmts = MPEG3_Formats;
108         break;
109     default:
110         return 0xFFFFFFFF;
111     }
112
113     for (i = 0; i < hi; i++)
114     {
115         if (wfx->nChannels == fmts[i].nChannels &&
116             wfx->nSamplesPerSec == fmts[i].rate &&
117             wfx->wBitsPerSample == fmts[i].nBits)
118             return i;
119     }
120
121     return 0xFFFFFFFF;
122 }
123
124 static DWORD get_num_buffered_bytes(struct mpstr *mp)
125 {
126     DWORD numBuff = 0;
127     struct buf * p = mp->tail;
128     while (p) {
129         numBuff += p->size - p->pos;
130         p = p->next;
131     }
132     return numBuff;
133 }
134
135 static void mp3_horse(PACMDRVSTREAMINSTANCE adsi,
136                       const unsigned char* src, LPDWORD nsrc,
137                       unsigned char* dst, LPDWORD ndst)
138 {
139     AcmMpeg3Data*       amd = (AcmMpeg3Data*)adsi->dwDriver;
140     int                 size, ret;
141     DWORD               dpos = 0;
142     DWORD               buffered_before;
143     DWORD               buffered_during;
144     DWORD               buffered_after;
145
146     buffered_before = get_num_buffered_bytes(&amd->mp);
147     ret = decodeMP3(&amd->mp, src, *nsrc, dst, *ndst, &size);
148     buffered_during = get_num_buffered_bytes(&amd->mp);
149     if (ret != MP3_OK)
150     {
151         *ndst = *nsrc = 0;
152         return;
153     }
154     do {
155         dpos += size;
156         if (*ndst - dpos < 4608) break;
157         ret = decodeMP3(&amd->mp, NULL, 0,
158                         dst + dpos, *ndst - dpos, &size);
159     } while (ret == MP3_OK);
160     *ndst = dpos;
161
162     buffered_after = get_num_buffered_bytes(&amd->mp);
163     TRACE("before %d put %d during %d after %d\n", buffered_before, *nsrc, buffered_during, buffered_after);
164 }
165
166 /***********************************************************************
167  *           MPEG3_DriverDetails
168  *
169  */
170 static  LRESULT MPEG3_DriverDetails(PACMDRIVERDETAILSW add)
171 {
172     add->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
173     add->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
174     add->wMid = 0xFF;
175     add->wPid = 0x00;
176     add->vdwACM = 0x01000000;
177     add->vdwDriver = 0x01000000;
178     add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
179     add->cFormatTags = 2; /* PCM, MPEG3 */
180     add->cFilterTags = 0;
181     add->hicon = NULL;
182     MultiByteToWideChar( CP_ACP, 0, "WINE-MPEG3", -1,
183                          add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
184     MultiByteToWideChar( CP_ACP, 0, "Wine MPEG3 decoder", -1,
185                          add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) );
186     MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team (based on mpglib by Michael Hipp)...", -1,
187                          add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) );
188     MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1,
189                          add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) );
190     add->szFeatures[0] = 0;
191
192     return MMSYSERR_NOERROR;
193 }
194
195 /***********************************************************************
196  *           MPEG3_FormatTagDetails
197  *
198  */
199 static  LRESULT MPEG3_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
200 {
201     static const WCHAR szPcm[]={'P','C','M',0};
202     static const WCHAR szMpeg3[]={'M','P','e','g','3',0};
203
204     switch (dwQuery)
205     {
206     case ACM_FORMATTAGDETAILSF_INDEX:
207         if (aftd->dwFormatTagIndex >= 2) return ACMERR_NOTPOSSIBLE;
208         break;
209     case ACM_FORMATTAGDETAILSF_LARGESTSIZE:
210         if (aftd->dwFormatTag == WAVE_FORMAT_UNKNOWN)
211         {
212             aftd->dwFormatTagIndex = 1; /* WAVE_FORMAT_MPEGLAYER3 is bigger than PCM */
213             break;
214         }
215         /* fall thru */
216     case ACM_FORMATTAGDETAILSF_FORMATTAG:
217         switch (aftd->dwFormatTag)
218         {
219         case WAVE_FORMAT_PCM:           aftd->dwFormatTagIndex = 0; break;
220         case WAVE_FORMAT_MPEGLAYER3:    aftd->dwFormatTagIndex = 1; break;
221         default:                        return ACMERR_NOTPOSSIBLE;
222         }
223         break;
224     default:
225         WARN("Unsupported query %08x\n", dwQuery);
226         return MMSYSERR_NOTSUPPORTED;
227     }
228
229     aftd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
230     switch (aftd->dwFormatTagIndex)
231     {
232     case 0:
233         aftd->dwFormatTag = WAVE_FORMAT_PCM;
234         aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
235         aftd->cStandardFormats = NUM_PCM_FORMATS;
236         lstrcpyW(aftd->szFormatTag, szPcm);
237         break;
238     case 1:
239         aftd->dwFormatTag = WAVE_FORMAT_MPEGLAYER3;
240         aftd->cbFormatSize = sizeof(MPEGLAYER3WAVEFORMAT);
241         aftd->cStandardFormats = NUM_MPEG3_FORMATS;
242         lstrcpyW(aftd->szFormatTag, szMpeg3);
243         break;
244     }
245     return MMSYSERR_NOERROR;
246 }
247
248 static void fill_in_wfx(unsigned cbwfx, WAVEFORMATEX* wfx, unsigned bit_rate)
249 {
250     MPEGLAYER3WAVEFORMAT*   mp3wfx = (MPEGLAYER3WAVEFORMAT*)wfx;
251
252     wfx->nAvgBytesPerSec = bit_rate / 8;
253     if (cbwfx >= sizeof(WAVEFORMATEX))
254         wfx->cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX);
255     if (cbwfx >= sizeof(MPEGLAYER3WAVEFORMAT))
256     {
257         mp3wfx->wID = MPEGLAYER3_ID_MPEG;
258         mp3wfx->fdwFlags = MPEGLAYER3_FLAG_PADDING_OFF;
259         mp3wfx->nBlockSize = (bit_rate * 144) / wfx->nSamplesPerSec;
260         mp3wfx->nFramesPerBlock = 1;
261         mp3wfx->nCodecDelay = 0x0571;
262     }
263 }
264
265 /***********************************************************************
266  *           MPEG3_FormatDetails
267  *
268  */
269 static  LRESULT MPEG3_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
270 {
271     switch (dwQuery)
272     {
273     case ACM_FORMATDETAILSF_FORMAT:
274         if (MPEG3_GetFormatIndex(afd->pwfx) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
275         break;
276     case ACM_FORMATDETAILSF_INDEX:
277         afd->pwfx->wFormatTag = afd->dwFormatTag;
278         switch (afd->dwFormatTag)
279         {
280         case WAVE_FORMAT_PCM:
281             if (afd->dwFormatIndex >= NUM_PCM_FORMATS) return ACMERR_NOTPOSSIBLE;
282             afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels;
283             afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate;
284             afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits;
285             /* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not accessible
286              * afd->pwfx->cbSize = 0;
287              */
288             afd->pwfx->nBlockAlign =
289                 (afd->pwfx->nChannels * afd->pwfx->wBitsPerSample) / 8;
290             afd->pwfx->nAvgBytesPerSec =
291                 afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign;
292             break;
293         case WAVE_FORMAT_MPEGLAYER3:
294             if (afd->dwFormatIndex >= NUM_MPEG3_FORMATS) return ACMERR_NOTPOSSIBLE;
295             afd->pwfx->nChannels = MPEG3_Formats[afd->dwFormatIndex].nChannels;
296             afd->pwfx->nSamplesPerSec = MPEG3_Formats[afd->dwFormatIndex].rate;
297             afd->pwfx->wBitsPerSample = MPEG3_Formats[afd->dwFormatIndex].nBits;
298             afd->pwfx->nBlockAlign = 1;
299             fill_in_wfx(afd->cbwfx, afd->pwfx, 192000);
300             break;
301         default:
302             WARN("Unsupported tag %08x\n", afd->dwFormatTag);
303             return MMSYSERR_INVALPARAM;
304         }
305         break;
306     default:
307         WARN("Unsupported query %08x\n", dwQuery);
308         return MMSYSERR_NOTSUPPORTED;
309     }
310     afd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
311     afd->szFormat[0] = 0; /* let MSACM format this for us... */
312
313     return MMSYSERR_NOERROR;
314 }
315
316 /***********************************************************************
317  *           MPEG3_FormatSuggest
318  *
319  */
320 static  LRESULT MPEG3_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
321 {
322     /* some tests ... */
323     if (adfs->cbwfxSrc < sizeof(PCMWAVEFORMAT) ||
324         adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) ||
325         MPEG3_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
326     /* FIXME: should do those tests against the real size (according to format tag */
327
328     /* If no suggestion for destination, then copy source value */
329     if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS))
330         adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
331     if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC))
332         adfs->pwfxDst->nSamplesPerSec = adfs->pwfxSrc->nSamplesPerSec;
333
334     if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE))
335     {
336         if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
337             adfs->pwfxDst->wBitsPerSample = 4;
338         else
339             adfs->pwfxDst->wBitsPerSample = 16;
340     }
341     if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG))
342     {
343         if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
344             adfs->pwfxDst->wFormatTag = WAVE_FORMAT_MPEGLAYER3;
345         else
346             adfs->pwfxDst->wFormatTag = WAVE_FORMAT_PCM;
347     }
348
349     /* check if result is ok */
350     if (MPEG3_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
351
352     /* recompute other values */
353     switch (adfs->pwfxDst->wFormatTag)
354     {
355     case WAVE_FORMAT_PCM:
356         adfs->pwfxDst->nBlockAlign = (adfs->pwfxDst->nChannels * adfs->pwfxDst->wBitsPerSample) / 8;
357         adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * adfs->pwfxDst->nBlockAlign;
358         break;
359     case WAVE_FORMAT_MPEGLAYER3:
360         adfs->pwfxDst->nBlockAlign = 1;
361         fill_in_wfx(adfs->cbwfxDst, adfs->pwfxDst, 192000);
362         break;
363     default:
364         FIXME("\n");
365         break;
366     }
367
368     return MMSYSERR_NOERROR;
369 }
370
371 /***********************************************************************
372  *           MPEG3_Reset
373  *
374  */
375 static  void    MPEG3_Reset(PACMDRVSTREAMINSTANCE adsi, AcmMpeg3Data* aad)
376 {
377 }
378
379 /***********************************************************************
380  *           MPEG3_StreamOpen
381  *
382  */
383 static  LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
384 {
385     AcmMpeg3Data*       aad;
386
387     assert(!(adsi->fdwOpen & ACM_STREAMOPENF_ASYNC));
388
389     if (MPEG3_GetFormatIndex(adsi->pwfxSrc) == 0xFFFFFFFF ||
390         MPEG3_GetFormatIndex(adsi->pwfxDst) == 0xFFFFFFFF)
391         return ACMERR_NOTPOSSIBLE;
392
393     aad = HeapAlloc(GetProcessHeap(), 0, sizeof(AcmMpeg3Data));
394     if (aad == 0) return MMSYSERR_NOMEM;
395
396     adsi->dwDriver = (DWORD)aad;
397
398     if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
399         adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
400     {
401         goto theEnd;
402     }
403     else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3 &&
404              adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
405     {
406         /* resampling or mono <=> stereo not available
407          * MPEG3 algo only define 16 bit per sample output
408          */
409         if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec ||
410             adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels ||
411             adsi->pwfxDst->wBitsPerSample != 16)
412             goto theEnd;
413         aad->convert = mp3_horse;
414         InitMP3(&aad->mp);
415     }
416     /* no encoding yet
417     else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
418              adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEGLAYER3)
419     */
420     else goto theEnd;
421     MPEG3_Reset(adsi, aad);
422
423     return MMSYSERR_NOERROR;
424
425  theEnd:
426     HeapFree(GetProcessHeap(), 0, aad);
427     adsi->dwDriver = 0L;
428     return MMSYSERR_NOTSUPPORTED;
429 }
430
431 /***********************************************************************
432  *           MPEG3_StreamClose
433  *
434  */
435 static  LRESULT MPEG3_StreamClose(PACMDRVSTREAMINSTANCE adsi)
436 {
437     ExitMP3(&((AcmMpeg3Data*)adsi->dwDriver)->mp);
438     HeapFree(GetProcessHeap(), 0, (void*)adsi->dwDriver);
439     return MMSYSERR_NOERROR;
440 }
441
442 /***********************************************************************
443  *           MPEG3_StreamSize
444  *
445  */
446 static  LRESULT MPEG3_StreamSize(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMSIZE adss)
447 {
448     switch (adss->fdwSize)
449     {
450     case ACM_STREAMSIZEF_DESTINATION:
451         /* cbDstLength => cbSrcLength */
452         if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
453             adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEGLAYER3)
454         {
455             /* don't take block overhead into account, doesn't matter too much */
456             adss->cbSrcLength = adss->cbDstLength * 12;
457         }
458         else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3 &&
459                  adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
460         {
461             FIXME("misses the block header overhead\n");
462             adss->cbSrcLength = 256 + adss->cbDstLength / 12;
463         }
464         else
465         {
466             return MMSYSERR_NOTSUPPORTED;
467         }
468         break;
469     case ACM_STREAMSIZEF_SOURCE:
470         /* cbSrcLength => cbDstLength */
471         if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
472             adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEGLAYER3)
473         {
474             FIXME("misses the block header overhead\n");
475             adss->cbDstLength = 256 + adss->cbSrcLength / 12;
476         }
477         else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3 &&
478                  adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
479         {
480             /* don't take block overhead into account, doesn't matter too much */
481             adss->cbDstLength = adss->cbSrcLength * 12;
482         }
483         else
484         {
485             return MMSYSERR_NOTSUPPORTED;
486         }
487         break;
488     default:
489         WARN("Unsupported query %08x\n", adss->fdwSize);
490         return MMSYSERR_NOTSUPPORTED;
491     }
492     return MMSYSERR_NOERROR;
493 }
494
495 /***********************************************************************
496  *           MPEG3_StreamConvert
497  *
498  */
499 static LRESULT MPEG3_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER adsh)
500 {
501     AcmMpeg3Data*       aad = (AcmMpeg3Data*)adsi->dwDriver;
502     DWORD               nsrc = adsh->cbSrcLength;
503     DWORD               ndst = adsh->cbDstLength;
504
505     if (adsh->fdwConvert &
506         ~(ACM_STREAMCONVERTF_BLOCKALIGN|
507           ACM_STREAMCONVERTF_END|
508           ACM_STREAMCONVERTF_START))
509     {
510         FIXME("Unsupported fdwConvert (%08x), ignoring it\n", adsh->fdwConvert);
511     }
512     /* ACM_STREAMCONVERTF_BLOCKALIGN
513      *  currently all conversions are block aligned, so do nothing for this flag
514      * ACM_STREAMCONVERTF_END
515      *  no pending data, so do nothing for this flag
516      */
517     if ((adsh->fdwConvert & ACM_STREAMCONVERTF_START))
518     {
519         MPEG3_Reset(adsi, aad);
520     }
521
522     aad->convert(adsi, adsh->pbSrc, &nsrc, adsh->pbDst, &ndst);
523     adsh->cbSrcLengthUsed = nsrc;
524     adsh->cbDstLengthUsed = ndst;
525
526     return MMSYSERR_NOERROR;
527 }
528
529 /**************************************************************************
530  *                      MPEG3_DriverProc                        [exported]
531  */
532 LRESULT CALLBACK MPEG3_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
533                                          LPARAM dwParam1, LPARAM dwParam2)
534 {
535     TRACE("(%08lx %p %04x %08lx %08lx);\n",
536           dwDevID, hDriv, wMsg, dwParam1, dwParam2);
537
538     switch (wMsg)
539     {
540     case DRV_LOAD:              return 1;
541     case DRV_FREE:              return 1;
542     case DRV_OPEN:              return MPEG3_drvOpen((LPSTR)dwParam1);
543     case DRV_CLOSE:             return MPEG3_drvClose(dwDevID);
544     case DRV_ENABLE:            return 1;
545     case DRV_DISABLE:           return 1;
546     case DRV_QUERYCONFIGURE:    return 1;
547     case DRV_CONFIGURE:         MessageBoxA(0, "MPEG3 filter !", "Wine Driver", MB_OK); return 1;
548     case DRV_INSTALL:           return DRVCNF_RESTART;
549     case DRV_REMOVE:            return DRVCNF_RESTART;
550
551     case ACMDM_DRIVER_NOTIFY:
552         /* no caching from other ACM drivers is done so far */
553         return MMSYSERR_NOERROR;
554
555     case ACMDM_DRIVER_DETAILS:
556         return MPEG3_DriverDetails((PACMDRIVERDETAILSW)dwParam1);
557
558     case ACMDM_FORMATTAG_DETAILS:
559         return MPEG3_FormatTagDetails((PACMFORMATTAGDETAILSW)dwParam1, dwParam2);
560
561     case ACMDM_FORMAT_DETAILS:
562         return MPEG3_FormatDetails((PACMFORMATDETAILSW)dwParam1, dwParam2);
563
564     case ACMDM_FORMAT_SUGGEST:
565         return MPEG3_FormatSuggest((PACMDRVFORMATSUGGEST)dwParam1);
566
567     case ACMDM_STREAM_OPEN:
568         return MPEG3_StreamOpen((PACMDRVSTREAMINSTANCE)dwParam1);
569
570     case ACMDM_STREAM_CLOSE:
571         return MPEG3_StreamClose((PACMDRVSTREAMINSTANCE)dwParam1);
572
573     case ACMDM_STREAM_SIZE:
574         return MPEG3_StreamSize((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMSIZE)dwParam2);
575
576     case ACMDM_STREAM_CONVERT:
577         return MPEG3_StreamConvert((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMHEADER)dwParam2);
578
579     case ACMDM_HARDWARE_WAVE_CAPS_INPUT:
580     case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT:
581         /* this converter is not a hardware driver */
582     case ACMDM_FILTERTAG_DETAILS:
583     case ACMDM_FILTER_DETAILS:
584         /* this converter is not a filter */
585     case ACMDM_STREAM_RESET:
586         /* only needed for asynchronous driver... we aren't, so just say it */
587         return MMSYSERR_NOTSUPPORTED;
588     case ACMDM_STREAM_PREPARE:
589     case ACMDM_STREAM_UNPREPARE:
590         /* nothing special to do here... so don't do anything */
591         return MMSYSERR_NOERROR;
592
593     default:
594         return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
595     }
596 }