Rebase against cf5616ffbb39df7ad3ac0a41e55777ab6c1abab9.

This commit is contained in:
Sebastian Lackner 2017-10-14 10:21:44 +02:00
parent 71bcbb308e
commit 5149b192c9
4 changed files with 8 additions and 177 deletions

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "4b028bb09cb9563e111fedab0f4c3663dc278d0a"
echo "cf5616ffbb39df7ad3ac0a41e55777ab6c1abab9"
}
# Show version information
@ -481,7 +481,6 @@ patch_enable_all ()
enable_winedevice_Fix_Relocation="$1"
enable_winemenubuilder_Desktop_Icon_Path="$1"
enable_winemp3_acm_MPEG3_StreamOpen="$1"
enable_winemp3_acm_Revert_MPEG_Encode="$1"
enable_wineps_drv_PostScript_Fixes="$1"
enable_winepulse_PulseAudio_Support="$1"
enable_winex11_CandidateWindowPos="$1"
@ -1727,9 +1726,6 @@ patch_enable ()
winemp3.acm-MPEG3_StreamOpen)
enable_winemp3_acm_MPEG3_StreamOpen="$2"
;;
winemp3.acm-Revert_MPEG_Encode)
enable_winemp3_acm_Revert_MPEG_Encode="$2"
;;
wineps.drv-PostScript_Fixes)
enable_wineps_drv_PostScript_Fixes="$2"
;;
@ -10208,27 +10204,12 @@ fi
# Patchset winemp3.acm-MPEG3_StreamOpen
# |
# | Modified files:
# | * dlls/msacm32/tests/msacm.c, dlls/winemp3.acm/mpegl3.c
# | * dlls/l3codeca.acm/mpegl3.c, dlls/msacm32/tests/msacm.c
# |
if test "$enable_winemp3_acm_MPEG3_StreamOpen" -eq 1; then
patch_apply winemp3.acm-MPEG3_StreamOpen/0001-winemp3.acm-Check-input-format-in-MPEG3_StreamOpen.patch
(
printf '%s\n' '+ { "Michael Müller", "winemp3.acm: Check input format in MPEG3_StreamOpen.", 1 },';
) >> "$patchlist"
fi
# Patchset winemp3.acm-Revert_MPEG_Encode
# |
# | This patchset fixes the following Wine bugs:
# | * [#43236] Revert patch which broke in-game audio in multiple games
# |
# | Modified files:
# | * dlls/winemp3.acm/mpegl3.c
# |
if test "$enable_winemp3_acm_Revert_MPEG_Encode" -eq 1; then
patch_apply winemp3.acm-Revert_MPEG_Encode/0001-Revert-winemp3.acm-Disallow-operations-encoding-to-M.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "Revert \"winemp3.acm: Disallow operations encoding to MPEG.\".", 1 },';
printf '%s\n' '+ { "Michael Müller", "l3codeca.acm: Check input format in MPEG3_StreamOpen.", 1 },';
) >> "$patchlist"
fi

View File

@ -1,11 +1,11 @@
From 021f484e633dc4cebb04e011fab3a6f2ee8e2336 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 21 Aug 2016 02:36:47 +0200
Subject: winemp3.acm: Check input format in MPEG3_StreamOpen.
Subject: l3codeca.acm: Check input format in MPEG3_StreamOpen.
---
dlls/msacm32/tests/msacm.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/winemp3.acm/mpegl3.c | 15 +++++++++-
dlls/l3codeca.acm/mpegl3.c | 15 +++++++++-
2 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/dlls/msacm32/tests/msacm.c b/dlls/msacm32/tests/msacm.c
@ -97,10 +97,10 @@ index 959ec7f0c06..ea98934c198 100644
/* Test acmDriverAdd in the end as it may conflict
* with other tests due to codec lookup order */
test_acmDriverAdd();
diff --git a/dlls/winemp3.acm/mpegl3.c b/dlls/winemp3.acm/mpegl3.c
diff --git a/dlls/l3codeca.acm/mpegl3.c b/dlls/l3codeca.acm/mpegl3.c
index 0e419bd66dc..b28519f835a 100644
--- a/dlls/winemp3.acm/mpegl3.c
+++ b/dlls/winemp3.acm/mpegl3.c
--- a/dlls/l3codeca.acm/mpegl3.c
+++ b/dlls/l3codeca.acm/mpegl3.c
@@ -215,6 +215,7 @@ static void MPEG3_Reset(PACMDRVSTREAMINSTANCE adsi, AcmMpeg3Data* aad)
*/
static LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi)

View File

@ -1,149 +0,0 @@
From 0b9117d270da2ff2e658cb2b9eea5b4824c1d458 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 9 Jul 2017 16:08:42 +0200
Subject: Revert "winemp3.acm: Disallow operations encoding to MPEG."
This reverts commit ae34a0f5407ffac492e9bfb5ce5b4267183ea4c5.
---
dlls/winemp3.acm/mpegl3.c | 80 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 63 insertions(+), 17 deletions(-)
diff --git a/dlls/winemp3.acm/mpegl3.c b/dlls/winemp3.acm/mpegl3.c
index b28519f835a..b5ba4c6d834 100644
--- a/dlls/winemp3.acm/mpegl3.c
+++ b/dlls/winemp3.acm/mpegl3.c
@@ -271,13 +271,10 @@ static LRESULT MPEG3_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
mpg123_param(aad->mh, MPG123_ADD_FLAGS, MPG123_IGNORE_INFOFRAME, 0);
#endif
}
+ /* no encoding yet
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
- (adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEGLAYER3 ||
- adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEG))
- {
- WARN("Encoding to MPEG is not supported\n");
- goto theEnd;
- }
+ adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MPEGLAYER3)
+ */
else goto theEnd;
MPEG3_Reset(adsi, aad);
@@ -752,19 +749,54 @@ static LRESULT MPEG3_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
case 1:
aftd->dwFormatTag = WAVE_FORMAT_MPEGLAYER3;
aftd->cbFormatSize = sizeof(MPEGLAYER3WAVEFORMAT);
- aftd->cStandardFormats = 0;
+ aftd->cStandardFormats = NUM_MPEG3_FORMATS;
lstrcpyW(aftd->szFormatTag, szMpeg3);
break;
case 2:
aftd->dwFormatTag = WAVE_FORMAT_MPEG;
aftd->cbFormatSize = sizeof(MPEG1WAVEFORMAT);
- aftd->cStandardFormats = 0;
+ aftd->cStandardFormats = NUM_MPEG3_FORMATS;
lstrcpyW(aftd->szFormatTag, szMpeg);
break;
}
return MMSYSERR_NOERROR;
}
+static void fill_in_mp3(unsigned cbwfx, WAVEFORMATEX* wfx, unsigned bit_rate)
+{
+ MPEGLAYER3WAVEFORMAT* mp3wfx = (MPEGLAYER3WAVEFORMAT*)wfx;
+
+ wfx->nAvgBytesPerSec = bit_rate / 8;
+ if (cbwfx >= sizeof(WAVEFORMATEX))
+ wfx->cbSize = sizeof(MPEGLAYER3WAVEFORMAT) - sizeof(WAVEFORMATEX);
+ if (cbwfx >= sizeof(MPEGLAYER3WAVEFORMAT))
+ {
+ mp3wfx->wID = MPEGLAYER3_ID_MPEG;
+ mp3wfx->fdwFlags = MPEGLAYER3_FLAG_PADDING_OFF;
+ mp3wfx->nBlockSize = (bit_rate * 144) / wfx->nSamplesPerSec;
+ mp3wfx->nFramesPerBlock = 1;
+ mp3wfx->nCodecDelay = 0x0571;
+ }
+}
+
+static void fill_in_mpeg(unsigned cbwfx, WAVEFORMATEX* wfx, unsigned bit_rate)
+{
+ MPEG1WAVEFORMAT* mp3wfx = (MPEG1WAVEFORMAT*)wfx;
+
+ wfx->nAvgBytesPerSec = bit_rate / 8;
+ if (cbwfx >= sizeof(WAVEFORMATEX))
+ wfx->cbSize = sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX);
+ if (cbwfx >= sizeof(MPEG1WAVEFORMAT))
+ {
+ mp3wfx->fwHeadLayer = ACM_MPEG_LAYER3;
+ mp3wfx->dwHeadBitrate = wfx->nAvgBytesPerSec * 8;
+ mp3wfx->fwHeadMode = ACM_MPEG_JOINTSTEREO;
+ mp3wfx->fwHeadModeExt = 0xf;
+ mp3wfx->wHeadEmphasis = 1;
+ mp3wfx->fwHeadFlags = ACM_MPEG_ID_MPEG1;
+ }
+}
+
/***********************************************************************
* MPEG3_FormatDetails
*
@@ -795,8 +827,16 @@ static LRESULT MPEG3_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
break;
case WAVE_FORMAT_MPEGLAYER3:
case WAVE_FORMAT_MPEG:
- WARN("Encoding to MPEG is not supported\n");
- return ACMERR_NOTPOSSIBLE;
+ if (afd->dwFormatIndex >= NUM_MPEG3_FORMATS) return ACMERR_NOTPOSSIBLE;
+ afd->pwfx->nChannels = MPEG3_Formats[afd->dwFormatIndex].nChannels;
+ afd->pwfx->nSamplesPerSec = MPEG3_Formats[afd->dwFormatIndex].rate;
+ afd->pwfx->wBitsPerSample = MPEG3_Formats[afd->dwFormatIndex].nBits;
+ afd->pwfx->nBlockAlign = 1;
+ if (afd->dwFormatTag == WAVE_FORMAT_MPEGLAYER3)
+ fill_in_mp3(afd->cbwfx, afd->pwfx, 192000);
+ else
+ fill_in_mpeg(afd->cbwfx, afd->pwfx, 192000);
+ break;
default:
WARN("Unsupported tag %08x\n", afd->dwFormatTag);
return MMSYSERR_INVALPARAM;
@@ -829,15 +869,18 @@ static LRESULT MPEG3_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC))
adfs->pwfxDst->nSamplesPerSec = adfs->pwfxSrc->nSamplesPerSec;
+
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE))
- adfs->pwfxDst->wBitsPerSample = 16;
+ {
+ if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
+ adfs->pwfxDst->wBitsPerSample = 4;
+ else
+ adfs->pwfxDst->wBitsPerSample = 16;
+ }
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG))
{
if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
- {
- WARN("Encoding to MPEG is not supported\n");
- return ACMERR_NOTPOSSIBLE;
- }
+ adfs->pwfxDst->wFormatTag = WAVE_FORMAT_MPEGLAYER3;
else
adfs->pwfxDst->wFormatTag = WAVE_FORMAT_PCM;
}
@@ -853,9 +896,12 @@ static LRESULT MPEG3_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * adfs->pwfxDst->nBlockAlign;
break;
case WAVE_FORMAT_MPEG:
+ adfs->pwfxDst->nBlockAlign = 1;
+ fill_in_mpeg(adfs->cbwfxDst, adfs->pwfxDst, 192000);
+ break;
case WAVE_FORMAT_MPEGLAYER3:
- WARN("Encoding to MPEG is not supported\n");
- return ACMERR_NOTPOSSIBLE;
+ adfs->pwfxDst->nBlockAlign = 1;
+ fill_in_mp3(adfs->cbwfxDst, adfs->pwfxDst, 192000);
break;
default:
FIXME("\n");
--
2.13.1

View File

@ -1 +0,0 @@
Fixes: [43236] Revert patch which broke in-game audio in multiple games