Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a4fb357c
Commit
a4fb357c
authored
Mar 12, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 21, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat/mediatype: Force WAVEFORMATEXTENSIBLE in MFCreateWaveFormatExFromMFMediaType in some cases.
parent
689868cd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
9 deletions
+26
-9
mediatype.c
dlls/mfplat/mediatype.c
+25
-3
mfplat.c
dlls/mfplat/tests/mfplat.c
+0
-6
aac_decoder.c
dlls/winegstreamer/aac_decoder.c
+1
-0
No files found.
dlls/mfplat/mediatype.c
View file @
a4fb357c
...
...
@@ -2980,7 +2980,7 @@ HRESULT WINAPI MFCreateWaveFormatExFromMFMediaType(IMFMediaType *mediatype, WAVE
{
UINT32
value
,
extra_size
=
0
,
user_size
;
WAVEFORMATEX
*
format
;
GUID
major
,
subtype
;
GUID
major
,
subtype
,
basetype
=
MFAudioFormat_Base
;
void
*
user_data
;
HRESULT
hr
;
...
...
@@ -3002,6 +3002,19 @@ HRESULT WINAPI MFCreateWaveFormatExFromMFMediaType(IMFMediaType *mediatype, WAVE
user_size
=
0
;
}
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
mediatype
,
&
MF_MT_AUDIO_NUM_CHANNELS
,
&
value
))
&&
value
>
2
&&
SUCCEEDED
(
IMFMediaType_GetItem
(
mediatype
,
&
MF_MT_AUDIO_CHANNEL_MASK
,
NULL
)))
{
if
(
SUCCEEDED
(
IMFMediaType_GetItem
(
mediatype
,
&
MF_MT_AUDIO_VALID_BITS_PER_SAMPLE
,
NULL
)))
flags
=
MFWaveFormatExConvertFlag_ForceExtensible
;
if
(
SUCCEEDED
(
IMFMediaType_GetItem
(
mediatype
,
&
MF_MT_AUDIO_SAMPLES_PER_BLOCK
,
NULL
)))
flags
=
MFWaveFormatExConvertFlag_ForceExtensible
;
}
basetype
.
Data1
=
subtype
.
Data1
;
if
(
subtype
.
Data1
>>
16
||
!
IsEqualGUID
(
&
subtype
,
&
basetype
))
flags
=
MFWaveFormatExConvertFlag_ForceExtensible
;
if
(
flags
==
MFWaveFormatExConvertFlag_ForceExtensible
)
extra_size
=
sizeof
(
WAVEFORMATEXTENSIBLE
)
-
sizeof
(
*
format
);
...
...
@@ -3034,6 +3047,8 @@ HRESULT WINAPI MFCreateWaveFormatExFromMFMediaType(IMFMediaType *mediatype, WAVE
user_data
=
format_ext
+
1
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
mediatype
,
&
MF_MT_AUDIO_VALID_BITS_PER_SAMPLE
,
&
value
)))
format_ext
->
Samples
.
wValidBitsPerSample
=
value
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
mediatype
,
&
MF_MT_AUDIO_SAMPLES_PER_BLOCK
,
&
value
)))
format_ext
->
Samples
.
wSamplesPerBlock
=
value
;
if
(
SUCCEEDED
(
IMFMediaType_GetUINT32
(
mediatype
,
&
MF_MT_AUDIO_CHANNEL_MASK
,
&
value
)))
...
...
@@ -3080,6 +3095,8 @@ static void mediatype_set_blob(IMFMediaType *mediatype, const GUID *attr, const
HRESULT
WINAPI
MFInitMediaTypeFromWaveFormatEx
(
IMFMediaType
*
mediatype
,
const
WAVEFORMATEX
*
format
,
UINT32
size
)
{
const
WAVEFORMATEXTENSIBLE
*
wfex
=
(
const
WAVEFORMATEXTENSIBLE
*
)
format
;
const
void
*
user_data
;
int
user_data_size
;
GUID
subtype
;
HRESULT
hr
;
...
...
@@ -3104,6 +3121,9 @@ HRESULT WINAPI MFInitMediaTypeFromWaveFormatEx(IMFMediaType *mediatype, const WA
if
(
format
->
wBitsPerSample
&&
wfex
->
Samples
.
wValidBitsPerSample
)
mediatype_set_uint32
(
mediatype
,
&
MF_MT_AUDIO_VALID_BITS_PER_SAMPLE
,
wfex
->
Samples
.
wValidBitsPerSample
,
&
hr
);
user_data_size
=
format
->
cbSize
-
sizeof
(
WAVEFORMATEXTENSIBLE
)
+
sizeof
(
WAVEFORMATEX
);
user_data
=
wfex
+
1
;
}
else
{
...
...
@@ -3111,6 +3131,8 @@ HRESULT WINAPI MFInitMediaTypeFromWaveFormatEx(IMFMediaType *mediatype, const WA
subtype
.
Data1
=
format
->
wFormatTag
;
mediatype_set_uint32
(
mediatype
,
&
MF_MT_AUDIO_PREFER_WAVEFORMATEX
,
1
,
&
hr
);
user_data_size
=
format
->
cbSize
;
user_data
=
format
+
1
;
}
mediatype_set_guid
(
mediatype
,
&
MF_MT_SUBTYPE
,
&
subtype
,
&
hr
);
...
...
@@ -3144,8 +3166,8 @@ HRESULT WINAPI MFInitMediaTypeFromWaveFormatEx(IMFMediaType *mediatype, const WA
mediatype_set_uint32
(
mediatype
,
&
MF_MT_AAC_PAYLOAD_TYPE
,
info
->
wPayloadType
,
&
hr
);
}
if
(
format
->
cbSize
&&
format
->
wFormatTag
!=
WAVE_FORMAT_EXTENSIBLE
)
mediatype_set_blob
(
mediatype
,
&
MF_MT_USER_DATA
,
(
const
UINT8
*
)(
format
+
1
),
format
->
cbS
ize
,
&
hr
);
if
(
user_data_size
>
0
)
mediatype_set_blob
(
mediatype
,
&
MF_MT_USER_DATA
,
user_data
,
user_data_s
ize
,
&
hr
);
return
hr
;
}
...
...
dlls/mfplat/tests/mfplat.c
View file @
a4fb357c
...
...
@@ -7135,18 +7135,12 @@ static void test_MFInitMediaTypeFromWaveFormatEx(void)
ok
(
hr
==
S_OK
,
"Failed to get attribute, hr %#lx.
\n
"
,
hr
);
hr
=
MFCreateWaveFormatExFromMFMediaType
(
mediatype
,
(
WAVEFORMATEX
**
)
&
format
,
&
size
,
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
format
->
Format
.
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
,
"got wFormatTag %#x
\n
"
,
format
->
Format
.
wFormatTag
);
todo_wine
ok
(
format
->
Format
.
cbSize
==
aacformat
.
wfInfo
.
wfx
.
cbSize
+
sizeof
(
WAVEFORMATEXTENSIBLE
)
-
sizeof
(
WAVEFORMATEX
),
"got cbSize %u
\n
"
,
format
->
Format
.
cbSize
);
todo_wine
ok
(
IsEqualGUID
(
&
format
->
SubFormat
,
&
MFAudioFormat_AAC
),
"got SubFormat %s
\n
"
,
debugstr_guid
(
&
format
->
SubFormat
));
todo_wine
ok
(
format
->
dwChannelMask
==
63
,
"got dwChannelMask %#lx
\n
"
,
format
->
dwChannelMask
);
todo_wine
ok
(
format
->
Samples
.
wSamplesPerBlock
==
4
,
"got wSamplesPerBlock %u
\n
"
,
format
->
Samples
.
wSamplesPerBlock
);
todo_wine
ok
(
!
memcmp
(
format
+
1
,
&
aacformat
.
wfInfo
.
wfx
+
1
,
aacformat
.
wfInfo
.
wfx
.
cbSize
),
"Unexpected user data.
\n
"
);
/* test initializing media type from an WAVE_FORMAT_EXTENSIBLE AAC format */
...
...
dlls/winegstreamer/aac_decoder.c
View file @
a4fb357c
...
...
@@ -292,6 +292,7 @@ static HRESULT WINAPI transform_GetOutputAvailableType(IMFTransform *iface, DWOR
wfx
.
SubFormat
=
MFAudioFormat_Base
;
wfx
.
SubFormat
.
Data1
=
wfx
.
Format
.
wFormatTag
;
wfx
.
Format
.
wFormatTag
=
WAVE_FORMAT_EXTENSIBLE
;
wfx
.
Format
.
cbSize
=
sizeof
(
WAVEFORMATEXTENSIBLE
)
-
sizeof
(
WAVEFORMATEX
);
wfx
.
dwChannelMask
=
default_channel_mask
[
wfx
.
Format
.
nChannels
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment