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
d6e828d5
Commit
d6e828d5
authored
Mar 10, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf: Implement IsMediaTypeSupported() for simple type handler.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b50c7c79
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
5 deletions
+105
-5
main.c
dlls/mf/main.c
+20
-2
mf.c
dlls/mf/tests/mf.c
+85
-3
No files found.
dlls/mf/main.c
View file @
d6e828d5
...
...
@@ -1342,9 +1342,27 @@ static ULONG WINAPI simple_type_handler_Release(IMFMediaTypeHandler *iface)
static
HRESULT
WINAPI
simple_type_handler_IsMediaTypeSupported
(
IMFMediaTypeHandler
*
iface
,
IMFMediaType
*
in_type
,
IMFMediaType
**
out_type
)
{
FIXME
(
"%p, %p, %p.
\n
"
,
iface
,
in_type
,
out_type
);
struct
simple_type_handler
*
handler
=
impl_from_IMFMediaTypeHandler
(
iface
);
DWORD
flags
=
0
;
HRESULT
hr
;
return
E_NOTIMPL
;
TRACE
(
"%p, %p, %p.
\n
"
,
iface
,
in_type
,
out_type
);
if
(
out_type
)
*
out_type
=
NULL
;
EnterCriticalSection
(
&
handler
->
cs
);
if
(
!
handler
->
media_type
)
hr
=
MF_E_UNEXPECTED
;
else
{
if
(
SUCCEEDED
(
hr
=
IMFMediaType_IsEqual
(
handler
->
media_type
,
in_type
,
&
flags
)))
hr
=
(
flags
&
(
MF_MEDIATYPE_EQUAL_MAJOR_TYPES
|
MF_MEDIATYPE_EQUAL_FORMAT_TYPES
))
==
(
MF_MEDIATYPE_EQUAL_MAJOR_TYPES
|
MF_MEDIATYPE_EQUAL_FORMAT_TYPES
)
?
S_OK
:
E_FAIL
;
}
LeaveCriticalSection
(
&
handler
->
cs
);
return
hr
;
}
static
HRESULT
WINAPI
simple_type_handler_GetMediaTypeCount
(
IMFMediaTypeHandler
*
iface
,
DWORD
*
count
)
...
...
dlls/mf/tests/mf.c
View file @
d6e828d5
...
...
@@ -2656,7 +2656,7 @@ static void test_evr(void)
static
void
test_MFCreateSimpleTypeHandler
(
void
)
{
IMFMediaType
*
media_type
,
*
media_type2
;
IMFMediaType
*
media_type
,
*
media_type2
,
*
media_type3
;
IMFMediaTypeHandler
*
handler
;
DWORD
count
;
HRESULT
hr
;
...
...
@@ -2668,6 +2668,9 @@ static void test_MFCreateSimpleTypeHandler(void)
hr
=
IMFMediaTypeHandler_GetMediaTypeCount
(
handler
,
NULL
);
ok
(
hr
==
E_POINTER
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
NULL
,
NULL
);
ok
(
hr
==
MF_E_UNEXPECTED
,
"Unexpected hr %#x.
\n
"
,
hr
);
count
=
0
;
hr
=
IMFMediaTypeHandler_GetMediaTypeCount
(
handler
,
&
count
);
ok
(
hr
==
S_OK
,
"Failed to get type count, hr %#x.
\n
"
,
hr
);
...
...
@@ -2684,6 +2687,9 @@ static void test_MFCreateSimpleTypeHandler(void)
hr
=
MFCreateMediaType
(
&
media_type
);
ok
(
hr
==
S_OK
,
"Failed to create media type, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type
,
NULL
);
ok
(
hr
==
MF_E_UNEXPECTED
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_SetCurrentMediaType
(
handler
,
media_type
);
ok
(
hr
==
S_OK
,
"Failed to set current type, hr %#x.
\n
"
,
hr
);
...
...
@@ -2692,6 +2698,15 @@ static void test_MFCreateSimpleTypeHandler(void)
ok
(
media_type2
==
media_type
,
"Unexpected type.
\n
"
);
IMFMediaType_Release
(
media_type2
);
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type
,
&
media_type2
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_GetMediaTypeByIndex
(
handler
,
1
,
&
media_type2
);
ok
(
hr
==
MF_E_NO_MORE_TYPES
,
"Unexpected hr %#x.
\n
"
,
hr
);
...
...
@@ -2700,11 +2715,78 @@ static void test_MFCreateSimpleTypeHandler(void)
ok
(
media_type
==
media_type2
,
"Unexpected pointer.
\n
"
);
IMFMediaType_Release
(
media_type2
);
IMFMediaType_Release
(
media_type
);
hr
=
IMFMediaTypeHandler_GetMajorType
(
handler
,
&
guid
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Video
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_GetMajorType
(
handler
,
&
guid
);
ok
(
hr
==
S_OK
,
"Failed to get major type, hr %#x.
\n
"
,
hr
);
ok
(
IsEqualGUID
(
&
guid
,
&
MFMediaType_Video
),
"Unexpected major type.
\n
"
);
hr
=
MFCreateMediaType
(
&
media_type3
);
ok
(
hr
==
S_OK
,
"Failed to create media type, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type3
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetGUID
(
media_type3
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Audio
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
/* Different major types. */
media_type2
=
(
void
*
)
0xdeadbeef
;
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type3
,
&
media_type2
);
ok
(
hr
==
E_FAIL
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
media_type2
,
"Unexpected pointer.
\n
"
);
hr
=
IMFMediaType_SetGUID
(
media_type3
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Video
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
media_type2
=
(
void
*
)
0xdeadbeef
;
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type3
,
&
media_type2
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
media_type2
,
"Unexpected pointer.
\n
"
);
/* Handler missing subtype. */
hr
=
IMFMediaType_SetGUID
(
media_type3
,
&
MF_MT_SUBTYPE
,
&
MFVideoFormat_RGB8
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
media_type2
=
(
void
*
)
0xdeadbeef
;
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type3
,
&
media_type2
);
ok
(
hr
==
E_FAIL
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
media_type2
,
"Unexpected pointer.
\n
"
);
/* Different subtypes. */
hr
=
IMFMediaType_SetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
MFVideoFormat_RGB24
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
media_type2
=
(
void
*
)
0xdeadbeef
;
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type3
,
&
media_type2
);
ok
(
hr
==
E_FAIL
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
media_type2
,
"Unexpected pointer.
\n
"
);
/* Same major/subtype. */
hr
=
IMFMediaType_SetGUID
(
media_type3
,
&
MF_MT_SUBTYPE
,
&
MFVideoFormat_RGB24
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
media_type2
=
(
void
*
)
0xdeadbeef
;
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type3
,
&
media_type2
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
media_type2
,
"Unexpected pointer.
\n
"
);
/* Set one more attribute. */
hr
=
IMFMediaType_SetUINT64
(
media_type
,
&
MF_MT_FRAME_SIZE
,
(
UINT64
)
4
<<
32
|
4
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
media_type2
=
(
void
*
)
0xdeadbeef
;
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
media_type3
,
&
media_type2
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
ok
(
!
media_type2
,
"Unexpected pointer.
\n
"
);
IMFMediaType_Release
(
media_type3
);
IMFMediaType_Release
(
media_type
);
hr
=
IMFMediaTypeHandler_SetCurrentMediaType
(
handler
,
NULL
);
ok
(
hr
==
S_OK
,
"Failed to set current type, hr %#x.
\n
"
,
hr
);
...
...
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