Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
169d6b00
Commit
169d6b00
authored
Apr 16, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf: Validate new current type set for sample grabber.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8467b61a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
13 deletions
+42
-13
samplegrabber.c
dlls/mf/samplegrabber.c
+14
-10
mf.c
dlls/mf/tests/mf.c
+28
-3
No files found.
dlls/mf/samplegrabber.c
View file @
169d6b00
...
...
@@ -599,15 +599,11 @@ static ULONG WINAPI sample_grabber_stream_type_handler_Release(IMFMediaTypeHandl
return
IMFStreamSink_Release
(
&
stream
->
IMFStreamSink_iface
);
}
static
HRESULT
WINAPI
sample_grabber_stream_type_handler_IsMediaTypeSupported
(
IMFMediaTypeHandler
*
iface
,
IMFMediaType
*
in_type
,
IMFMediaType
**
out_type
)
static
HRESULT
sample_grabber_stream_is_media_type_supported
(
struct
sample_grabber_stream
*
stream
,
IMFMediaType
*
in_type
)
{
struct
sample_grabber_stream
*
stream
=
impl_from_IMFMediaTypeHandler
(
iface
);
const
DWORD
supported_flags
=
MF_MEDIATYPE_EQUAL_MAJOR_TYPES
|
MF_MEDIATYPE_EQUAL_FORMAT_TYPES
;
DWORD
flags
;
TRACE
(
"%p, %p, %p.
\n
"
,
iface
,
in_type
,
out_type
);
if
(
!
stream
->
sink
)
return
MF_E_STREAMSINK_REMOVED
;
...
...
@@ -620,6 +616,16 @@ static HRESULT WINAPI sample_grabber_stream_type_handler_IsMediaTypeSupported(IM
return
(
flags
&
supported_flags
)
==
supported_flags
?
S_OK
:
MF_E_INVALIDMEDIATYPE
;
}
static
HRESULT
WINAPI
sample_grabber_stream_type_handler_IsMediaTypeSupported
(
IMFMediaTypeHandler
*
iface
,
IMFMediaType
*
in_type
,
IMFMediaType
**
out_type
)
{
struct
sample_grabber_stream
*
stream
=
impl_from_IMFMediaTypeHandler
(
iface
);
TRACE
(
"%p, %p, %p.
\n
"
,
iface
,
in_type
,
out_type
);
return
sample_grabber_stream_is_media_type_supported
(
stream
,
in_type
);
}
static
HRESULT
WINAPI
sample_grabber_stream_type_handler_GetMediaTypeCount
(
IMFMediaTypeHandler
*
iface
,
DWORD
*
count
)
{
TRACE
(
"%p, %p.
\n
"
,
iface
,
count
);
...
...
@@ -647,14 +653,12 @@ static HRESULT WINAPI sample_grabber_stream_type_handler_SetCurrentMediaType(IMF
IMFMediaType
*
media_type
)
{
struct
sample_grabber_stream
*
stream
=
impl_from_IMFMediaTypeHandler
(
iface
);
HRESULT
hr
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
media_type
);
if
(
!
media_type
)
return
E_POINTER
;
if
(
!
stream
->
sink
)
return
MF_E_STREAMSINK_REMOVED
;
if
(
FAILED
(
hr
=
sample_grabber_stream_is_media_type_supported
(
stream
,
media_type
)))
return
hr
;
IMFMediaType_Release
(
stream
->
sink
->
media_type
);
stream
->
sink
->
media_type
=
media_type
;
...
...
dlls/mf/tests/mf.c
View file @
169d6b00
...
...
@@ -2000,14 +2000,20 @@ static void test_sample_grabber(void)
hr
=
MFCreateSampleGrabberSinkActivate
(
NULL
,
&
grabber_callback
,
&
activate
);
ok
(
hr
==
E_POINTER
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
MFCreateSampleGrabberSinkActivate
(
media_type
,
&
grabber_callback
,
&
activate
);
ok
(
hr
==
S_OK
,
"Failed to create grabber activate, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Audio
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
MFAudioFormat_PCM
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
EXPECT_REF
(
media_type
,
1
);
hr
=
MFCreateSampleGrabberSinkActivate
(
media_type
,
&
grabber_callback
,
&
activate
);
ok
(
hr
==
S_OK
,
"Failed to create grabber activate, hr %#x.
\n
"
,
hr
);
EXPECT_REF
(
media_type
,
2
);
hr
=
IMFActivate_GetCount
(
activate
,
&
count
);
ok
(
hr
==
S_OK
,
"Failed to get attribute count, hr %#x.
\n
"
,
hr
);
ok
(
!
count
,
"Unexpected count %u.
\n
"
,
count
);
hr
=
IMFActivate_ActivateObject
(
activate
,
&
IID_IMFMediaSink
,
(
void
**
)
&
sink
);
ok
(
hr
==
S_OK
,
"Failed to activate object, hr %#x.
\n
"
,
hr
);
...
...
@@ -2136,11 +2142,27 @@ static void test_sample_grabber(void)
hr
=
MFCreateMediaType
(
&
media_type2
);
ok
(
hr
==
S_OK
,
"Failed to create media type, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_SetCurrentMediaType
(
handler
,
media_type2
);
ok
(
hr
==
MF_E_INVALIDMEDIATYPE
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetGUID
(
media_type2
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Audio
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_SetCurrentMediaType
(
handler
,
media_type2
);
ok
(
hr
==
MF_E_INVALIDMEDIATYPE
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetGUID
(
media_type2
,
&
MF_MT_SUBTYPE
,
&
MFAudioFormat_Float
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_SetCurrentMediaType
(
handler
,
media_type2
);
ok
(
hr
==
MF_E_INVALIDMEDIATYPE
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetGUID
(
media_type2
,
&
MF_MT_SUBTYPE
,
&
MFAudioFormat_PCM
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaType_SetUINT32
(
media_type2
,
&
MF_MT_AUDIO_SAMPLES_PER_SECOND
,
44100
);
ok
(
hr
==
S_OK
,
"Failed to set attribute, hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_SetCurrentMediaType
(
handler
,
media_type2
);
ok
(
hr
==
S_OK
,
"Failed to get current type, hr %#x.
\n
"
,
hr
);
IMFMediaType_Release
(
media_type
);
...
...
@@ -2242,6 +2264,9 @@ static void test_sample_grabber(void)
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
NULL
,
NULL
);
ok
(
hr
==
MF_E_STREAMSINK_REMOVED
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_SetCurrentMediaType
(
handler
,
NULL
);
ok
(
hr
==
MF_E_STREAMSINK_REMOVED
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_GetMediaTypeCount
(
handler
,
&
count
);
ok
(
hr
==
S_OK
,
"Failed to get type count, 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