ReactOS 0.4.17-dev-966-gf06eace
mpegl3.c File Reference
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include <mpg123.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wine/debug.h"
Include dependency graph for mpegl3.c:

Go to the source code of this file.

Classes

struct  Format
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (mpeg3)
 
static DWORD MPEG3_GetFormatIndex (LPWAVEFORMATEX wfx)
 
static LRESULT MPEG3_drvOpen (LPCSTR str)
 
static LRESULT MPEG3_drvClose (DWORD_PTR dwDevID)
 
static void mp3_horse (mpg123_handle *handle, const unsigned char *src, DWORD *nsrc, unsigned char *dst, DWORD *ndst)
 
static LRESULT MPEG3_StreamOpen (ACMDRVSTREAMINSTANCE *instance)
 
static LRESULT MPEG3_StreamClose (ACMDRVSTREAMINSTANCE *instance)
 
static LRESULT MPEG3_DriverDetails (PACMDRIVERDETAILSW add)
 
static LRESULT MPEG3_FormatTagDetails (PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
 
static LRESULT MPEG3_FormatDetails (PACMFORMATDETAILSW afd, DWORD dwQuery)
 
static LRESULT MPEG3_FormatSuggest (PACMDRVFORMATSUGGEST adfs)
 
static LRESULT MPEG3_StreamSize (PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMSIZE adss)
 
static LRESULT MPEG3_StreamConvert (ACMDRVSTREAMINSTANCE *instance, ACMDRVSTREAMHEADER *adsh)
 
LRESULT CALLBACK MPEG3_DriverProc (DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, LPARAM dwParam1, LPARAM dwParam2)
 

Variables

static const Format PCM_Formats []
 
static const Format MPEG3_Formats []
 

Function Documentation

◆ mp3_horse()

static void mp3_horse ( mpg123_handle *  handle,
const unsigned char *  src,
DWORD *  nsrc,
unsigned char *  dst,
DWORD *  ndst 
)
static

Definition at line 129 of file mpegl3.c.

131{
132 int ret;
133 size_t size;
134 DWORD dpos = 0;
135
136
137 if (*nsrc > 0)
138 {
139 ret = mpg123_feed(handle, src, *nsrc);
140 if (ret != MPG123_OK)
141 {
142 ERR("Error feeding data\n");
143 *ndst = *nsrc = 0;
144 return;
145 }
146 }
147
148 do {
149 size = 0;
150 ret = mpg123_read(handle, dst + dpos, *ndst - dpos, &size);
151 if (ret == MPG123_ERR)
152 {
153 FIXME("Error occurred during decoding!\n");
154 *ndst = *nsrc = 0;
155 return;
156 }
157
158 if (ret == MPG123_NEW_FORMAT)
159 {
160 long rate;
161 int channels, enc;
163 TRACE("New format: %li Hz, %i channels, encoding value %i\n", rate, channels, enc);
164 }
165 dpos += size;
166 if (dpos >= *ndst) break;
167 } while (ret != MPG123_ERR && ret != MPG123_NEED_MORE);
168 *ndst = dpos;
169}
unsigned int channels
Definition: audiorecord.c:89
unsigned int rate
Definition: audiorecord.c:87
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
return ret
Definition: mutex.c:147
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum src
Definition: glext.h:6340
GLsizeiptr size
Definition: glext.h:5919
GLenum GLenum dst
Definition: glext.h:6340
@ MPG123_NEED_MORE
Definition: mpg123.h:389
@ MPG123_ERR
Definition: mpg123.h:390
@ MPG123_NEW_FORMAT
Definition: mpg123.h:388
@ MPG123_OK
Definition: mpg123.h:391
MPG123_EXPORT int mpg123_feed(mpg123_handle *mh, const unsigned char *in, size_t size)
Definition: libmpg123.c:947
MPG123_EXPORT int mpg123_read(mpg123_handle *mh, void *outmemory, size_t outmemsize, size_t *done)
Definition: libmpg123.c:942
MPG123_EXPORT int mpg123_getformat(mpg123_handle *mh, long *rate, int *channels, int *encoding)
Definition: libmpg123.c:1141
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by MPEG3_StreamConvert().

◆ MPEG3_DriverDetails()

static LRESULT MPEG3_DriverDetails ( PACMDRIVERDETAILSW  add)
static

Definition at line 238 of file mpegl3.c.

239{
242 add->wMid = MM_FRAUNHOFER_IIS;
244 add->vdwACM = 0x01000000;
245 add->vdwDriver = 0x01000000;
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;
259
260 return MMSYSERR_NOERROR;
261}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define MM_FRAUNHOFER_IIS
Definition: mmreg.h:152
#define MM_FHGIIS_MPEGLAYER3_DECODE
Definition: mmreg.h:153
#define MMSYSERR_NOERROR
Definition: mmsystem.h:96
#define ACMDRIVERDETAILS_FCCCOMP_UNDEFINED
Definition: msacm.h:59
#define ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC
Definition: msacm.h:58
#define ACMDRIVERDETAILS_SUPPORTF_CODEC
Definition: msacm.h:61
__forceinline bool __cdecl add(big_integer &x, uint32_t const value)

Referenced by MPEG3_DriverProc().

◆ MPEG3_DriverProc()

LRESULT CALLBACK MPEG3_DriverProc ( DWORD_PTR  dwDevID,
HDRVR  hDriv,
UINT  wMsg,
LPARAM  dwParam1,
LPARAM  dwParam2 
)

Definition at line 536 of file mpegl3.c.

538{
539 TRACE("(%08Ix %p %04x %08Ix %08Ix);\n",
540 dwDevID, hDriv, wMsg, dwParam1, dwParam2);
541
542 switch (wMsg)
543 {
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;
554
556 /* no caching from other ACM drivers is done so far */
557 return MMSYSERR_NOERROR;
558
560 return MPEG3_DriverDetails((PACMDRIVERDETAILSW)dwParam1);
561
563 return MPEG3_FormatTagDetails((PACMFORMATTAGDETAILSW)dwParam1, dwParam2);
564
566 return MPEG3_FormatDetails((PACMFORMATDETAILSW)dwParam1, dwParam2);
567
570
572 return MPEG3_StreamOpen((PACMDRVSTREAMINSTANCE)dwParam1);
573
576
578 return MPEG3_StreamSize((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMSIZE)dwParam2);
579
582
585 /* this converter is not a hardware driver */
588 /* this converter is not a filter */
590 /* only needed for asynchronous driver... we aren't, so just say it */
594 /* nothing special to do here... so don't do anything */
595 return MMSYSERR_NOERROR;
596
597 default:
598 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
599 }
600}
LRESULT WINAPI DefDriverProc(DWORD_PTR dwDriverIdentifier, HDRVR hDrv, UINT Msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:554
#define DRV_LOAD(x)
#define DRV_CLOSE
Definition: mmsystem.h:122
#define DRV_QUERYCONFIGURE
Definition: mmsystem.h:126
#define MMSYSERR_NOTSUPPORTED
Definition: mmsystem.h:104
#define DRVCNF_RESTART
Definition: mmsystem.h:135
#define DRV_REMOVE
Definition: mmsystem.h:128
#define DRV_ENABLE
Definition: mmsystem.h:120
#define DRV_CONFIGURE
Definition: mmsystem.h:125
#define DRV_OPEN
Definition: mmsystem.h:121
#define DRV_INSTALL
Definition: mmsystem.h:127
#define DRV_FREE
Definition: mmsystem.h:124
#define DRV_DISABLE
Definition: mmsystem.h:123
static LRESULT MPEG3_drvClose(DWORD_PTR dwDevID)
Definition: mpegl3.c:122
static LRESULT MPEG3_StreamConvert(ACMDRVSTREAMINSTANCE *instance, ACMDRVSTREAMHEADER *adsh)
Definition: mpegl3.c:501
static LRESULT MPEG3_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
Definition: mpegl3.c:375
static LRESULT MPEG3_drvOpen(LPCSTR str)
Definition: mpegl3.c:113
static LRESULT MPEG3_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
Definition: mpegl3.c:267
static LRESULT MPEG3_StreamSize(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMSIZE adss)
Definition: mpegl3.c:428
static LRESULT MPEG3_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
Definition: mpegl3.c:328
static LRESULT MPEG3_StreamClose(ACMDRVSTREAMINSTANCE *instance)
Definition: mpegl3.c:225
static LRESULT MPEG3_StreamOpen(ACMDRVSTREAMINSTANCE *instance)
Definition: mpegl3.c:175
static LRESULT MPEG3_DriverDetails(PACMDRIVERDETAILSW add)
Definition: mpegl3.c:238
#define ACMDM_STREAM_PREPARE
Definition: msacmdrv.h:63
#define ACMDM_STREAM_CLOSE
Definition: msacmdrv.h:59
#define ACMDM_STREAM_CONVERT
Definition: msacmdrv.h:61
#define ACMDM_FORMAT_SUGGEST
Definition: msacmdrv.h:53
#define ACMDM_FILTER_DETAILS
Definition: msacmdrv.h:56
#define ACMDM_HARDWARE_WAVE_CAPS_INPUT
Definition: msacmdrv.h:48
#define ACMDM_DRIVER_NOTIFY
Definition: msacmdrv.h:45
#define ACMDM_FORMAT_DETAILS
Definition: msacmdrv.h:52
#define ACMDM_STREAM_SIZE
Definition: msacmdrv.h:60
#define ACMDM_FILTERTAG_DETAILS
Definition: msacmdrv.h:55
#define ACMDM_HARDWARE_WAVE_CAPS_OUTPUT
Definition: msacmdrv.h:49
#define ACMDM_FORMATTAG_DETAILS
Definition: msacmdrv.h:51
#define ACMDM_STREAM_UNPREPARE
Definition: msacmdrv.h:64
#define ACMDM_STREAM_OPEN
Definition: msacmdrv.h:58
#define ACMDM_DRIVER_DETAILS
Definition: msacmdrv.h:46
#define ACMDM_STREAM_RESET
Definition: msacmdrv.h:62
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
#define MB_OK
Definition: winuser.h:801
char * LPSTR
Definition: typedefs.h:51

◆ MPEG3_drvClose()

static LRESULT MPEG3_drvClose ( DWORD_PTR  dwDevID)
static

Definition at line 122 of file mpegl3.c.

123{
124 mpg123_exit();
125 return 1;
126}
MPG123_EXPORT void mpg123_exit(void)
Definition: libmpg123.c:50

Referenced by MPEG3_DriverProc().

◆ MPEG3_drvOpen()

static LRESULT MPEG3_drvOpen ( LPCSTR  str)
static

Definition at line 113 of file mpegl3.c.

114{
115 mpg123_init();
116 return 1;
117}
MPG123_EXPORT int mpg123_init(void)
Definition: libmpg123.c:23

Referenced by MPEG3_DriverProc().

◆ MPEG3_FormatDetails()

static LRESULT MPEG3_FormatDetails ( PACMFORMATDETAILSW  afd,
DWORD  dwQuery 
)
static

Definition at line 328 of file mpegl3.c.

329{
330 switch (dwQuery)
331 {
333 if (MPEG3_GetFormatIndex(afd->pwfx) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
334 break;
336 afd->pwfx->wFormatTag = afd->dwFormatTag;
337 switch (afd->dwFormatTag)
338 {
339 case WAVE_FORMAT_PCM:
344 /* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not accessible
345 * afd->pwfx->cbSize = 0;
346 */
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;
353 case WAVE_FORMAT_MPEG:
354 WARN("Encoding to MPEG is not supported\n");
355 return ACMERR_NOTPOSSIBLE;
356 default:
357 WARN("Unsupported tag %08lx\n", afd->dwFormatTag);
358 return MMSYSERR_INVALPARAM;
359 }
360 break;
361 default:
362 WARN("Unsupported query %08lx\n", dwQuery);
364 }
366 afd->szFormat[0] = 0; /* let MSACM format this for us... */
367
368 return MMSYSERR_NOERROR;
369}
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define WARN(fmt,...)
Definition: precomp.h:61
#define WAVE_FORMAT_MPEG
Definition: mmreg.h:126
#define WAVE_FORMAT_MPEGLAYER3
Definition: mmreg.h:127
#define MMSYSERR_INVALPARAM
Definition: mmsystem.h:107
static DWORD MPEG3_GetFormatIndex(LPWAVEFORMATEX wfx)
Definition: mpegl3.c:79
static const Format PCM_Formats[]
Definition: mpegl3.c:50
#define ACMERR_NOTPOSSIBLE
Definition: msacm.h:36
#define ACM_FORMATDETAILSF_FORMAT
Definition: msacm.h:161
#define ACM_FORMATDETAILSF_INDEX
Definition: msacm.h:160
int nChannels
Definition: imaadp32.c:63
int nBits
Definition: imaadp32.c:64
int rate
Definition: imaadp32.c:65
WCHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS]
Definition: msacm.h:509
DWORD dwFormatTag
Definition: msacm.h:505
DWORD dwFormatIndex
Definition: msacm.h:504
DWORD fdwSupport
Definition: msacm.h:506
PWAVEFORMATEX pwfx
Definition: msacm.h:507
WORD nBlockAlign
Definition: mmreg.h:82
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nChannels
Definition: mmreg.h:79
WORD wFormatTag
Definition: mmreg.h:78
WORD wBitsPerSample
Definition: mmreg.h:83

Referenced by MPEG3_DriverProc().

◆ MPEG3_FormatSuggest()

static LRESULT MPEG3_FormatSuggest ( PACMDRVFORMATSUGGEST  adfs)
static

Definition at line 375 of file mpegl3.c.

376{
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 */
382
383 /* If no suggestion for destination, then copy source value */
385 adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
389 adfs->pwfxDst->wBitsPerSample = 16;
391 {
392 if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
393 {
394 WARN("Encoding to MPEG is not supported\n");
395 return ACMERR_NOTPOSSIBLE;
396 }
397 else
399 }
400
401 /* check if result is ok */
402 if (MPEG3_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
403
404 /* recompute other values */
405 switch (adfs->pwfxDst->wFormatTag)
406 {
407 case WAVE_FORMAT_PCM:
408 adfs->pwfxDst->nBlockAlign = (adfs->pwfxDst->nChannels * adfs->pwfxDst->wBitsPerSample) / 8;
410 break;
411 case WAVE_FORMAT_MPEG:
413 WARN("Encoding to MPEG is not supported\n");
414 return ACMERR_NOTPOSSIBLE;
415 break;
416 default:
417 FIXME("\n");
418 break;
419 }
420
421 return MMSYSERR_NOERROR;
422}
#define ACM_FORMATSUGGESTF_WFORMATTAG
Definition: msacm.h:174
#define ACM_FORMATSUGGESTF_NCHANNELS
Definition: msacm.h:175
#define ACM_FORMATSUGGESTF_WBITSPERSAMPLE
Definition: msacm.h:177
#define ACM_FORMATSUGGESTF_NSAMPLESPERSEC
Definition: msacm.h:176
PWAVEFORMATEX pwfxSrc
Definition: msacmdrv.h:151
PWAVEFORMATEX pwfxDst
Definition: msacmdrv.h:153

Referenced by MPEG3_DriverProc().

◆ MPEG3_FormatTagDetails()

static LRESULT MPEG3_FormatTagDetails ( PACMFORMATTAGDETAILSW  aftd,
DWORD  dwQuery 
)
static

Definition at line 267 of file mpegl3.c.

268{
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};
272
273 switch (dwQuery)
274 {
276 if (aftd->dwFormatTagIndex > 2) return ACMERR_NOTPOSSIBLE;
277 break;
279 if (aftd->dwFormatTag == WAVE_FORMAT_UNKNOWN)
280 {
281 aftd->dwFormatTagIndex = 2; /* WAVE_FORMAT_MPEG is biggest */
282 break;
283 }
284 /* fall through */
286 switch (aftd->dwFormatTag)
287 {
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;
292 }
293 break;
294 default:
295 WARN("Unsupported query %08lx\n", dwQuery);
297 }
298
300 switch (aftd->dwFormatTagIndex)
301 {
302 case 0:
304 aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
306 lstrcpyW(aftd->szFormatTag, szPcm);
307 break;
308 case 1:
310 aftd->cbFormatSize = sizeof(MPEGLAYER3WAVEFORMAT);
311 aftd->cStandardFormats = 0;
312 lstrcpyW(aftd->szFormatTag, szMpeg3);
313 break;
314 case 2:
316 aftd->cbFormatSize = sizeof(MPEG1WAVEFORMAT);
317 aftd->cStandardFormats = 0;
318 lstrcpyW(aftd->szFormatTag, szMpeg);
319 break;
320 }
321 return MMSYSERR_NOERROR;
322}
#define lstrcpyW
Definition: compat.h:749
#define WAVE_FORMAT_UNKNOWN
Definition: mmreg.h:95
struct mpeglayer3waveformat_tag MPEGLAYER3WAVEFORMAT
struct mpeg1waveformat_tag MPEG1WAVEFORMAT
struct pcmwaveformat_tag PCMWAVEFORMAT
#define ACM_FORMATTAGDETAILSF_FORMATTAG
Definition: msacm.h:183
#define ACM_FORMATTAGDETAILSF_LARGESTSIZE
Definition: msacm.h:184
#define ACM_FORMATTAGDETAILSF_INDEX
Definition: msacm.h:182
short WCHAR
Definition: pedump.c:58
WCHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS]
Definition: msacm.h:535
DWORD dwFormatTagIndex
Definition: msacm.h:530
DWORD cStandardFormats
Definition: msacm.h:534

Referenced by MPEG3_DriverProc().

◆ MPEG3_GetFormatIndex()

static DWORD MPEG3_GetFormatIndex ( LPWAVEFORMATEX  wfx)
static

Definition at line 79 of file mpegl3.c.

80{
81 int i, hi;
82 const Format *fmts;
83
84 switch (wfx->wFormatTag)
85 {
86 case WAVE_FORMAT_PCM:
89 break;
94 break;
95 default:
96 return 0xFFFFFFFF;
97 }
98
99 for (i = 0; i < hi; i++)
100 {
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;
105 }
106
107 return 0xFFFFFFFF;
108}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static struct fmt fmts[]
static const Format MPEG3_Formats[]
Definition: mpegl3.c:63

Referenced by MPEG3_FormatDetails(), MPEG3_FormatSuggest(), and MPEG3_StreamOpen().

◆ MPEG3_StreamClose()

static LRESULT MPEG3_StreamClose ( ACMDRVSTREAMINSTANCE *  instance)
static

Definition at line 225 of file mpegl3.c.

226{
228
231 return MMSYSERR_NOERROR;
232}
static HINSTANCE instance
Definition: main.c:35
MPG123_EXPORT void mpg123_delete(mpg123_handle *mh)
Definition: libmpg123.c:1712
MPG123_EXPORT int mpg123_close(mpg123_handle *mh)
Definition: libmpg123.c:1694

Referenced by MPEG3_DriverProc().

◆ MPEG3_StreamConvert()

static LRESULT MPEG3_StreamConvert ( ACMDRVSTREAMINSTANCE *  instance,
ACMDRVSTREAMHEADER *  adsh 
)
static

Definition at line 501 of file mpegl3.c.

502{
504 DWORD nsrc = adsh->cbSrcLength;
505 DWORD ndst = adsh->cbDstLength;
506
507 if (adsh->fdwConvert &
511 {
512 FIXME("Unsupported fdwConvert (%08lx), ignoring it\n", adsh->fdwConvert);
513 }
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
518 */
520 {
524 }
525
526 mp3_horse(handle, adsh->pbSrc, &nsrc, adsh->pbDst, &ndst);
527 adsh->cbSrcLengthUsed = nsrc;
528 adsh->cbDstLengthUsed = ndst;
529
530 return MMSYSERR_NOERROR;
531}
MPG123_EXPORT int mpg123_open_feed(mpg123_handle *mh)
Definition: libmpg123.c:535
MPG123_EXPORT off_t mpg123_feedseek(mpg123_handle *mh, off_t sampleoff, int whence, off_t *input_offset)
Definition: lfs_wrap.c:291
#define SEEK_SET
Definition: jmemansi.c:26
if(dx< 0)
Definition: linetemp.h:194
static void mp3_horse(mpg123_handle *handle, const unsigned char *src, DWORD *nsrc, unsigned char *dst, DWORD *ndst)
Definition: mpegl3.c:129
#define ACM_STREAMCONVERTF_START
Definition: msacm.h:206
#define ACM_STREAMCONVERTF_BLOCKALIGN
Definition: msacm.h:205
#define ACM_STREAMCONVERTF_END
Definition: msacm.h:207

Referenced by MPEG3_DriverProc().

◆ MPEG3_StreamOpen()

static LRESULT MPEG3_StreamOpen ( ACMDRVSTREAMINSTANCE *  instance)
static

Definition at line 175 of file mpegl3.c.

176{
178 int err;
179
181
182 if (MPEG3_GetFormatIndex(instance->pwfxSrc) == 0xFFFFFFFF
183 || MPEG3_GetFormatIndex(instance->pwfxDst) == 0xFFFFFFFF)
184 return ACMERR_NOTPOSSIBLE;
185
186 if (instance->pwfxDst->wFormatTag != WAVE_FORMAT_PCM)
188
189 if (instance->pwfxSrc->wFormatTag != WAVE_FORMAT_MPEGLAYER3
190 && instance->pwfxSrc->wFormatTag != WAVE_FORMAT_MPEG)
192
193 if (instance->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3)
194 {
195 MPEGLAYER3WAVEFORMAT *mp3_format = (MPEGLAYER3WAVEFORMAT *)instance->pwfxSrc;
196
197 if (instance->pwfxSrc->cbSize < MPEGLAYER3_WFX_EXTRA_BYTES
198 || mp3_format->wID != MPEGLAYER3_ID_MPEG)
199 return ACMERR_NOTPOSSIBLE;
200 }
201
202 if (instance->pwfxSrc->nSamplesPerSec != instance->pwfxDst->nSamplesPerSec
203 || instance->pwfxSrc->nChannels != instance->pwfxDst->nChannels
204 || instance->pwfxDst->wBitsPerSample != 16)
206
208 instance->dwDriver = (DWORD_PTR)handle;
210
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)
215 */
217
218 return MMSYSERR_NOERROR;
219}
#define assert(_expr)
Definition: assert.h:32
MPG123_EXPORT int mpg123_param(mpg123_handle *mh, enum mpg123_parms type, long value, double fvalue)
Definition: libmpg123.c:127
MPG123_EXPORT mpg123_handle * mpg123_new(const char *decoder, int *error)
Definition: libmpg123.c:57
@ MPG123_IGNORE_INFOFRAME
Definition: mpg123.h:236
@ MPG123_ADD_FLAGS
Definition: mpg123.h:193
#define MPEGLAYER3_ID_MPEG
Definition: mmreg.h:442
#define MPEGLAYER3_WFX_EXTRA_BYTES
Definition: mmreg.h:439
#define ACM_STREAMOPENF_ASYNC
Definition: msacm.h:214
#define err(...)
#define DWORD_PTR
Definition: treelist.c:76

Referenced by MPEG3_DriverProc().

◆ MPEG3_StreamSize()

static LRESULT MPEG3_StreamSize ( PACMDRVSTREAMINSTANCE  adsi,
PACMDRVSTREAMSIZE  adss 
)
static

Definition at line 428 of file mpegl3.c.

429{
430 DWORD nblocks;
431
432 switch (adss->fdwSize)
433 {
435 /* cbDstLength => cbSrcLength */
436 if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
439 {
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;
444 }
445 else if ((adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3 ||
448 {
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);
453 }
454 else
455 {
457 }
458 break;
460 /* cbSrcLength => cbDstLength */
461 if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
464 {
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);
472 }
473 else if ((adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3 ||
476 {
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;
484 }
485 else
486 {
488 }
489 break;
490 default:
491 WARN("Unsupported query %08lx\n", adss->fdwSize);
493 }
494 return MMSYSERR_NOERROR;
495}
#define ACM_STREAMSIZEF_SOURCE
Definition: msacm.h:217
#define ACM_STREAMSIZEF_DESTINATION
Definition: msacm.h:218
#define DWORD
Definition: nt_native.h:44
PWAVEFORMATEX pwfxSrc
Definition: msacmdrv.h:100
PWAVEFORMATEX pwfxDst
Definition: msacmdrv.h:101

Referenced by MPEG3_DriverProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( mpeg3  )

Variable Documentation

◆ MPEG3_Formats

const Format MPEG3_Formats[]
static
Initial value:
=
{
{1, 0, 8000}, {2, 0, 8000},
{1, 0, 11025}, {2, 0, 11025},
{1, 0, 12000}, {2, 0, 12000},
{1, 0, 16000}, {2, 0, 16000},
{1, 0, 22050}, {2, 0, 22050},
{1, 0, 24000}, {2, 0, 24000},
{1, 0, 32000}, {2, 0, 32000},
{1, 0, 44100}, {2, 0, 44100},
{1, 0, 48000}, {2, 0, 48000}
}

Definition at line 63 of file mpegl3.c.

Referenced by MPEG3_GetFormatIndex().

◆ PCM_Formats

const Format PCM_Formats[]
static
Initial value:
=
{
{1, 8, 8000}, {2, 8, 8000}, {1, 16, 8000}, {2, 16, 8000},
{1, 8, 11025}, {2, 8, 11025}, {1, 16, 11025}, {2, 16, 11025},
{1, 8, 12000}, {2, 8, 12000}, {1, 16, 12000}, {2, 16, 12000},
{1, 8, 16000}, {2, 8, 16000}, {1, 16, 16000}, {2, 16, 16000},
{1, 8, 22050}, {2, 8, 22050}, {1, 16, 22050}, {2, 16, 22050},
{1, 8, 24000}, {2, 8, 24000}, {1, 16, 24000}, {2, 16, 24000},
{1, 8, 32000}, {2, 8, 32000}, {1, 16, 32000}, {2, 16, 32000},
{1, 8, 44100}, {2, 8, 44100}, {1, 16, 44100}, {2, 16, 44100},
{1, 8, 48000}, {2, 8, 48000}, {1, 16, 48000}, {2, 16, 48000}
}

Definition at line 50 of file mpegl3.c.

Referenced by MPEG3_FormatDetails(), MPEG3_FormatTagDetails(), and MPEG3_GetFormatIndex().