* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
+#include <config.h>
+//#include "wine/port.h"
#include <assert.h>
#include <stdarg.h>
-#include <string.h>
+//#include <string.h>
#ifdef HAVE_MPG123_H
# include <mpg123.h>
# endif
#endif
-#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 <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>
WINE_DEFAULT_DEBUG_CHANNEL(mpeg3);
*/
static LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
{
+ LRESULT error = MMSYSERR_NOTSUPPORTED;
AcmMpeg3Data* aad;
int err;
adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEG) &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
+ if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3)
+ {
+ MPEGLAYER3WAVEFORMAT *formatmp3 = (MPEGLAYER3WAVEFORMAT *)adsi->pwfxSrc;
+
+ if (adsi->pwfxSrc->cbSize < MPEGLAYER3_WFX_EXTRA_BYTES ||
+ formatmp3->wID != MPEGLAYER3_ID_MPEG)
+ {
+ error = ACMERR_NOTPOSSIBLE;
+ goto theEnd;
+ }
+ }
+
/* resampling or mono <=> stereo not available
* MPEG3 algo only define 16 bit per sample output
*/
aad->convert = mp3_horse;
aad->mh = mpg123_new(NULL,&err);
mpg123_open_feed(aad->mh);
+
+#if MPG123_API_VERSION >= 31 /* needed for MPG123_IGNORE_FRAMEINFO enum value */
+ /* mpg123 may find a XING header in the mp3 and use that information
+ * to ask for seeks in order to read specific frames in the file.
+ * We cannot allow that since the caller application is feeding us.
+ * This fixes problems for mp3 files encoded with LAME (bug 42361)
+ */
+ mpg123_param(aad->mh, MPG123_ADD_FLAGS, MPG123_IGNORE_INFOFRAME, 0);
+#endif
}
/* no encoding yet
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
theEnd:
HeapFree(GetProcessHeap(), 0, aad);
adsi->dwDriver = 0L;
- return MMSYSERR_NOTSUPPORTED;
+ return error;
}
/***********************************************************************
{
add->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
add->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
- add->wMid = 0xFF;
- add->wPid = 0x00;
+ add->wMid = MM_FRAUNHOFER_IIS;
+ add->wPid = MM_FHGIIS_MPEGLAYER3_DECODE;
add->vdwACM = 0x01000000;
add->vdwDriver = 0x01000000;
add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
add->cFormatTags = 3; /* PCM, MPEG3 */
add->cFilterTags = 0;
add->hicon = NULL;
- MultiByteToWideChar( CP_ACP, 0, "WINE-MPEG3", -1,
+ MultiByteToWideChar( CP_ACP, 0, "MPEG Layer-3 Codec", -1,
add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Wine MPEG3 decoder", -1,
add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) );
aftd->dwFormatTagIndex = 2; /* WAVE_FORMAT_MPEG is biggest */
break;
}
- /* fall thru */
+ /* fall through */
case ACM_FORMATTAGDETAILSF_FORMATTAG:
switch (aftd->dwFormatTag)
{
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEG))
{
nblocks = adss->cbSrcLength / (adsi->pwfxSrc->nBlockAlign * 1152);
- if (nblocks == 0)
- return ACMERR_NOTPOSSIBLE;
if (adss->cbSrcLength % (DWORD)(adsi->pwfxSrc->nBlockAlign * 1152))
/* Round block count up. */
nblocks++;
+ if (nblocks == 0)
+ return ACMERR_NOTPOSSIBLE;
adss->cbDstLength = 3000 + nblocks * (DWORD)(adsi->pwfxDst->nAvgBytesPerSec * 1152 / adsi->pwfxDst->nSamplesPerSec + 0.5);
}
else if ((adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_MPEGLAYER3 ||
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
nblocks = adss->cbSrcLength / (DWORD)(adsi->pwfxSrc->nAvgBytesPerSec * 1152 / adsi->pwfxSrc->nSamplesPerSec);
- if (nblocks == 0)
- return ACMERR_NOTPOSSIBLE;
if (adss->cbSrcLength % (DWORD)(adsi->pwfxSrc->nAvgBytesPerSec * 1152 / adsi->pwfxSrc->nSamplesPerSec))
/* Round block count up. */
nblocks++;
+ if (nblocks == 0)
+ return ACMERR_NOTPOSSIBLE;
adss->cbDstLength = nblocks * 1152 * adsi->pwfxDst->nBlockAlign;
}
else