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
26876b4a
Commit
26876b4a
authored
Mar 21, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat: Append MFVIDEOFORMAT user data after the structure padding.
Instead of using the last palette entry, which might be misaligned.
parent
c11f9a8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
mediatype.c
dlls/mfplat/mediatype.c
+6
-2
mfplat.c
dlls/mfplat/tests/mfplat.c
+14
-0
No files found.
dlls/mfplat/mediatype.c
View file @
26876b4a
...
@@ -3864,10 +3864,14 @@ HRESULT WINAPI MFInitMediaTypeFromMFVideoFormat(IMFMediaType *media_type, const
...
@@ -3864,10 +3864,14 @@ HRESULT WINAPI MFInitMediaTypeFromMFVideoFormat(IMFMediaType *media_type, const
if
(
format
->
compressedInfo
.
MaxKeyFrameSpacing
)
if
(
format
->
compressedInfo
.
MaxKeyFrameSpacing
)
mediatype_set_uint32
(
media_type
,
&
MF_MT_MAX_KEYFRAME_SPACING
,
format
->
compressedInfo
.
MaxKeyFrameSpacing
,
&
hr
);
mediatype_set_uint32
(
media_type
,
&
MF_MT_MAX_KEYFRAME_SPACING
,
format
->
compressedInfo
.
MaxKeyFrameSpacing
,
&
hr
);
if
((
palette_size
=
format
->
surfaceInfo
.
PaletteEntries
*
sizeof
(
*
format
->
surfaceInfo
.
Palette
)))
if
(
!
(
palette_size
=
format
->
surfaceInfo
.
PaletteEntries
*
sizeof
(
*
format
->
surfaceInfo
.
Palette
)))
user_data
=
format
+
1
;
else
{
mediatype_set_blob
(
media_type
,
&
MF_MT_PALETTE
,
(
BYTE
*
)
format
->
surfaceInfo
.
Palette
,
palette_size
,
&
hr
);
mediatype_set_blob
(
media_type
,
&
MF_MT_PALETTE
,
(
BYTE
*
)
format
->
surfaceInfo
.
Palette
,
palette_size
,
&
hr
);
user_data
=
&
format
->
surfaceInfo
.
Palette
[
format
->
surfaceInfo
.
PaletteEntries
+
1
];
}
user_data
=
&
format
->
surfaceInfo
.
Palette
[
format
->
surfaceInfo
.
PaletteEntries
+
1
];
if
((
user_data_size
=
(
BYTE
*
)
format
+
format
->
dwSize
-
(
BYTE
*
)
user_data
))
if
((
user_data_size
=
(
BYTE
*
)
format
+
format
->
dwSize
-
(
BYTE
*
)
user_data
))
mediatype_set_blob
(
media_type
,
&
MF_MT_USER_DATA
,
user_data
,
user_data_size
,
&
hr
);
mediatype_set_blob
(
media_type
,
&
MF_MT_USER_DATA
,
user_data
,
user_data_size
,
&
hr
);
...
...
dlls/mfplat/tests/mfplat.c
View file @
26876b4a
...
@@ -8448,6 +8448,20 @@ static void test_MFInitMediaTypeFromMFVideoFormat(void)
...
@@ -8448,6 +8448,20 @@ static void test_MFInitMediaTypeFromMFVideoFormat(void)
ok
(
!
memcmp
(
user_data
,
expect_user_data
,
value32
),
"Unexpected user data.
\n
"
);
ok
(
!
memcmp
(
user_data
,
expect_user_data
,
value32
),
"Unexpected user data.
\n
"
);
IMFMediaType_DeleteAllItems
(
media_type
);
IMFMediaType_DeleteAllItems
(
media_type
);
/* check that user data follows MFVIDEOFORMAT struct, which is padded, when no palette is present */
format_buf
->
surfaceInfo
.
PaletteEntries
=
0
;
memmove
(
format_buf
+
1
,
expect_user_data
,
sizeof
(
expect_user_data
));
format_buf
->
dwSize
=
sizeof
(
*
format_buf
)
+
sizeof
(
expect_user_data
);
hr
=
MFInitMediaTypeFromMFVideoFormat
(
media_type
,
format_buf
,
format_buf
->
dwSize
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
value32
=
0xdeadbeef
;
memset
(
&
user_data
,
0xcd
,
sizeof
(
user_data
));
hr
=
IMFMediaType_GetBlob
(
media_type
,
&
MF_MT_USER_DATA
,
(
BYTE
*
)
user_data
,
sizeof
(
user_data
),
&
value32
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
value32
==
sizeof
(
expect_user_data
),
"got %u.
\n
"
,
value32
);
ok
(
!
memcmp
(
user_data
,
expect_user_data
,
value32
),
"Unexpected user data.
\n
"
);
IMFMediaType_DeleteAllItems
(
media_type
);
IMFMediaType_Release
(
media_type
);
IMFMediaType_Release
(
media_type
);
}
}
...
...
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