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
c1223d0b
Commit
c1223d0b
authored
Aug 08, 2023
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Feb 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf/tests: Add a create_test_topology() helper.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
parent
8173d3b0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
37 deletions
+43
-37
mf.c
dlls/mf/tests/mf.c
+43
-37
No files found.
dlls/mf/tests/mf.c
View file @
c1223d0b
...
...
@@ -4997,6 +4997,48 @@ static void test_sample_grabber_is_mediatype_supported(void)
IMFSampleGrabberSinkCallback_Release
(
grabber_callback
);
}
/* create a test topology with the specified source and sink */
static
IMFTopology
*
create_test_topology
(
IMFMediaSource
*
source
,
IMFActivate
*
sink_activate
)
{
IMFTopologyNode
*
src_node
,
*
sink_node
;
IMFPresentationDescriptor
*
pd
;
IMFTopology
*
topology
=
NULL
;
IMFStreamDescriptor
*
sd
;
BOOL
selected
;
HRESULT
hr
;
hr
=
MFCreateTopology
(
&
topology
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFCreateTopologyNode
(
MF_TOPOLOGY_OUTPUT_NODE
,
&
sink_node
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFCreateTopologyNode
(
MF_TOPOLOGY_SOURCESTREAM_NODE
,
&
src_node
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFTopology_AddNode
(
topology
,
sink_node
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFTopology_AddNode
(
topology
,
src_node
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFTopologyNode_ConnectOutput
(
src_node
,
0
,
sink_node
,
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaSource_CreatePresentationDescriptor
(
source
,
&
pd
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPresentationDescriptor_GetStreamDescriptorByIndex
(
pd
,
0
,
&
selected
,
&
sd
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
selected
,
"got selected %u.
\n
"
,
!!
selected
);
init_source_node
(
source
,
-
1
,
src_node
,
pd
,
sd
);
hr
=
IMFTopologyNode_SetObject
(
sink_node
,
(
IUnknown
*
)
sink_activate
);
ok
(
hr
==
S_OK
,
"Failed to set object, hr %#lx.
\n
"
,
hr
);
hr
=
IMFTopologyNode_SetUINT32
(
sink_node
,
&
MF_TOPONODE_CONNECT_METHOD
,
MF_CONNECT_ALLOW_DECODER
);
ok
(
hr
==
S_OK
,
"Failed to set connect method, hr %#lx.
\n
"
,
hr
);
hr
=
IMFTopology_SetUINT32
(
topology
,
&
MF_TOPOLOGY_ENUMERATE_SOURCE_TYPES
,
TRUE
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
IMFStreamDescriptor_Release
(
sd
);
IMFPresentationDescriptor_Release
(
pd
);
IMFTopologyNode_Release
(
src_node
);
IMFTopologyNode_Release
(
sink_node
);
return
topology
;
}
static
void
test_sample_grabber_orientation
(
GUID
subtype
)
{
media_type_desc
video_rgb32_desc
=
...
...
@@ -5006,17 +5048,13 @@ static void test_sample_grabber_orientation(GUID subtype)
};
struct
test_grabber_callback
*
grabber_callback
;
IMFTopologyNode
*
src_node
,
*
sink_node
;
IMFPresentationDescriptor
*
pd
;
IMFAsyncCallback
*
callback
;
IMFActivate
*
sink_activate
;
IMFMediaType
*
output_type
;
IMFMediaSession
*
session
;
IMFStreamDescriptor
*
sd
;
IMFMediaSource
*
source
;
IMFTopology
*
topology
;
PROPVARIANT
propvar
;
BOOL
selected
;
HRESULT
hr
;
DWORD
res
;
...
...
@@ -5040,30 +5078,6 @@ static void test_sample_grabber_orientation(GUID subtype)
hr
=
MFCreateMediaSession
(
NULL
,
&
session
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFCreateTopologyNode
(
MF_TOPOLOGY_OUTPUT_NODE
,
&
sink_node
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFCreateTopologyNode
(
MF_TOPOLOGY_SOURCESTREAM_NODE
,
&
src_node
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFCreateTopology
(
&
topology
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFTopology_AddNode
(
topology
,
sink_node
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFTopology_AddNode
(
topology
,
src_node
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFTopologyNode_ConnectOutput
(
src_node
,
0
,
sink_node
,
0
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaSource_CreatePresentationDescriptor
(
source
,
&
pd
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFPresentationDescriptor_GetStreamDescriptorByIndex
(
pd
,
0
,
&
selected
,
&
sd
);
ok
(
selected
,
"got selected %u.
\n
"
,
!!
selected
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
init_source_node
(
source
,
-
1
,
src_node
,
pd
,
sd
);
IMFTopologyNode_Release
(
src_node
);
IMFPresentationDescriptor_Release
(
pd
);
IMFStreamDescriptor_Release
(
sd
);
hr
=
MFCreateMediaType
(
&
output_type
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
init_media_type
(
output_type
,
video_rgb32_desc
,
-
1
);
...
...
@@ -5071,15 +5085,7 @@ static void test_sample_grabber_orientation(GUID subtype)
ok
(
hr
==
S_OK
,
"Failed to create grabber sink, hr %#lx.
\n
"
,
hr
);
IMFMediaType_Release
(
output_type
);
hr
=
IMFTopologyNode_SetObject
(
sink_node
,
(
IUnknown
*
)
sink_activate
);
ok
(
hr
==
S_OK
,
"Failed to set object, hr %#lx.
\n
"
,
hr
);
hr
=
IMFTopologyNode_SetUINT32
(
sink_node
,
&
MF_TOPONODE_CONNECT_METHOD
,
MF_CONNECT_ALLOW_DECODER
);
ok
(
hr
==
S_OK
,
"Failed to set connect method, hr %#lx.
\n
"
,
hr
);
IMFTopologyNode_Release
(
sink_node
);
hr
=
IMFTopology_SetUINT32
(
topology
,
&
MF_TOPOLOGY_ENUMERATE_SOURCE_TYPES
,
TRUE
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
topology
=
create_test_topology
(
source
,
sink_activate
);
hr
=
IMFMediaSession_SetTopology
(
session
,
0
,
topology
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
IMFTopology_Release
(
topology
);
...
...
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