winemac.drv: Remove workarounds for Mac OS X 10.6 and earlier.
[wine.git] / dlls / l3codeca.acm / mpegl3.c
blob336e706bb83d8df37bf3e5fcd91e4afa3a86f3a8
1 /*
2 * MPEG Layer 3 handling
4 * Copyright (C) 2002 Eric Pouech
5 * Copyright (C) 2009 CodeWeavers, Aric Stewart
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.
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.
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
22 #include <assert.h>
23 #include <stdarg.h>
24 #include <string.h>
25 #include <mpg123.h>
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winuser.h"
31 #include "winnls.h"
32 #include "mmsystem.h"
33 #include "mmreg.h"
34 #include "msacm.h"
35 #include "msacmdrv.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(mpeg3);
40 /* table to list all supported formats... those are the basic ones. this
41 * also helps given a unique index to each of the supported formats
43 typedef struct
45 int nChannels;
46 int nBits;
47 int rate;
48 } Format;
50 static const Format PCM_Formats[] =
52 {1, 8, 8000}, {2, 8, 8000}, {1, 16, 8000}, {2, 16, 8000},
53 {1, 8, 11025}, {2, 8, 11025}, {1, 16, 11025}, {2, 16, 11025},
54 {1, 8, 12000}, {2, 8, 12000}, {1, 16, 12000}, {2, 16, 12000},
55 {1, 8, 16000}, {2, 8, 16000}, {1, 16, 16000}, {2, 16, 16000},
56 {1, 8, 22050}, {2, 8, 22050}, {1, 16, 22050}, {2, 16, 22050},
57 {1, 8, 24000}, {2, 8, 24000}, {1, 16, 24000}, {2, 16, 24000},
58 {1, 8, 32000}, {2, 8, 32000}, {1, 16, 32000}, {2, 16, 32000},
59 {1, 8, 44100}, {2, 8, 44100}, {1, 16, 44100}, {2, 16, 44100},
60 {1, 8, 48000}, {2, 8, 48000}, {1, 16, 48000}, {2, 16, 48000}
63 static const Format MPEG3_Formats[] =
65 {1, 0, 8000}, {2, 0, 8000},
66 {1, 0, 11025}, {2, 0, 11025},
67 {1, 0, 12000}, {2, 0, 12000},
68 {1, 0, 16000}, {2, 0, 16000},
69 {1, 0, 22050}, {2, 0, 22050},
70 {1, 0, 24000}, {2, 0, 24000},
71 {1, 0, 32000}, {2, 0, 32000},
72 {1, 0, 44100}, {2, 0, 44100},
73 {1, 0, 48000}, {2, 0, 48000}
76 /***********************************************************************
77 * MPEG3_GetFormatIndex
79 static DWORD MPEG3_GetFormatIndex(LPWAVEFORMATEX wfx)
81 int i, hi;
82 const Format *fmts;
84 switch (wfx->wFormatTag)
86 case WAVE_FORMAT_PCM:
87 hi = ARRAY_SIZE(PCM_Formats);
88 fmts = PCM_Formats;
89 break;
90 case WAVE_FORMAT_MPEG:
91 case WAVE_FORMAT_MPEGLAYER3:
92 hi = ARRAY_SIZE(MPEG3_Formats);
93 fmts = MPEG3_Formats;
94 break;
95 default:
96 return 0xFFFFFFFF;
99 for (i = 0; i < hi; i++)
101 if (wfx->nChannels == fmts[i].nChannels &&
102 wfx->nSamplesPerSec == fmts[i].rate &&
103 (wfx->wBitsPerSample == fmts[i].nBits || !fmts[i].nBits))
104 return i;
107 return 0xFFFFFFFF;
110 /***********************************************************************
111 * MPEG3_drvOpen
113 static LRESULT MPEG3_drvOpen(LPCSTR str)
115 mpg123_init();
116 return 1;
119 /***********************************************************************
120 * MPEG3_drvClose
122 static LRESULT MPEG3_drvClose(DWORD_PTR dwDevID)
124 mpg123_exit();
125 return 1;
129 static void mp3_horse(mpg123_handle *handle, const unsigned char *src,
130 DWORD *nsrc, unsigned char *dst, DWORD *ndst)
132 int ret;
133 size_t size;
134 DWORD dpos = 0;
137 if (*nsrc > 0)
139 ret = mpg123_feed(handle, src, *nsrc);
140 if (ret != MPG123_OK)
142 ERR("Error feeding data\n");
143 *ndst = *nsrc = 0;
144 return;
148 do {
149 size = 0;
150 ret = mpg123_read(handle, dst + dpos, *ndst - dpos, &size);
151 if (ret == MPG123_ERR)
153 FIXME("Error occurred during decoding!\n");
154 *ndst = *nsrc = 0;
155 return;
158 if (ret == MPG123_NEW_FORMAT)
160 long rate;
161 int channels, enc;
162 mpg123_getformat(handle, &rate, &channels, &enc);
163 TRACE("New format: %li Hz, %i channels, encoding value %i\n", rate, channels, enc);
165 dpos += size;
166 if (dpos >= *ndst) break;
167 } while (ret != MPG123_ERR && ret != MPG123_NEED_MORE);
168 *ndst = dpos;
171 /***********************************************************************
172 * MPEG3_StreamOpen
175 static LRESULT MPEG3_StreamOpen(ACMDRVSTREAMINSTANCE *instance)
177 mpg123_handle *handle;
178 int err;
180 assert(!(instance->fdwOpen & ACM_STREAMOPENF_ASYNC));
182 if (MPEG3_GetFormatIndex(instance->pwfxSrc) == 0xFFFFFFFF
183 || MPEG3_GetFormatIndex(instance->pwfxDst) == 0xFFFFFFFF)
184 return ACMERR_NOTPOSSIBLE;
186 if (instance->pwfxDst->wFormatTag != WAVE_FORMAT_PCM)
187 return MMSYSERR_NOTSUPPORTED;
189 if (instance->pwfxSrc->wFormatTag != WAVE_FORMAT_MPEGLAYER3
190 && instance->pwfxSrc->wFormatTag != WAVE_FORMAT_MPEG)
191 return MMSYSERR_NOTSUPPORTED;
193 if (instance->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3)
195 MPEGLAYER3WAVEFORMAT *mp3_format = (MPEGLAYER3WAVEFORMAT *)instance->pwfxSrc;
197 if (instance->pwfxSrc->cbSize < MPEGLAYER3_WFX_EXTRA_BYTES
198 || mp3_format->wID != MPEGLAYER3_ID_MPEG)
199 return ACMERR_NOTPOSSIBLE;
202 if (instance->pwfxSrc->nSamplesPerSec != instance->pwfxDst->nSamplesPerSec
203 || instance->pwfxSrc->nChannels != instance->pwfxDst->nChannels
204 || instance->pwfxDst->wBitsPerSample != 16)
205 return MMSYSERR_NOTSUPPORTED;
207 handle = mpg123_new(NULL, &err);
208 instance->dwDriver = (DWORD_PTR)handle;
209 mpg123_open_feed(handle);
211 /* mpg123 may find a XING header in the mp3 and use that information
212 * to ask for seeks in order to read specific frames in the file.
213 * We cannot allow that since the caller application is feeding us.
214 * This fixes problems for mp3 files encoded with LAME (bug 42361)
216 mpg123_param(handle, MPG123_ADD_FLAGS, MPG123_IGNORE_INFOFRAME, 0);
218 return MMSYSERR_NOERROR;
221 /***********************************************************************
222 * MPEG3_StreamClose
225 static LRESULT MPEG3_StreamClose(ACMDRVSTREAMINSTANCE *instance)
227 mpg123_handle *handle = (mpg123_handle *)instance->dwDriver;
229 mpg123_close(handle);
230 mpg123_delete(handle);
231 return MMSYSERR_NOERROR;
234 /***********************************************************************
235 * MPEG3_DriverDetails
238 static LRESULT MPEG3_DriverDetails(PACMDRIVERDETAILSW add)
240 add->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
241 add->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
242 add->wMid = MM_FRAUNHOFER_IIS;
243 add->wPid = MM_FHGIIS_MPEGLAYER3_DECODE;
244 add->vdwACM = 0x01000000;
245 add->vdwDriver = 0x01000000;
246 add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
247 add->cFormatTags = 3; /* PCM, MPEG3 */
248 add->cFilterTags = 0;
249 add->hicon = NULL;
250 MultiByteToWideChar( CP_ACP, 0, "MPEG Layer-3 Codec", -1,
251 add->szShortName, ARRAY_SIZE( add->szShortName ));
252 MultiByteToWideChar( CP_ACP, 0, "Wine MPEG3 decoder", -1,
253 add->szLongName, ARRAY_SIZE( add->szLongName ));
254 MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1,
255 add->szCopyright, ARRAY_SIZE( add->szCopyright ));
256 MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1,
257 add->szLicensing, ARRAY_SIZE( add->szLicensing ));
258 add->szFeatures[0] = 0;
260 return MMSYSERR_NOERROR;
263 /***********************************************************************
264 * MPEG3_FormatTagDetails
267 static LRESULT MPEG3_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
269 static const WCHAR szPcm[]={'P','C','M',0};
270 static const WCHAR szMpeg3[]={'M','P','e','g','3',0};
271 static const WCHAR szMpeg[]={'M','P','e','g',0};
273 switch (dwQuery)
275 case ACM_FORMATTAGDETAILSF_INDEX:
276 if (aftd->dwFormatTagIndex > 2) return ACMERR_NOTPOSSIBLE;
277 break;
278 case ACM_FORMATTAGDETAILSF_LARGESTSIZE:
279 if (aftd->dwFormatTag == WAVE_FORMAT_UNKNOWN)
281 aftd->dwFormatTagIndex = 2; /* WAVE_FORMAT_MPEG is biggest */
282 break;
284 /* fall through */
285 case ACM_FORMATTAGDETAILSF_FORMATTAG:
286 switch (aftd->dwFormatTag)
288 case WAVE_FORMAT_PCM: aftd->dwFormatTagIndex = 0; break;
289 case WAVE_FORMAT_MPEGLAYER3: aftd->dwFormatTagIndex = 1; break;
290 case WAVE_FORMAT_MPEG: aftd->dwFormatTagIndex = 2; break;
291 default: return ACMERR_NOTPOSSIBLE;
293 break;
294 default:
295 WARN("Unsupported query %08x\n", dwQuery);
296 return MMSYSERR_NOTSUPPORTED;
299 aftd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
300 switch (aftd->dwFormatTagIndex)
302 case 0:
303 aftd->dwFormatTag = WAVE_FORMAT_PCM;
304 aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
305 aftd->cStandardFormats = ARRAY_SIZE(PCM_Formats);
306 lstrcpyW(aftd->szFormatTag, szPcm);
307 break;
308 case 1:
309 aftd->dwFormatTag = WAVE_FORMAT_MPEGLAYER3;
310 aftd->cbFormatSize = sizeof(MPEGLAYER3WAVEFORMAT);
311 aftd->cStandardFormats = 0;
312 lstrcpyW(aftd->szFormatTag, szMpeg3);
313 break;
314 case 2:
315 aftd->dwFormatTag = WAVE_FORMAT_MPEG;
316 aftd->cbFormatSize = sizeof(MPEG1WAVEFORMAT);
317 aftd->cStandardFormats = 0;
318 lstrcpyW(aftd->szFormatTag, szMpeg);
319 break;
321 return MMSYSERR_NOERROR;
324 /***********************************************************************
325 * MPEG3_FormatDetails
328 static LRESULT MPEG3_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
330 switch (dwQuery)
332 case ACM_FORMATDETAILSF_FORMAT:
333 if (MPEG3_GetFormatIndex(afd->pwfx) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
334 break;
335 case ACM_FORMATDETAILSF_INDEX:
336 afd->pwfx->wFormatTag = afd->dwFormatTag;
337 switch (afd->dwFormatTag)
339 case WAVE_FORMAT_PCM:
340 if (afd->dwFormatIndex >= ARRAY_SIZE(PCM_Formats)) return ACMERR_NOTPOSSIBLE;
341 afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels;
342 afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate;
343 afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits;
344 /* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not accessible
345 * afd->pwfx->cbSize = 0;
347 afd->pwfx->nBlockAlign =
348 (afd->pwfx->nChannels * afd->pwfx->wBitsPerSample) / 8;
349 afd->pwfx->nAvgBytesPerSec =
350 afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign;
351 break;
352 case WAVE_FORMAT_MPEGLAYER3:
353 case WAVE_FORMAT_MPEG:
354 WARN("Encoding to MPEG is not supported\n");
355 return ACMERR_NOTPOSSIBLE;
356 default:
357 WARN("Unsupported tag %08x\n", afd->dwFormatTag);
358 return MMSYSERR_INVALPARAM;
360 break;
361 default:
362 WARN("Unsupported query %08x\n", dwQuery);
363 return MMSYSERR_NOTSUPPORTED;
365 afd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
366 afd->szFormat[0] = 0; /* let MSACM format this for us... */
368 return MMSYSERR_NOERROR;
371 /***********************************************************************
372 * MPEG3_FormatSuggest
375 static LRESULT MPEG3_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
377 /* some tests ... */
378 if (adfs->cbwfxSrc < sizeof(PCMWAVEFORMAT) ||
379 adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) ||
380 MPEG3_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
381 /* FIXME: should do those tests against the real size (according to format tag */
383 /* If no suggestion for destination, then copy source value */
384 if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS))
385 adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
386 if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC))
387 adfs->pwfxDst->nSamplesPerSec = adfs->pwfxSrc->nSamplesPerSec;
388 if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE))
389 adfs->pwfxDst->wBitsPerSample = 16;
390 if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG))
392 if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
394 WARN("Encoding to MPEG is not supported\n");
395 return ACMERR_NOTPOSSIBLE;
397 else
398 adfs->pwfxDst->wFormatTag = WAVE_FORMAT_PCM;
401 /* check if result is ok */
402 if (MPEG3_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
404 /* recompute other values */
405 switch (adfs->pwfxDst->wFormatTag)
407 case WAVE_FORMAT_PCM:
408 adfs->pwfxDst->nBlockAlign = (adfs->pwfxDst->nChannels * adfs->pwfxDst->wBitsPerSample) / 8;
409 adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * adfs->pwfxDst->nBlockAlign;
410 break;
411 case WAVE_FORMAT_MPEG:
412 case WAVE_FORMAT_MPEGLAYER3:
413 WARN("Encoding to MPEG is not supported\n");
414 return ACMERR_NOTPOSSIBLE;
415 break;
416 default:
417 FIXME("\n");
418 break;
421 return MMSYSERR_NOERROR;
424 /***********************************************************************
425 * MPEG3_StreamSize
428 static LRESULT MPEG3_StreamSize(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMSIZE adss)
430 DWORD nblocks;
432 switch (adss->fdwSize)
434 case ACM_STREAMSIZEF_DESTINATION:
435 /* cbDstLength => cbSrcLength */
436 if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
437 (adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEGLAYER3 ||
438 adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEG))
440 nblocks = (adss->cbDstLength - 3000) / (DWORD)(adsi->pwfxDst->nAvgBytesPerSec * 1152 / adsi->pwfxDst->nSamplesPerSec + 0.5);
441 if (nblocks == 0)
442 return ACMERR_NOTPOSSIBLE;
443 adss->cbSrcLength = nblocks * 1152 * adsi->pwfxSrc->nBlockAlign;
445 else if ((adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3 ||
446 adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEG) &&
447 adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
449 nblocks = adss->cbDstLength / (adsi->pwfxDst->nBlockAlign * 1152);
450 if (nblocks == 0)
451 return ACMERR_NOTPOSSIBLE;
452 adss->cbSrcLength = nblocks * (DWORD)(adsi->pwfxSrc->nAvgBytesPerSec * 1152 / adsi->pwfxSrc->nSamplesPerSec);
454 else
456 return MMSYSERR_NOTSUPPORTED;
458 break;
459 case ACM_STREAMSIZEF_SOURCE:
460 /* cbSrcLength => cbDstLength */
461 if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
462 (adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEGLAYER3 ||
463 adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEG))
465 nblocks = adss->cbSrcLength / (adsi->pwfxSrc->nBlockAlign * 1152);
466 if (adss->cbSrcLength % (DWORD)(adsi->pwfxSrc->nBlockAlign * 1152))
467 /* Round block count up. */
468 nblocks++;
469 if (nblocks == 0)
470 return ACMERR_NOTPOSSIBLE;
471 adss->cbDstLength = 3000 + nblocks * (DWORD)(adsi->pwfxDst->nAvgBytesPerSec * 1152 / adsi->pwfxDst->nSamplesPerSec + 0.5);
473 else if ((adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3 ||
474 adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEG) &&
475 adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
477 nblocks = adss->cbSrcLength / (DWORD)(adsi->pwfxSrc->nAvgBytesPerSec * 1152 / adsi->pwfxSrc->nSamplesPerSec);
478 if (adss->cbSrcLength % (DWORD)(adsi->pwfxSrc->nAvgBytesPerSec * 1152 / adsi->pwfxSrc->nSamplesPerSec))
479 /* Round block count up. */
480 nblocks++;
481 if (nblocks == 0)
482 return ACMERR_NOTPOSSIBLE;
483 adss->cbDstLength = nblocks * 1152 * adsi->pwfxDst->nBlockAlign;
485 else
487 return MMSYSERR_NOTSUPPORTED;
489 break;
490 default:
491 WARN("Unsupported query %08x\n", adss->fdwSize);
492 return MMSYSERR_NOTSUPPORTED;
494 return MMSYSERR_NOERROR;
497 /***********************************************************************
498 * MPEG3_StreamConvert
501 static LRESULT MPEG3_StreamConvert(ACMDRVSTREAMINSTANCE *instance, ACMDRVSTREAMHEADER *adsh)
503 mpg123_handle *handle = (mpg123_handle *)instance->dwDriver;
504 DWORD nsrc = adsh->cbSrcLength;
505 DWORD ndst = adsh->cbDstLength;
507 if (adsh->fdwConvert &
508 ~(ACM_STREAMCONVERTF_BLOCKALIGN|
509 ACM_STREAMCONVERTF_END|
510 ACM_STREAMCONVERTF_START))
512 FIXME("Unsupported fdwConvert (%08x), ignoring it\n", adsh->fdwConvert);
514 /* ACM_STREAMCONVERTF_BLOCKALIGN
515 * currently all conversions are block aligned, so do nothing for this flag
516 * ACM_STREAMCONVERTF_END
517 * no pending data, so do nothing for this flag
519 if ((adsh->fdwConvert & ACM_STREAMCONVERTF_START))
521 mpg123_feedseek(handle, 0, SEEK_SET, NULL);
522 mpg123_close(handle);
523 mpg123_open_feed(handle);
526 mp3_horse(handle, adsh->pbSrc, &nsrc, adsh->pbDst, &ndst);
527 adsh->cbSrcLengthUsed = nsrc;
528 adsh->cbDstLengthUsed = ndst;
530 return MMSYSERR_NOERROR;
533 /**************************************************************************
534 * MPEG3_DriverProc [exported]
536 LRESULT CALLBACK MPEG3_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
537 LPARAM dwParam1, LPARAM dwParam2)
539 TRACE("(%08lx %p %04x %08lx %08lx);\n",
540 dwDevID, hDriv, wMsg, dwParam1, dwParam2);
542 switch (wMsg)
544 case DRV_LOAD: return 1;
545 case DRV_FREE: return 1;
546 case DRV_OPEN: return MPEG3_drvOpen((LPSTR)dwParam1);
547 case DRV_CLOSE: return MPEG3_drvClose(dwDevID);
548 case DRV_ENABLE: return 1;
549 case DRV_DISABLE: return 1;
550 case DRV_QUERYCONFIGURE: return 1;
551 case DRV_CONFIGURE: MessageBoxA(0, "MPEG3 filter !", "Wine Driver", MB_OK); return 1;
552 case DRV_INSTALL: return DRVCNF_RESTART;
553 case DRV_REMOVE: return DRVCNF_RESTART;
555 case ACMDM_DRIVER_NOTIFY:
556 /* no caching from other ACM drivers is done so far */
557 return MMSYSERR_NOERROR;
559 case ACMDM_DRIVER_DETAILS:
560 return MPEG3_DriverDetails((PACMDRIVERDETAILSW)dwParam1);
562 case ACMDM_FORMATTAG_DETAILS:
563 return MPEG3_FormatTagDetails((PACMFORMATTAGDETAILSW)dwParam1, dwParam2);
565 case ACMDM_FORMAT_DETAILS:
566 return MPEG3_FormatDetails((PACMFORMATDETAILSW)dwParam1, dwParam2);
568 case ACMDM_FORMAT_SUGGEST:
569 return MPEG3_FormatSuggest((PACMDRVFORMATSUGGEST)dwParam1);
571 case ACMDM_STREAM_OPEN:
572 return MPEG3_StreamOpen((PACMDRVSTREAMINSTANCE)dwParam1);
574 case ACMDM_STREAM_CLOSE:
575 return MPEG3_StreamClose((PACMDRVSTREAMINSTANCE)dwParam1);
577 case ACMDM_STREAM_SIZE:
578 return MPEG3_StreamSize((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMSIZE)dwParam2);
580 case ACMDM_STREAM_CONVERT:
581 return MPEG3_StreamConvert((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMHEADER)dwParam2);
583 case ACMDM_HARDWARE_WAVE_CAPS_INPUT:
584 case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT:
585 /* this converter is not a hardware driver */
586 case ACMDM_FILTERTAG_DETAILS:
587 case ACMDM_FILTER_DETAILS:
588 /* this converter is not a filter */
589 case ACMDM_STREAM_RESET:
590 /* only needed for asynchronous driver... we aren't, so just say it */
591 return MMSYSERR_NOTSUPPORTED;
592 case ACMDM_STREAM_PREPARE:
593 case ACMDM_STREAM_UNPREPARE:
594 /* nothing special to do here... so don't do anything */
595 return MMSYSERR_NOERROR;
597 default:
598 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);