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
2c8e152f
Commit
2c8e152f
authored
Nov 19, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Nov 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qedit/samplegrabber: Reimplement the source pin over the strmbase source.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8bee5d85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
136 deletions
+104
-136
samplegrabber.c
dlls/qedit/samplegrabber.c
+103
-136
samplegrabber.c
dlls/qedit/tests/samplegrabber.c
+1
-0
No files found.
dlls/qedit/samplegrabber.c
View file @
2c8e152f
...
@@ -34,7 +34,6 @@
...
@@ -34,7 +34,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
qedit
);
WINE_DEFAULT_DEBUG_CHANNEL
(
qedit
);
static
const
WCHAR
pin_in_name
[]
=
{
'I'
,
'n'
,
0
};
static
const
WCHAR
pin_in_name
[]
=
{
'I'
,
'n'
,
0
};
static
const
WCHAR
pin_out_name
[]
=
{
'O'
,
'u'
,
't'
,
0
};
static
IEnumMediaTypes
*
mediaenum_create
(
const
AM_MEDIA_TYPE
*
mtype
,
BOOL
past
);
static
IEnumMediaTypes
*
mediaenum_create
(
const
AM_MEDIA_TYPE
*
mtype
,
BOOL
past
);
...
@@ -213,14 +212,17 @@ static inline SG_Pin *impl_from_IPin(IPin *iface)
...
@@ -213,14 +212,17 @@ static inline SG_Pin *impl_from_IPin(IPin *iface)
typedef
struct
_SG_Impl
{
typedef
struct
_SG_Impl
{
struct
strmbase_filter
filter
;
struct
strmbase_filter
filter
;
ISampleGrabber
ISampleGrabber_iface
;
ISampleGrabber
ISampleGrabber_iface
;
struct
strmbase_source
source
;
/* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */
/* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */
IUnknown
*
seekthru_unk
;
IUnknown
*
seekthru_unk
;
AM_MEDIA_TYPE
mtype
;
IMemInputPin
*
memOutput
;
SG_Pin
pin_in
;
SG_Pin
pin_in
;
SG_Pin
pin_out
;
AM_MEDIA_TYPE
mtype
;
IMemInputPin
IMemInputPin_iface
;
IMemInputPin
IMemInputPin_iface
;
IMemAllocator
*
allocator
;
IMemAllocator
*
allocator
;
IMemInputPin
*
memOutput
;
ISampleGrabberCB
*
grabberIface
;
ISampleGrabberCB
*
grabberIface
;
LONG
grabberMethod
;
LONG
grabberMethod
;
LONG
oneShot
;
LONG
oneShot
;
...
@@ -280,7 +282,7 @@ static IPin *sample_grabber_get_pin(struct strmbase_filter *iface, unsigned int
...
@@ -280,7 +282,7 @@ static IPin *sample_grabber_get_pin(struct strmbase_filter *iface, unsigned int
if
(
index
==
0
)
if
(
index
==
0
)
return
&
filter
->
pin_in
.
IPin_iface
;
return
&
filter
->
pin_in
.
IPin_iface
;
else
if
(
index
==
1
)
else
if
(
index
==
1
)
return
&
filter
->
pin_out
.
IPin_iface
;
return
&
filter
->
source
.
pin
.
IPin_iface
;
return
NULL
;
return
NULL
;
}
}
...
@@ -609,8 +611,8 @@ SampleGrabber_IMemInputPin_Receive(IMemInputPin *iface, IMediaSample *sample)
...
@@ -609,8 +611,8 @@ SampleGrabber_IMemInputPin_Receive(IMemInputPin *iface, IMediaSample *sample)
if
(
This
->
oneShot
==
OneShot_Wait
)
{
if
(
This
->
oneShot
==
OneShot_Wait
)
{
This
->
oneShot
=
OneShot_Past
;
This
->
oneShot
=
OneShot_Past
;
hr
=
S_FALSE
;
hr
=
S_FALSE
;
if
(
This
->
pin_out
.
pai
r
)
if
(
This
->
source
.
pin
.
pee
r
)
IPin_EndOfStream
(
This
->
pin_out
.
pai
r
);
IPin_EndOfStream
(
This
->
source
.
pin
.
pee
r
);
}
}
return
hr
;
return
hr
;
}
}
...
@@ -689,55 +691,6 @@ SampleGrabber_In_IPin_Connect(IPin *iface, IPin *receiver, const AM_MEDIA_TYPE *
...
@@ -689,55 +691,6 @@ SampleGrabber_In_IPin_Connect(IPin *iface, IPin *receiver, const AM_MEDIA_TYPE *
return
E_UNEXPECTED
;
return
E_UNEXPECTED
;
}
}
/* IPin - output pin */
static
HRESULT
WINAPI
SampleGrabber_Out_IPin_Connect
(
IPin
*
iface
,
IPin
*
receiver
,
const
AM_MEDIA_TYPE
*
type
)
{
SG_Pin
*
This
=
impl_from_IPin
(
iface
);
HRESULT
hr
;
TRACE
(
"(%p)->(%p, %p)
\n
"
,
This
,
receiver
,
type
);
if
(
!
receiver
)
return
E_POINTER
;
if
(
This
->
pair
)
return
VFW_E_ALREADY_CONNECTED
;
if
(
This
->
sg
->
filter
.
state
!=
State_Stopped
)
return
VFW_E_NOT_STOPPED
;
if
(
type
)
{
TRACE
(
"Media type: %s/%s ssize: %u format: %s (%u bytes)
\n
"
,
debugstr_guid
(
&
type
->
majortype
),
debugstr_guid
(
&
type
->
subtype
),
type
->
lSampleSize
,
debugstr_guid
(
&
type
->
formattype
),
type
->
cbFormat
);
if
(
!
IsEqualGUID
(
&
This
->
sg
->
mtype
.
majortype
,
&
GUID_NULL
)
&&
!
IsEqualGUID
(
&
This
->
sg
->
mtype
.
majortype
,
&
type
->
majortype
))
return
VFW_E_TYPE_NOT_ACCEPTED
;
if
(
!
IsEqualGUID
(
&
This
->
sg
->
mtype
.
subtype
,
&
MEDIASUBTYPE_None
)
&&
!
IsEqualGUID
(
&
This
->
sg
->
mtype
.
subtype
,
&
type
->
subtype
))
return
VFW_E_TYPE_NOT_ACCEPTED
;
if
(
!
IsEqualGUID
(
&
This
->
sg
->
mtype
.
formattype
,
&
GUID_NULL
)
&&
!
IsEqualGUID
(
&
This
->
sg
->
mtype
.
formattype
,
&
FORMAT_None
)
&&
!
IsEqualGUID
(
&
This
->
sg
->
mtype
.
formattype
,
&
type
->
formattype
))
return
VFW_E_TYPE_NOT_ACCEPTED
;
}
else
type
=
&
This
->
sg
->
mtype
;
if
(
!
IsEqualGUID
(
&
type
->
formattype
,
&
FORMAT_None
)
&&
!
IsEqualGUID
(
&
type
->
formattype
,
&
GUID_NULL
)
&&
!
type
->
pbFormat
)
return
VFW_E_TYPE_NOT_ACCEPTED
;
hr
=
IPin_ReceiveConnection
(
receiver
,
&
This
->
IPin_iface
,
type
);
if
(
FAILED
(
hr
))
return
hr
;
This
->
pair
=
receiver
;
if
(
This
->
sg
->
memOutput
)
{
IMemInputPin_Release
(
This
->
sg
->
memOutput
);
This
->
sg
->
memOutput
=
NULL
;
}
IPin_QueryInterface
(
receiver
,
&
IID_IMemInputPin
,(
void
**
)
&
(
This
->
sg
->
memOutput
));
TRACE
(
"(%p) Accepted IPin %p, IMemInputPin %p
\n
"
,
This
,
receiver
,
This
->
sg
->
memOutput
);
return
S_OK
;
}
/* IPin - input pin */
/* IPin - input pin */
static
HRESULT
WINAPI
static
HRESULT
WINAPI
SampleGrabber_In_IPin_ReceiveConnection
(
IPin
*
iface
,
IPin
*
connector
,
const
AM_MEDIA_TYPE
*
type
)
SampleGrabber_In_IPin_ReceiveConnection
(
IPin
*
iface
,
IPin
*
connector
,
const
AM_MEDIA_TYPE
*
type
)
...
@@ -785,14 +738,6 @@ SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_M
...
@@ -785,14 +738,6 @@ SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_M
return
S_OK
;
return
S_OK
;
}
}
/* IPin - output pin */
static
HRESULT
WINAPI
SampleGrabber_Out_IPin_ReceiveConnection
(
IPin
*
iface
,
IPin
*
connector
,
const
AM_MEDIA_TYPE
*
mtype
)
{
WARN
(
"(%p, %p): unexpected
\n
"
,
connector
,
mtype
);
return
E_UNEXPECTED
;
}
/* IPin - input pin */
/* IPin - input pin */
static
HRESULT
WINAPI
static
HRESULT
WINAPI
SampleGrabber_In_IPin_Disconnect
(
IPin
*
iface
)
SampleGrabber_In_IPin_Disconnect
(
IPin
*
iface
)
...
@@ -809,26 +754,6 @@ SampleGrabber_In_IPin_Disconnect(IPin *iface)
...
@@ -809,26 +754,6 @@ SampleGrabber_In_IPin_Disconnect(IPin *iface)
return
S_FALSE
;
return
S_FALSE
;
}
}
/* IPin - output pin */
static
HRESULT
WINAPI
SampleGrabber_Out_IPin_Disconnect
(
IPin
*
iface
)
{
SG_Pin
*
This
=
impl_from_IPin
(
iface
);
TRACE
(
"(%p)->() pair = %p
\n
"
,
This
,
This
->
pair
);
if
(
This
->
sg
->
filter
.
state
!=
State_Stopped
)
return
VFW_E_NOT_STOPPED
;
if
(
This
->
pair
)
{
This
->
pair
=
NULL
;
if
(
This
->
sg
->
memOutput
)
{
IMemInputPin_Release
(
This
->
sg
->
memOutput
);
This
->
sg
->
memOutput
=
NULL
;
}
return
S_OK
;
}
return
S_FALSE
;
}
/* IPin */
/* IPin */
static
HRESULT
WINAPI
static
HRESULT
WINAPI
SampleGrabber_IPin_ConnectedTo
(
IPin
*
iface
,
IPin
**
pin
)
SampleGrabber_IPin_ConnectedTo
(
IPin
*
iface
,
IPin
**
pin
)
...
@@ -943,8 +868,8 @@ SampleGrabber_In_IPin_QueryInternalConnections(IPin *iface, IPin **pins, ULONG *
...
@@ -943,8 +868,8 @@ SampleGrabber_In_IPin_QueryInternalConnections(IPin *iface, IPin **pins, ULONG *
if
(
*
nPins
)
{
if
(
*
nPins
)
{
if
(
!
pins
)
if
(
!
pins
)
return
E_POINTER
;
return
E_POINTER
;
IPin_AddRef
(
&
This
->
sg
->
pin_out
.
IPin_iface
);
IPin_AddRef
(
&
This
->
sg
->
source
.
pin
.
IPin_iface
);
*
pins
=
&
This
->
sg
->
pin_out
.
IPin_iface
;
*
pins
=
&
This
->
sg
->
source
.
pin
.
IPin_iface
;
*
nPins
=
1
;
*
nPins
=
1
;
return
S_OK
;
return
S_OK
;
}
}
...
@@ -952,16 +877,6 @@ SampleGrabber_In_IPin_QueryInternalConnections(IPin *iface, IPin **pins, ULONG *
...
@@ -952,16 +877,6 @@ SampleGrabber_In_IPin_QueryInternalConnections(IPin *iface, IPin **pins, ULONG *
return
S_FALSE
;
return
S_FALSE
;
}
}
/* IPin - output pin */
static
HRESULT
WINAPI
SampleGrabber_Out_IPin_QueryInternalConnections
(
IPin
*
iface
,
IPin
**
pins
,
ULONG
*
nPins
)
{
WARN
(
"(%p, %p): unexpected
\n
"
,
pins
,
nPins
);
if
(
nPins
)
*
nPins
=
0
;
return
E_NOTIMPL
;
}
/* IPin */
/* IPin */
static
HRESULT
WINAPI
static
HRESULT
WINAPI
SampleGrabber_IPin_EndOfStream
(
IPin
*
iface
)
SampleGrabber_IPin_EndOfStream
(
IPin
*
iface
)
...
@@ -1065,51 +980,105 @@ static const IPinVtbl IPin_In_VTable =
...
@@ -1065,51 +980,105 @@ static const IPinVtbl IPin_In_VTable =
SampleGrabber_IPin_NewSegment
,
SampleGrabber_IPin_NewSegment
,
};
};
static
HRESULT
WINAPI
sample_grabber_source_QueryInterface
(
IPin
*
iface
,
REFIID
iid
,
void
**
out
)
static
inline
SG_Impl
*
impl_from_source_pin
(
struct
strmbase_pin
*
iface
)
{
{
SG_Pin
*
pin
=
impl_from_IPin
(
iface
);
return
CONTAINING_RECORD
(
iface
,
SG_Impl
,
source
.
pin
);
}
TRACE
(
"iface %p, iid %s, out %p.
\n
"
,
iface
,
debugstr_guid
(
iid
),
out
);
static
HRESULT
sample_grabber_source_query_interface
(
struct
strmbase_pin
*
iface
,
REFIID
iid
,
void
**
out
)
{
SG_Impl
*
filter
=
impl_from_source_pin
(
iface
);
if
(
IsEqualGUID
(
iid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
iid
,
&
IID_IPin
))
if
(
IsEqualGUID
(
iid
,
&
IID_IMediaPosition
)
||
IsEqualGUID
(
iid
,
&
IID_IMediaSeeking
))
{
return
IUnknown_QueryInterface
(
filter
->
seekthru_unk
,
iid
,
out
);
*
out
=
iface
;
else
}
return
E_NOINTERFACE
;
else
if
(
IsEqualGUID
(
iid
,
&
IID_IMediaPosition
)
||
IsEqualGUID
(
iid
,
&
IID_IMediaSeeking
))
}
static
HRESULT
sample_grabber_source_query_accept
(
struct
strmbase_pin
*
iface
,
const
AM_MEDIA_TYPE
*
mt
)
{
return
S_OK
;
}
static
HRESULT
sample_grabber_source_get_media_type
(
struct
strmbase_pin
*
iface
,
unsigned
int
index
,
AM_MEDIA_TYPE
*
mt
)
{
SG_Impl
*
filter
=
impl_from_source_pin
(
iface
);
if
(
!
index
)
{
{
return
IUnknown_QueryInterface
(
pin
->
sg
->
seekthru_unk
,
iid
,
out
);
CopyMediaType
(
mt
,
&
filter
->
mtype
);
return
S_OK
;
}
}
else
return
VFW_S_NO_MORE_ITEMS
;
}
static
HRESULT
WINAPI
sample_grabber_source_AttemptConnection
(
struct
strmbase_source
*
iface
,
IPin
*
peer
,
const
AM_MEDIA_TYPE
*
mt
)
{
SG_Impl
*
filter
=
impl_from_source_pin
(
&
iface
->
pin
);
HRESULT
hr
;
if
(
filter
->
source
.
pin
.
peer
)
return
VFW_E_ALREADY_CONNECTED
;
if
(
filter
->
filter
.
state
!=
State_Stopped
)
return
VFW_E_NOT_STOPPED
;
if
(
!
IsEqualGUID
(
&
mt
->
majortype
,
&
filter
->
mtype
.
majortype
))
return
VFW_E_TYPE_NOT_ACCEPTED
;
if
(
!
IsEqualGUID
(
&
mt
->
subtype
,
&
filter
->
mtype
.
subtype
))
return
VFW_E_TYPE_NOT_ACCEPTED
;
if
(
!
IsEqualGUID
(
&
mt
->
formattype
,
&
FORMAT_None
)
&&
!
IsEqualGUID
(
&
mt
->
formattype
,
&
GUID_NULL
)
&&
!
IsEqualGUID
(
&
mt
->
formattype
,
&
filter
->
mtype
.
majortype
))
return
VFW_E_TYPE_NOT_ACCEPTED
;
if
(
!
IsEqualGUID
(
&
mt
->
formattype
,
&
FORMAT_None
)
&&
!
IsEqualGUID
(
&
mt
->
formattype
,
&
GUID_NULL
)
&&
!
mt
->
pbFormat
)
return
VFW_E_TYPE_NOT_ACCEPTED
;
IPin_AddRef
(
filter
->
source
.
pin
.
peer
=
peer
);
CopyMediaType
(
&
filter
->
source
.
pin
.
mt
,
mt
);
if
(
SUCCEEDED
(
hr
=
IPin_ReceiveConnection
(
peer
,
&
filter
->
source
.
pin
.
IPin_iface
,
mt
)))
hr
=
IPin_QueryInterface
(
peer
,
&
IID_IMemInputPin
,
(
void
**
)
&
filter
->
source
.
pMemInputPin
);
if
(
FAILED
(
hr
))
{
{
WARN
(
"%s not implemented, returning E_NOINTERFACE.
\n
"
,
debugstr_guid
(
iid
)
);
IPin_Release
(
filter
->
source
.
pin
.
peer
);
*
out
=
NULL
;
filter
->
source
.
pin
.
peer
=
NULL
;
return
E_NOINTERFACE
;
FreeMediaType
(
&
filter
->
source
.
pin
.
mt
)
;
}
}
IUnknown_AddRef
((
IUnknown
*
)
*
out
);
return
hr
;
return
S_OK
;
}
}
static
const
IPinVtbl
IPin_Out_VTable
=
static
const
struct
strmbase_source_ops
source_ops
=
{
{
sample_grabber_source_QueryInterface
,
.
base
.
pin_query_interface
=
sample_grabber_source_query_interface
,
SampleGrabber_IPin_AddRef
,
.
base
.
pin_query_accept
=
sample_grabber_source_query_accept
,
SampleGrabber_IPin_Release
,
.
base
.
pin_get_media_type
=
sample_grabber_source_get_media_type
,
SampleGrabber_Out_IPin_Connect
,
.
pfnAttemptConnection
=
sample_grabber_source_AttemptConnection
,
SampleGrabber_Out_IPin_ReceiveConnection
,
};
SampleGrabber_Out_IPin_Disconnect
,
SampleGrabber_IPin_ConnectedTo
,
static
const
IPinVtbl
source_vtbl
=
SampleGrabber_IPin_ConnectionMediaType
,
{
SampleGrabber_IPin_QueryPinInfo
,
BasePinImpl_QueryInterface
,
SampleGrabber_IPin_QueryDirection
,
BasePinImpl_AddRef
,
SampleGrabber_IPin_QueryId
,
BasePinImpl_Release
,
SampleGrabber_IPin_QueryAccept
,
BaseOutputPinImpl_Connect
,
SampleGrabber_IPin_EnumMediaTypes
,
BaseOutputPinImpl_ReceiveConnection
,
SampleGrabber_Out_IPin_QueryInternalConnections
,
BaseOutputPinImpl_Disconnect
,
SampleGrabber_IPin_EndOfStream
,
BasePinImpl_ConnectedTo
,
SampleGrabber_IPin_BeginFlush
,
BasePinImpl_ConnectionMediaType
,
SampleGrabber_IPin_EndFlush
,
BasePinImpl_QueryPinInfo
,
SampleGrabber_IPin_NewSegment
,
BasePinImpl_QueryDirection
,
BasePinImpl_QueryId
,
BasePinImpl_QueryAccept
,
BasePinImpl_EnumMediaTypes
,
BasePinImpl_QueryInternalConnections
,
BaseOutputPinImpl_EndOfStream
,
BaseOutputPinImpl_BeginFlush
,
BaseOutputPinImpl_EndFlush
,
BasePinImpl_NewSegment
,
};
};
HRESULT
SampleGrabber_create
(
IUnknown
*
outer
,
void
**
out
)
HRESULT
SampleGrabber_create
(
IUnknown
*
outer
,
void
**
out
)
...
@@ -1133,11 +1102,9 @@ HRESULT SampleGrabber_create(IUnknown *outer, void **out)
...
@@ -1133,11 +1102,9 @@ HRESULT SampleGrabber_create(IUnknown *outer, void **out)
obj
->
pin_in
.
name
=
pin_in_name
;
obj
->
pin_in
.
name
=
pin_in_name
;
obj
->
pin_in
.
sg
=
obj
;
obj
->
pin_in
.
sg
=
obj
;
obj
->
pin_in
.
pair
=
NULL
;
obj
->
pin_in
.
pair
=
NULL
;
obj
->
pin_out
.
IPin_iface
.
lpVtbl
=
&
IPin_Out_VTable
;
obj
->
pin_out
.
dir
=
PINDIR_OUTPUT
;
strmbase_source_init
(
&
obj
->
source
,
&
source_vtbl
,
&
obj
->
filter
,
L"Out"
,
&
source_ops
);
obj
->
pin_out
.
name
=
pin_out_name
;
obj
->
pin_out
.
sg
=
obj
;
obj
->
pin_out
.
pair
=
NULL
;
obj
->
mtype
.
majortype
=
GUID_NULL
;
obj
->
mtype
.
majortype
=
GUID_NULL
;
obj
->
mtype
.
subtype
=
MEDIASUBTYPE_None
;
obj
->
mtype
.
subtype
=
MEDIASUBTYPE_None
;
obj
->
mtype
.
formattype
=
FORMAT_None
;
obj
->
mtype
.
formattype
=
FORMAT_None
;
...
...
dlls/qedit/tests/samplegrabber.c
View file @
2c8e152f
...
@@ -472,6 +472,7 @@ static void test_media_types(void)
...
@@ -472,6 +472,7 @@ static void test_media_types(void)
hr
=
IPin_EnumMediaTypes
(
pin
,
&
enummt
);
hr
=
IPin_EnumMediaTypes
(
pin
,
&
enummt
);
todo_wine
ok
(
hr
==
VFW_E_NOT_CONNECTED
,
"Got hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
hr
==
VFW_E_NOT_CONNECTED
,
"Got hr %#x.
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IEnumMediaTypes_Release
(
enummt
);
hr
=
IPin_QueryAccept
(
pin
,
&
mt
);
hr
=
IPin_QueryAccept
(
pin
,
&
mt
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Got 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