quartz: Fix frame length calculation for MPEG audio.

This commit is contained in:
Chris Robinson 2012-06-23 08:35:16 -07:00 committed by Alexandre Julliard
parent b2e3e2e943
commit 037cefc43b
1 changed files with 10 additions and 4 deletions

View File

@ -154,11 +154,17 @@ static HRESULT parse_header(BYTE *header, LONGLONG *plen, LONGLONG *pduration)
return E_INVALIDARG; return E_INVALIDARG;
} }
if (layer == 1)
if (layer == 3 || layer == 2)
length = 144 * bitrate / freqs[freq_index] + padding;
else
length = 4 * (12 * bitrate / freqs[freq_index] + padding); length = 4 * (12 * bitrate / freqs[freq_index] + padding);
else if (layer == 2)
length = 144 * bitrate / freqs[freq_index] + padding;
else if (layer == 3)
length = 144 * bitrate / (freqs[freq_index]<<lsf) + padding;
else
{
ERR("Impossible layer %d\n", layer);
return E_INVALIDARG;
}
duration = (ULONGLONG)10000000 * (ULONGLONG)(length) / (ULONGLONG)(bitrate/8); duration = (ULONGLONG)10000000 * (ULONGLONG)(length) / (ULONGLONG)(bitrate/8);
*plen = length; *plen = length;