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
9de7895e
Commit
9de7895e
authored
May 28, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfmediaengine/tests: Use global factory instance.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e2c681a8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
16 deletions
+69
-16
mfmediaengine.c
dlls/mfmediaengine/tests/mfmediaengine.c
+69
-16
No files found.
dlls/mfmediaengine/tests/mfmediaengine.c
View file @
9de7895e
...
...
@@ -35,6 +35,8 @@
static
HRESULT
(
WINAPI
*
pMFCreateDXGIDeviceManager
)(
UINT
*
token
,
IMFDXGIDeviceManager
**
manager
);
static
IMFMediaEngineClassFactory
*
factory
;
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
static
void
_expect_ref
(
IUnknown
*
obj
,
ULONG
ref
,
int
line
)
{
...
...
@@ -114,25 +116,20 @@ static void test_factory(void)
UINT
token
;
HRESULT
hr
;
CoInitialize
(
NULL
);
hr
=
CoCreateInstance
(
&
CLSID_MFMediaEngineClassFactory
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMFMediaEngineClassFactory
,
(
void
**
)
&
factory
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
REGDB_E_CLASSNOTREG
)
/* pre-win8 */
,
"Failed to create class factory, hr %#x.
\n
"
,
hr
);
hr
=
CoCreateInstance
(
&
CLSID_MFMediaEngineClassFactory
,
(
IUnknown
*
)
factory
,
CLSCTX_INPROC_SERVER
,
&
IID_IMFMediaEngineClassFactory
,
(
void
**
)
&
factory2
);
ok
(
hr
==
CLASS_E_NOAGGREGATION
||
broken
(
hr
==
REGDB_E_CLASSNOTREG
)
/* pre-win8 */
,
"Unexpected hr %#x.
\n
"
,
hr
);
if
(
!
factory
)
hr
=
CoCreateInstance
(
&
CLSID_MFMediaEngineClassFactory
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMFMediaEngineClassFactory
,
(
void
**
)
&
factory
);
ok
(
hr
==
S_OK
||
broken
(
hr
==
REGDB_E_CLASSNOTREG
)
/* pre-win8 */
,
"Failed to create class factory, hr %#x.
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
win_skip
(
"Not IMFMediaEngineClassFactory support.
\n
"
);
CoUninitialize
();
win_skip
(
"Media Engine is not supported.
\n
"
);
return
;
}
/* Aggregation is not supported. */
hr
=
CoCreateInstance
(
&
CLSID_MFMediaEngineClassFactory
,
(
IUnknown
*
)
factory
,
CLSCTX_INPROC_SERVER
,
&
IID_IMFMediaEngineClassFactory
,
(
void
**
)
&
factory2
);
ok
(
hr
==
CLASS_E_NOAGGREGATION
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
pMFCreateDXGIDeviceManager
(
&
token
,
&
manager
);
ok
(
hr
==
S_OK
,
"MFCreateDXGIDeviceManager failed: %#x.
\n
"
,
hr
);
hr
=
MFCreateAttributes
(
&
attributes
,
3
);
...
...
@@ -163,20 +160,76 @@ static void test_factory(void)
IMFAttributes_Release
(
attributes
);
IMFDXGIDeviceManager_Release
(
manager
);
IMFMediaEngineClassFactory_Release
(
factory
);
}
CoUninitialize
();
static
void
test_CreateInstance
(
void
)
{
struct
media_engine_notify
notify_impl
=
{{
&
media_engine_notify_vtbl
},
1
};
IMFMediaEngineNotify
*
notify
=
&
notify_impl
.
IMFMediaEngineNotify_iface
;
IMFDXGIDeviceManager
*
manager
;
IMFMediaEngine
*
media_engine
;
IMFAttributes
*
attributes
;
UINT
token
;
HRESULT
hr
;
hr
=
pMFCreateDXGIDeviceManager
(
&
token
,
&
manager
);
ok
(
hr
==
S_OK
,
"Failed to create dxgi device manager, hr %#x.
\n
"
,
hr
);
hr
=
MFCreateAttributes
(
&
attributes
,
3
);
ok
(
hr
==
S_OK
,
"Failed to create attributes, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngineClassFactory_CreateInstance
(
factory
,
MF_MEDIA_ENGINE_WAITFORSTABLE_STATE
,
attributes
,
&
media_engine
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFAttributes_SetUnknown
(
attributes
,
&
MF_MEDIA_ENGINE_OPM_HWND
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngineClassFactory_CreateInstance
(
factory
,
MF_MEDIA_ENGINE_WAITFORSTABLE_STATE
,
attributes
,
&
media_engine
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#x.
\n
"
,
hr
);
IMFAttributes_DeleteAllItems
(
attributes
);
hr
=
IMFAttributes_SetUnknown
(
attributes
,
&
MF_MEDIA_ENGINE_CALLBACK
,
(
IUnknown
*
)
notify
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFAttributes_SetUINT32
(
attributes
,
&
MF_MEDIA_ENGINE_VIDEO_OUTPUT_FORMAT
,
DXGI_FORMAT_UNKNOWN
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaEngineClassFactory_CreateInstance
(
factory
,
MF_MEDIA_ENGINE_WAITFORSTABLE_STATE
,
attributes
,
&
media_engine
);
ok
(
hr
==
S_OK
,
"Failed to create media engine, hr %#x.
\n
"
,
hr
);
IMFMediaEngine_Release
(
media_engine
);
IMFAttributes_Release
(
attributes
);
IMFDXGIDeviceManager_Release
(
manager
);
}
START_TEST
(
mfmediaengine
)
{
HRESULT
hr
;
CoInitialize
(
NULL
);
hr
=
CoCreateInstance
(
&
CLSID_MFMediaEngineClassFactory
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMFMediaEngineClassFactory
,
(
void
**
)
&
factory
);
if
(
FAILED
(
hr
))
{
win_skip
(
"Media Engine is not supported.
\n
"
);
CoUninitialize
();
return
;
}
init_functions
();
hr
=
MFStartup
(
MF_VERSION
,
MFSTARTUP_FULL
);
ok
(
hr
==
S_OK
,
"MFStartup failed: %#x.
\n
"
,
hr
);
test_factory
();
test_CreateInstance
();
IMFMediaEngineClassFactory_Release
(
factory
);
CoUninitialize
();
MFShutdown
();
}
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