quartz: Take MP3 padding bit into account when calculating the block size
Andrew Eikum
aeikum at codeweavers.com
Tue Nov 22 09:18:36 CST 2016
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Tue, Nov 22, 2016 at 04:14:59AM -0200, Bruno Jesus wrote:
> This is already done inside this same file at [1] and also in winemp3.acm [2]
>
> [1] https://source.winehq.org/source/dlls/quartz/mpegsplit.c#0123
> [2] https://source.winehq.org/source/dlls/winemp3.acm/mpegl3.c#0361
>
> Fixes bug https://bugs.winehq.org/show_bug.cgi?id=41290
>
> Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
> ---
> dlls/quartz/mpegsplit.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/dlls/quartz/mpegsplit.c b/dlls/quartz/mpegsplit.c
> index 8d42bd8..41221d4 100644
> --- a/dlls/quartz/mpegsplit.c
> +++ b/dlls/quartz/mpegsplit.c
> @@ -367,6 +367,7 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade
> int freq_index;
> int mode_ext;
> int emphasis;
> + int padding;
> int lsf = 1;
> int mpeg1;
> int layer;
> @@ -391,6 +392,7 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade
>
> layer = 4-((header[1]>>1)&0x3);
> bitrate_index = ((header[2]>>4)&0xf);
> + padding = ((header[2]>>1)&0x1);
> freq_index = ((header[2]>>2)&0x3) + (mpeg1?(lsf*3):6);
> mode = ((header[3]>>6)&0x3);
> mode_ext = ((header[3]>>4)&0x3);
> @@ -419,12 +421,12 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade
>
> if (layer == 3)
> format->nBlockAlign = format->nAvgBytesPerSec * 8 * 144 /
> - (format->nSamplesPerSec<<lsf) + 1;
> + (format->nSamplesPerSec<<lsf) + padding;
> else if (layer == 2)
> format->nBlockAlign = format->nAvgBytesPerSec * 8 * 144 /
> - format->nSamplesPerSec + 1;
> + format->nSamplesPerSec + padding;
> else
> - format->nBlockAlign = 4 * (format->nAvgBytesPerSec * 8 * 12 / format->nSamplesPerSec + 1);
> + format->nBlockAlign = 4 * (format->nAvgBytesPerSec * 8 * 12 / format->nSamplesPerSec + padding);
>
> format->wBitsPerSample = 0;
>
> --
> 2.9.3
>
>
>
More information about the wine-patches
mailing list