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
9f3e7241
Commit
9f3e7241
authored
Jun 04, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Jun 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qedit/samplegrabber: Use strmbase filter aggregation support.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
70df6142
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
112 deletions
+36
-112
samplegrabber.c
dlls/qedit/samplegrabber.c
+36
-112
No files found.
dlls/qedit/samplegrabber.c
View file @
9f3e7241
...
...
@@ -212,12 +212,10 @@ static inline SG_Pin *impl_from_IPin(IPin *iface)
/* Sample Grabber filter implementation */
typedef
struct
_SG_Impl
{
IUnknown
IUnknown_inner
;
BaseFilter
filter
;
ISampleGrabber
ISampleGrabber_iface
;
/* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */
IUnknown
*
seekthru_unk
;
IUnknown
*
outer_unk
;
AM_MEDIA_TYPE
mtype
;
SG_Pin
pin_in
;
SG_Pin
pin_out
;
...
...
@@ -237,11 +235,6 @@ enum {
OneShot_Past
,
};
static
inline
SG_Impl
*
impl_from_IUnknown
(
IUnknown
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
SG_Impl
,
IUnknown_inner
);
}
static
inline
SG_Impl
*
impl_from_BaseFilter
(
BaseFilter
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
SG_Impl
,
filter
);
...
...
@@ -281,64 +274,6 @@ static void SampleGrabber_cleanup(SG_Impl *This)
IUnknown_Release
(
This
->
seekthru_unk
);
}
/* SampleGrabber inner IUnknown */
static
HRESULT
WINAPI
SampleGrabber_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
SG_Impl
*
This
=
impl_from_IUnknown
(
iface
);
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppv
);
*
ppv
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
*
ppv
=
&
This
->
IUnknown_inner
;
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersist
)
||
IsEqualIID
(
riid
,
&
IID_IMediaFilter
)
||
IsEqualIID
(
riid
,
&
IID_IBaseFilter
))
*
ppv
=
&
This
->
filter
.
IBaseFilter_iface
;
else
if
(
IsEqualIID
(
riid
,
&
IID_ISampleGrabber
))
*
ppv
=
&
This
->
ISampleGrabber_iface
;
else
WARN
(
"(%p, %s,%p): not found
\n
"
,
This
,
debugstr_guid
(
riid
),
ppv
);
if
(
!*
ppv
)
return
E_NOINTERFACE
;
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
return
S_OK
;
}
static
ULONG
WINAPI
SampleGrabber_AddRef
(
IUnknown
*
iface
)
{
SG_Impl
*
This
=
impl_from_IUnknown
(
iface
);
ULONG
ref
=
BaseFilterImpl_AddRef
(
&
This
->
filter
.
IBaseFilter_iface
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
SampleGrabber_Release
(
IUnknown
*
iface
)
{
SG_Impl
*
This
=
impl_from_IUnknown
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
filter
.
refcount
);
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
ref
==
0
)
{
SampleGrabber_cleanup
(
This
);
strmbase_filter_cleanup
(
&
This
->
filter
);
CoTaskMemFree
(
This
);
}
return
ref
;
}
static
const
IUnknownVtbl
samplegrabber_vtbl
=
{
SampleGrabber_QueryInterface
,
SampleGrabber_AddRef
,
SampleGrabber_Release
,
};
static
IPin
*
sample_grabber_get_pin
(
BaseFilter
*
iface
,
unsigned
int
index
)
{
SG_Impl
*
This
=
impl_from_BaseFilter
(
iface
);
...
...
@@ -355,8 +290,32 @@ static IPin *sample_grabber_get_pin(BaseFilter *iface, unsigned int index)
return
pin
;
}
static
void
sample_grabber_destroy
(
BaseFilter
*
iface
)
{
SG_Impl
*
filter
=
impl_from_BaseFilter
(
iface
);
SampleGrabber_cleanup
(
filter
);
strmbase_filter_cleanup
(
&
filter
->
filter
);
CoTaskMemFree
(
filter
);
}
static
HRESULT
sample_grabber_query_interface
(
BaseFilter
*
iface
,
REFIID
iid
,
void
**
out
)
{
SG_Impl
*
filter
=
impl_from_BaseFilter
(
iface
);
if
(
IsEqualGUID
(
iid
,
&
IID_ISampleGrabber
))
*
out
=
&
filter
->
ISampleGrabber_iface
;
else
return
E_NOINTERFACE
;
IUnknown_AddRef
((
IUnknown
*
)
*
out
);
return
S_OK
;
}
static
const
BaseFilterFuncTable
basefunc_vtbl
=
{
.
filter_get_pin
=
sample_grabber_get_pin
,
.
filter_destroy
=
sample_grabber_destroy
,
.
filter_query_interface
=
sample_grabber_query_interface
,
};
/* Helper that buffers data and/or calls installed sample callbacks */
...
...
@@ -417,33 +376,6 @@ static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
}
}
/* SampleGrabber implementation of IBaseFilter interface */
/* IUnknown */
static
HRESULT
WINAPI
SampleGrabber_IBaseFilter_QueryInterface
(
IBaseFilter
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
SG_Impl
*
This
=
impl_from_IBaseFilter
(
iface
);
return
IUnknown_QueryInterface
(
This
->
outer_unk
,
riid
,
ppv
);
}
/* IUnknown */
static
ULONG
WINAPI
SampleGrabber_IBaseFilter_AddRef
(
IBaseFilter
*
iface
)
{
SG_Impl
*
This
=
impl_from_IBaseFilter
(
iface
);
return
IUnknown_AddRef
(
This
->
outer_unk
);
}
/* IUnknown */
static
ULONG
WINAPI
SampleGrabber_IBaseFilter_Release
(
IBaseFilter
*
iface
)
{
SG_Impl
*
This
=
impl_from_IBaseFilter
(
iface
);
return
IUnknown_Release
(
This
->
outer_unk
);
}
/* IMediaFilter */
static
HRESULT
WINAPI
SampleGrabber_IBaseFilter_Stop
(
IBaseFilter
*
iface
)
...
...
@@ -532,7 +464,7 @@ static HRESULT WINAPI
SampleGrabber_ISampleGrabber_QueryInterface
(
ISampleGrabber
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
SG_Impl
*
This
=
impl_from_ISampleGrabber
(
iface
);
return
IUnknown_QueryInterface
(
This
->
outer_unk
,
riid
,
ppv
);
return
IUnknown_QueryInterface
(
This
->
filter
.
outer_unk
,
riid
,
ppv
);
}
/* IUnknown */
...
...
@@ -540,7 +472,7 @@ static ULONG WINAPI
SampleGrabber_ISampleGrabber_AddRef
(
ISampleGrabber
*
iface
)
{
SG_Impl
*
This
=
impl_from_ISampleGrabber
(
iface
);
return
IUnknown_AddRef
(
This
->
outer_unk
);
return
IUnknown_AddRef
(
This
->
filter
.
outer_unk
);
}
/* IUnknown */
...
...
@@ -548,7 +480,7 @@ static ULONG WINAPI
SampleGrabber_ISampleGrabber_Release
(
ISampleGrabber
*
iface
)
{
SG_Impl
*
This
=
impl_from_ISampleGrabber
(
iface
);
return
IUnknown_Release
(
This
->
outer_unk
);
return
IUnknown_Release
(
This
->
filter
.
outer_unk
);
}
/* ISampleGrabber */
...
...
@@ -1139,9 +1071,9 @@ SampleGrabber_IPin_NewSegment(IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME
static
const
IBaseFilterVtbl
IBaseFilter_VTable
=
{
SampleGrabber_IBaseFilter
_QueryInterface
,
SampleGrabber_IBaseFilter
_AddRef
,
SampleGrabber_IBaseFilter
_Release
,
BaseFilterImpl
_QueryInterface
,
BaseFilterImpl
_AddRef
,
BaseFilterImpl
_Release
,
BaseFilterImpl_GetClassID
,
SampleGrabber_IBaseFilter_Stop
,
SampleGrabber_IBaseFilter_Pause
,
...
...
@@ -1252,24 +1184,21 @@ static const IPinVtbl IPin_Out_VTable =
SampleGrabber_IPin_NewSegment
,
};
HRESULT
SampleGrabber_create
(
IUnknown
*
pUnkOuter
,
LPVOID
*
ppv
)
HRESULT
SampleGrabber_create
(
IUnknown
*
outer
,
void
**
out
)
{
SG_Impl
*
obj
=
NULL
;
ISeekingPassThru
*
passthru
;
HRESULT
hr
;
TRACE
(
"(%p,%p)
\n
"
,
pUnkOuter
,
ppv
);
obj
=
CoTaskMemAlloc
(
sizeof
(
SG_Impl
));
if
(
NULL
==
obj
)
{
*
ppv
=
NULL
;
*
out
=
NULL
;
return
E_OUTOFMEMORY
;
}
ZeroMemory
(
obj
,
sizeof
(
SG_Impl
));
strmbase_filter_init
(
&
obj
->
filter
,
&
IBaseFilter_VTable
,
NULL
,
&
CLSID_SampleGrabber
,
strmbase_filter_init
(
&
obj
->
filter
,
&
IBaseFilter_VTable
,
outer
,
&
CLSID_SampleGrabber
,
(
DWORD_PTR
)(
__FILE__
": SG_Impl.csFilter"
),
&
basefunc_vtbl
);
obj
->
IUnknown_inner
.
lpVtbl
=
&
samplegrabber_vtbl
;
obj
->
ISampleGrabber_iface
.
lpVtbl
=
&
ISampleGrabber_VTable
;
obj
->
IMemInputPin_iface
.
lpVtbl
=
&
IMemInputPin_VTable
;
obj
->
pin_in
.
IPin_iface
.
lpVtbl
=
&
IPin_In_VTable
;
...
...
@@ -1293,19 +1222,14 @@ HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv)
obj
->
bufferLen
=
-
1
;
obj
->
bufferData
=
NULL
;
if
(
pUnkOuter
)
obj
->
outer_unk
=
pUnkOuter
;
else
obj
->
outer_unk
=
&
obj
->
IUnknown_inner
;
hr
=
CoCreateInstance
(
&
CLSID_SeekingPassThru
,
&
obj
->
IUnknown_inner
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
void
**
)
&
obj
->
seekthru_unk
);
hr
=
CoCreateInstance
(
&
CLSID_SeekingPassThru
,
&
obj
->
filter
.
IUnknown_inner
,
CLSCTX_INPROC_SERVER
,
&
IID_IUnknown
,
(
void
**
)
&
obj
->
seekthru_unk
);
if
(
hr
)
return
hr
;
IUnknown_QueryInterface
(
obj
->
seekthru_unk
,
&
IID_ISeekingPassThru
,
(
void
**
)
&
passthru
);
ISeekingPassThru_Init
(
passthru
,
FALSE
,
&
obj
->
pin_in
.
IPin_iface
);
ISeekingPassThru_Release
(
passthru
);
*
ppv
=
&
obj
->
IUnknown_inner
;
*
out
=
&
obj
->
filter
.
IUnknown_inner
;
return
S_OK
;
}
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