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
c742a4e1
Commit
c742a4e1
authored
May 20, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf: Add events support for grabber sink.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2045afe4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
6 deletions
+99
-6
samplegrabber.c
dlls/mf/samplegrabber.c
+99
-4
mf.c
dlls/mf/tests/mf.c
+0
-2
No files found.
dlls/mf/samplegrabber.c
View file @
c742a4e1
...
@@ -41,11 +41,13 @@ struct sample_grabber
...
@@ -41,11 +41,13 @@ struct sample_grabber
{
{
IMFMediaSink
IMFMediaSink_iface
;
IMFMediaSink
IMFMediaSink_iface
;
IMFClockStateSink
IMFClockStateSink_iface
;
IMFClockStateSink
IMFClockStateSink_iface
;
IMFMediaEventGenerator
IMFMediaEventGenerator_iface
;
LONG
refcount
;
LONG
refcount
;
IMFSampleGrabberSinkCallback
*
callback
;
IMFSampleGrabberSinkCallback
*
callback
;
IMFMediaType
*
media_type
;
IMFMediaType
*
media_type
;
BOOL
is_shut_down
;
BOOL
is_shut_down
;
IMFStreamSink
*
stream
;
IMFStreamSink
*
stream
;
IMFMediaEventQueue
*
event_queue
;
CRITICAL_SECTION
cs
;
CRITICAL_SECTION
cs
;
};
};
...
@@ -73,6 +75,11 @@ static struct sample_grabber *impl_from_IMFClockStateSink(IMFClockStateSink *ifa
...
@@ -73,6 +75,11 @@ static struct sample_grabber *impl_from_IMFClockStateSink(IMFClockStateSink *ifa
return
CONTAINING_RECORD
(
iface
,
struct
sample_grabber
,
IMFClockStateSink_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
sample_grabber
,
IMFClockStateSink_iface
);
}
}
static
struct
sample_grabber
*
impl_from_IMFMediaEventGenerator
(
IMFMediaEventGenerator
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
sample_grabber
,
IMFMediaEventGenerator_iface
);
}
static
struct
sample_grabber_stream
*
impl_from_IMFStreamSink
(
IMFStreamSink
*
iface
)
static
struct
sample_grabber_stream
*
impl_from_IMFStreamSink
(
IMFStreamSink
*
iface
)
{
{
return
CONTAINING_RECORD
(
iface
,
struct
sample_grabber_stream
,
IMFStreamSink_iface
);
return
CONTAINING_RECORD
(
iface
,
struct
sample_grabber_stream
,
IMFStreamSink_iface
);
...
@@ -130,8 +137,11 @@ static ULONG WINAPI sample_grabber_stream_Release(IMFStreamSink *iface)
...
@@ -130,8 +137,11 @@ static ULONG WINAPI sample_grabber_stream_Release(IMFStreamSink *iface)
if
(
!
refcount
)
if
(
!
refcount
)
{
{
IMFMediaSink_Release
(
stream
->
sink
);
IMFMediaSink_Release
(
stream
->
sink
);
if
(
stream
->
event_queue
)
{
IMFMediaEventQueue_Shutdown
(
stream
->
event_queue
);
IMFMediaEventQueue_Shutdown
(
stream
->
event_queue
);
IMFMediaEventQueue_Release
(
stream
->
event_queue
);
IMFMediaEventQueue_Release
(
stream
->
event_queue
);
}
heap_free
(
stream
);
heap_free
(
stream
);
}
}
...
@@ -342,6 +352,10 @@ static HRESULT WINAPI sample_grabber_sink_QueryInterface(IMFMediaSink *iface, RE
...
@@ -342,6 +352,10 @@ static HRESULT WINAPI sample_grabber_sink_QueryInterface(IMFMediaSink *iface, RE
{
{
*
obj
=
&
grabber
->
IMFClockStateSink_iface
;
*
obj
=
&
grabber
->
IMFClockStateSink_iface
;
}
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IMFMediaEventGenerator
))
{
*
obj
=
&
grabber
->
IMFMediaEventGenerator_iface
;
}
else
else
{
{
WARN
(
"Unsupported %s.
\n
"
,
debugstr_guid
(
riid
));
WARN
(
"Unsupported %s.
\n
"
,
debugstr_guid
(
riid
));
...
@@ -375,6 +389,11 @@ static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface)
...
@@ -375,6 +389,11 @@ static ULONG WINAPI sample_grabber_sink_Release(IMFMediaSink *iface)
{
{
IMFSampleGrabberSinkCallback_Release
(
grabber
->
callback
);
IMFSampleGrabberSinkCallback_Release
(
grabber
->
callback
);
IMFMediaType_Release
(
grabber
->
media_type
);
IMFMediaType_Release
(
grabber
->
media_type
);
if
(
grabber
->
event_queue
)
{
IMFMediaEventQueue_Shutdown
(
grabber
->
event_queue
);
IMFMediaEventQueue_Release
(
grabber
->
event_queue
);
}
DeleteCriticalSection
(
&
grabber
->
cs
);
DeleteCriticalSection
(
&
grabber
->
cs
);
heap_free
(
grabber
);
heap_free
(
grabber
);
}
}
...
@@ -583,6 +602,74 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockSetRate(IMFClockStateSink
...
@@ -583,6 +602,74 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockSetRate(IMFClockStateSink
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
WINAPI
sample_grabber_events_QueryInterface
(
IMFMediaEventGenerator
*
iface
,
REFIID
riid
,
void
**
obj
)
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaEventGenerator
(
iface
);
return
IMFMediaSink_QueryInterface
(
&
grabber
->
IMFMediaSink_iface
,
riid
,
obj
);
}
static
ULONG
WINAPI
sample_grabber_events_AddRef
(
IMFMediaEventGenerator
*
iface
)
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaEventGenerator
(
iface
);
return
IMFMediaSink_AddRef
(
&
grabber
->
IMFMediaSink_iface
);
}
static
ULONG
WINAPI
sample_grabber_events_Release
(
IMFMediaEventGenerator
*
iface
)
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaEventGenerator
(
iface
);
return
IMFMediaSink_Release
(
&
grabber
->
IMFMediaSink_iface
);
}
static
HRESULT
WINAPI
sample_grabber_events_GetEvent
(
IMFMediaEventGenerator
*
iface
,
DWORD
flags
,
IMFMediaEvent
**
event
)
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaEventGenerator
(
iface
);
TRACE
(
"%p, %#x, %p.
\n
"
,
iface
,
flags
,
event
);
return
IMFMediaEventQueue_GetEvent
(
grabber
->
event_queue
,
flags
,
event
);
}
static
HRESULT
WINAPI
sample_grabber_events_BeginGetEvent
(
IMFMediaEventGenerator
*
iface
,
IMFAsyncCallback
*
callback
,
IUnknown
*
state
)
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaEventGenerator
(
iface
);
TRACE
(
"%p, %p, %p.
\n
"
,
iface
,
callback
,
state
);
return
IMFMediaEventQueue_BeginGetEvent
(
grabber
->
event_queue
,
callback
,
state
);
}
static
HRESULT
WINAPI
sample_grabber_events_EndGetEvent
(
IMFMediaEventGenerator
*
iface
,
IMFAsyncResult
*
result
,
IMFMediaEvent
**
event
)
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaEventGenerator
(
iface
);
TRACE
(
"%p, %p, %p.
\n
"
,
iface
,
result
,
event
);
return
IMFMediaEventQueue_EndGetEvent
(
grabber
->
event_queue
,
result
,
event
);
}
static
HRESULT
WINAPI
sample_grabber_events_QueueEvent
(
IMFMediaEventGenerator
*
iface
,
MediaEventType
event_type
,
REFGUID
ext_type
,
HRESULT
hr
,
const
PROPVARIANT
*
value
)
{
struct
sample_grabber
*
grabber
=
impl_from_IMFMediaEventGenerator
(
iface
);
TRACE
(
"%p, %u, %s, %#x, %p.
\n
"
,
iface
,
event_type
,
debugstr_guid
(
ext_type
),
hr
,
value
);
return
IMFMediaEventQueue_QueueEventParamVar
(
grabber
->
event_queue
,
event_type
,
ext_type
,
hr
,
value
);
}
static
const
IMFMediaEventGeneratorVtbl
sample_grabber_sink_events_vtbl
=
{
sample_grabber_events_QueryInterface
,
sample_grabber_events_AddRef
,
sample_grabber_events_Release
,
sample_grabber_events_GetEvent
,
sample_grabber_events_BeginGetEvent
,
sample_grabber_events_EndGetEvent
,
sample_grabber_events_QueueEvent
,
};
static
const
IMFClockStateSinkVtbl
sample_grabber_clock_sink_vtbl
=
static
const
IMFClockStateSinkVtbl
sample_grabber_clock_sink_vtbl
=
{
{
sample_grabber_clock_sink_QueryInterface
,
sample_grabber_clock_sink_QueryInterface
,
...
@@ -637,23 +724,31 @@ static HRESULT sample_grabber_create_object(IMFAttributes *attributes, void *use
...
@@ -637,23 +724,31 @@ static HRESULT sample_grabber_create_object(IMFAttributes *attributes, void *use
object
->
IMFMediaSink_iface
.
lpVtbl
=
&
sample_grabber_sink_vtbl
;
object
->
IMFMediaSink_iface
.
lpVtbl
=
&
sample_grabber_sink_vtbl
;
object
->
IMFClockStateSink_iface
.
lpVtbl
=
&
sample_grabber_clock_sink_vtbl
;
object
->
IMFClockStateSink_iface
.
lpVtbl
=
&
sample_grabber_clock_sink_vtbl
;
object
->
IMFMediaEventGenerator_iface
.
lpVtbl
=
&
sample_grabber_sink_events_vtbl
;
object
->
refcount
=
1
;
object
->
refcount
=
1
;
object
->
callback
=
context
->
callback
;
object
->
callback
=
context
->
callback
;
IMFSampleGrabberSinkCallback_AddRef
(
object
->
callback
);
IMFSampleGrabberSinkCallback_AddRef
(
object
->
callback
);
object
->
media_type
=
context
->
media_type
;
object
->
media_type
=
context
->
media_type
;
IMFMediaType_AddRef
(
object
->
media_type
);
IMFMediaType_AddRef
(
object
->
media_type
);
InitializeCriticalSection
(
&
object
->
cs
);
InitializeCriticalSection
(
&
object
->
cs
);
if
(
FAILED
(
hr
=
sample_grabber_create_stream
(
&
object
->
IMFMediaSink_iface
,
&
object
->
stream
)))
if
(
FAILED
(
hr
=
sample_grabber_create_stream
(
&
object
->
IMFMediaSink_iface
,
&
object
->
stream
)))
{
goto
failed
;
IMFMediaSink_Release
(
&
object
->
IMFMediaSink_iface
);
return
hr
;
if
(
FAILED
(
hr
=
MFCreateEventQueue
(
&
object
->
event_queue
)))
}
goto
failed
;
*
obj
=
(
IUnknown
*
)
&
object
->
IMFMediaSink_iface
;
*
obj
=
(
IUnknown
*
)
&
object
->
IMFMediaSink_iface
;
TRACE
(
"Created %p.
\n
"
,
*
obj
);
TRACE
(
"Created %p.
\n
"
,
*
obj
);
return
S_OK
;
return
S_OK
;
failed:
IMFMediaSink_Release
(
&
object
->
IMFMediaSink_iface
);
return
hr
;
}
}
static
const
struct
activate_funcs
sample_grabber_activate_funcs
=
static
const
struct
activate_funcs
sample_grabber_activate_funcs
=
...
...
dlls/mf/tests/mf.c
View file @
c742a4e1
...
@@ -1713,9 +1713,7 @@ static void test_sample_grabber(void)
...
@@ -1713,9 +1713,7 @@ static void test_sample_grabber(void)
IMFClockStateSink_Release
(
clocksink
);
IMFClockStateSink_Release
(
clocksink
);
hr
=
IMFMediaSink_QueryInterface
(
sink
,
&
IID_IMFMediaEventGenerator
,
(
void
**
)
&
eg
);
hr
=
IMFMediaSink_QueryInterface
(
sink
,
&
IID_IMFMediaEventGenerator
,
(
void
**
)
&
eg
);
todo_wine
ok
(
hr
==
S_OK
,
"Failed to get interface, hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Failed to get interface, hr %#x.
\n
"
,
hr
);
if
(
SUCCEEDED
(
hr
))
IMFMediaEventGenerator_Release
(
eg
);
IMFMediaEventGenerator_Release
(
eg
);
hr
=
IMFMediaSink_QueryInterface
(
sink
,
&
IID_IMFPresentationTimeSource
,
(
void
**
)
&
unk
);
hr
=
IMFMediaSink_QueryInterface
(
sink
,
&
IID_IMFPresentationTimeSource
,
(
void
**
)
&
unk
);
...
...
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