Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create fake codec data for WMA3 #327

Merged
merged 1 commit into from
Dec 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/FAudio_platform_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,7 @@ static void FAudio_INTERNAL_DecodeWMAMF(
uint32_t FAudio_WMADEC_init(FAudioSourceVoice *voice, uint32_t type)
{
static const uint8_t fake_codec_data[16] = {0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
uint8_t fake_codec_data_wma3[18] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 224, 0, 0, 0};
const FAudioWaveFormatExtensible *wfx = (FAudioWaveFormatExtensible *)voice->src.format;
struct FAudioWMADEC *impl;
MFT_OUTPUT_STREAM_INFO info = {0};
Expand Down Expand Up @@ -1361,11 +1362,17 @@ uint32_t FAudio_WMADEC_init(FAudioSourceVoice *voice, uint32_t type)
FAudio_assert(!FAILED(hr) && "Failed set input block align!");
break;
case FAUDIO_FORMAT_WMAUDIO3:
*(uint16_t *)fake_codec_data_wma3 = voice->src.format->wBitsPerSample;
for (i = 0; i < voice->src.format->nChannels; i++)
{
fake_codec_data_wma3[2] <<= 1;
fake_codec_data_wma3[2] |= 1;
}
hr = IMFMediaType_SetBlob(
media_type,
&MF_MT_USER_DATA,
(void *)&wfx->Samples,
wfx->Format.cbSize
(void *)fake_codec_data_wma3,
sizeof(fake_codec_data_wma3)
);
FAudio_assert(!FAILED(hr) && "Failed set codec private data!");
hr = IMFMediaType_SetGUID(
Expand Down
Loading