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
64b1a5ef
Commit
64b1a5ef
authored
Oct 04, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Oct 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz/tests: Add some tests for VMR7 pin connection.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b3e325f3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
266 additions
and
0 deletions
+266
-0
vmr7.c
dlls/quartz/tests/vmr7.c
+266
-0
No files found.
dlls/quartz/tests/vmr7.c
View file @
64b1a5ef
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "dshow.h"
#include "dshow.h"
#include "d3d9.h"
#include "d3d9.h"
#include "vmr9.h"
#include "vmr9.h"
#include "wine/strmbase.h"
#include "wine/test.h"
#include "wine/test.h"
static
IBaseFilter
*
create_vmr7
(
DWORD
mode
)
static
IBaseFilter
*
create_vmr7
(
DWORD
mode
)
...
@@ -57,6 +58,21 @@ static HRESULT set_mixing_mode(IBaseFilter *filter)
...
@@ -57,6 +58,21 @@ static HRESULT set_mixing_mode(IBaseFilter *filter)
return
hr
;
return
hr
;
}
}
static
inline
BOOL
compare_media_types
(
const
AM_MEDIA_TYPE
*
a
,
const
AM_MEDIA_TYPE
*
b
)
{
return
!
memcmp
(
a
,
b
,
offsetof
(
AM_MEDIA_TYPE
,
pbFormat
))
&&
!
memcmp
(
a
->
pbFormat
,
b
->
pbFormat
,
a
->
cbFormat
);
}
static
IFilterGraph2
*
create_graph
(
void
)
{
IFilterGraph2
*
ret
;
HRESULT
hr
;
hr
=
CoCreateInstance
(
&
CLSID_FilterGraph
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IFilterGraph2
,
(
void
**
)
&
ret
);
ok
(
hr
==
S_OK
,
"Failed to create FilterGraph: %#x
\n
"
,
hr
);
return
ret
;
}
static
ULONG
get_refcount
(
void
*
iface
)
static
ULONG
get_refcount
(
void
*
iface
)
{
{
IUnknown
*
unknown
=
iface
;
IUnknown
*
unknown
=
iface
;
...
@@ -832,6 +848,255 @@ static void test_unconnected_filter_state(void)
...
@@ -832,6 +848,255 @@ static void test_unconnected_filter_state(void)
ok
(
!
ref
,
"Got outstanding refcount %d.
\n
"
,
ref
);
ok
(
!
ref
,
"Got outstanding refcount %d.
\n
"
,
ref
);
}
}
struct
testfilter
{
struct
strmbase_filter
filter
;
struct
strmbase_source
source
;
};
static
const
IBaseFilterVtbl
testfilter_vtbl
=
{
BaseFilterImpl_QueryInterface
,
BaseFilterImpl_AddRef
,
BaseFilterImpl_Release
,
BaseFilterImpl_GetClassID
,
BaseFilterImpl_Stop
,
BaseFilterImpl_Pause
,
BaseFilterImpl_Run
,
BaseFilterImpl_GetState
,
BaseFilterImpl_SetSyncSource
,
BaseFilterImpl_GetSyncSource
,
BaseFilterImpl_EnumPins
,
BaseFilterImpl_FindPin
,
BaseFilterImpl_QueryFilterInfo
,
BaseFilterImpl_JoinFilterGraph
,
BaseFilterImpl_QueryVendorInfo
,
};
static
inline
struct
testfilter
*
impl_from_strmbase_filter
(
struct
strmbase_filter
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
testfilter
,
filter
);
}
static
IPin
*
testfilter_get_pin
(
struct
strmbase_filter
*
iface
,
unsigned
int
index
)
{
struct
testfilter
*
filter
=
impl_from_strmbase_filter
(
iface
);
if
(
!
index
)
return
&
filter
->
source
.
pin
.
IPin_iface
;
return
NULL
;
}
static
void
testfilter_destroy
(
struct
strmbase_filter
*
iface
)
{
struct
testfilter
*
filter
=
impl_from_strmbase_filter
(
iface
);
strmbase_source_cleanup
(
&
filter
->
source
);
strmbase_filter_cleanup
(
&
filter
->
filter
);
}
static
const
struct
strmbase_filter_ops
testfilter_ops
=
{
.
filter_get_pin
=
testfilter_get_pin
,
.
filter_destroy
=
testfilter_destroy
,
};
static
const
IPinVtbl
testsource_vtbl
=
{
BasePinImpl_QueryInterface
,
BasePinImpl_AddRef
,
BasePinImpl_Release
,
BaseOutputPinImpl_Connect
,
BaseOutputPinImpl_ReceiveConnection
,
BasePinImpl_Disconnect
,
BasePinImpl_ConnectedTo
,
BasePinImpl_ConnectionMediaType
,
BasePinImpl_QueryPinInfo
,
BasePinImpl_QueryDirection
,
BasePinImpl_QueryId
,
BasePinImpl_QueryAccept
,
BasePinImpl_EnumMediaTypes
,
BasePinImpl_QueryInternalConnections
,
BaseOutputPinImpl_EndOfStream
,
BaseOutputPinImpl_BeginFlush
,
BaseOutputPinImpl_EndFlush
,
BasePinImpl_NewSegment
,
};
static
HRESULT
testsource_query_accept
(
struct
strmbase_pin
*
iface
,
const
AM_MEDIA_TYPE
*
mt
)
{
return
S_OK
;
}
static
HRESULT
WINAPI
testsource_AttemptConnection
(
struct
strmbase_source
*
iface
,
IPin
*
peer
,
const
AM_MEDIA_TYPE
*
mt
)
{
HRESULT
hr
;
iface
->
pin
.
peer
=
peer
;
IPin_AddRef
(
peer
);
CopyMediaType
(
&
iface
->
pin
.
mtCurrent
,
mt
);
if
(
FAILED
(
hr
=
IPin_ReceiveConnection
(
peer
,
&
iface
->
pin
.
IPin_iface
,
mt
)))
{
ok
(
hr
==
VFW_E_TYPE_NOT_ACCEPTED
,
"Got hr %#x.
\n
"
,
hr
);
IPin_Release
(
peer
);
iface
->
pin
.
peer
=
NULL
;
FreeMediaType
(
&
iface
->
pin
.
mtCurrent
);
}
return
hr
;
}
static
const
struct
strmbase_source_ops
testsource_ops
=
{
.
base
.
pin_query_accept
=
testsource_query_accept
,
.
base
.
pin_get_media_type
=
strmbase_pin_get_media_type
,
.
pfnAttemptConnection
=
testsource_AttemptConnection
,
};
static
void
testfilter_init
(
struct
testfilter
*
filter
)
{
static
const
GUID
clsid
=
{
0xabacab
};
strmbase_filter_init
(
&
filter
->
filter
,
&
testfilter_vtbl
,
NULL
,
&
clsid
,
&
testfilter_ops
);
strmbase_source_init
(
&
filter
->
source
,
&
testsource_vtbl
,
&
filter
->
filter
,
L""
,
&
testsource_ops
);
}
static
void
test_connect_pin
(
void
)
{
VIDEOINFOHEADER
vih
=
{
.
bmiHeader
.
biSize
=
sizeof
(
BITMAPINFOHEADER
),
.
bmiHeader
.
biWidth
=
32
,
.
bmiHeader
.
biHeight
=
16
,
.
bmiHeader
.
biPlanes
=
1
,
.
bmiHeader
.
biCompression
=
BI_RGB
,
};
AM_MEDIA_TYPE
req_mt
=
{
.
majortype
=
MEDIATYPE_Video
,
.
subtype
=
MEDIASUBTYPE_WAVE
,
.
formattype
=
FORMAT_VideoInfo
,
.
cbFormat
=
sizeof
(
vih
),
.
pbFormat
=
(
BYTE
*
)
&
vih
,
};
IBaseFilter
*
filter
=
create_vmr7
(
VMRMode_Windowed
);
IFilterGraph2
*
graph
=
create_graph
();
struct
testfilter
source
;
AM_MEDIA_TYPE
mt
;
IPin
*
pin
,
*
peer
;
unsigned
int
i
;
HRESULT
hr
;
ULONG
ref
;
static
const
GUID
*
subtype_tests
[]
=
{
&
MEDIASUBTYPE_RGB565
,
&
MEDIASUBTYPE_RGB24
,
&
MEDIASUBTYPE_RGB32
,
&
MEDIASUBTYPE_WAVE
,
};
testfilter_init
(
&
source
);
IFilterGraph2_AddFilter
(
graph
,
&
source
.
filter
.
IBaseFilter_iface
,
NULL
);
IFilterGraph2_AddFilter
(
graph
,
filter
,
NULL
);
IBaseFilter_FindPin
(
filter
,
L"VMR Input0"
,
&
pin
);
vih
.
bmiHeader
.
biBitCount
=
16
;
hr
=
IFilterGraph2_ConnectDirect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
,
pin
,
&
req_mt
);
todo_wine
ok
(
hr
==
VFW_E_TYPE_NOT_ACCEPTED
,
"Got hr %#x.
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
IFilterGraph2_Disconnect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
);
IFilterGraph2_Disconnect
(
graph
,
pin
);
}
vih
.
bmiHeader
.
biBitCount
=
32
;
hr
=
IFilterGraph2_ConnectDirect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
,
pin
,
&
req_mt
);
if
(
hr
==
VFW_E_TYPE_NOT_ACCEPTED
)
/* w7u */
{
vih
.
bmiHeader
.
biBitCount
=
24
;
hr
=
IFilterGraph2_ConnectDirect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
,
pin
,
&
req_mt
);
}
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
subtype_tests
);
++
i
)
{
req_mt
.
subtype
=
*
subtype_tests
[
i
];
hr
=
IFilterGraph2_ConnectDirect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
,
pin
,
&
req_mt
);
ok
(
hr
==
S_OK
,
"Got hr %#x for subtype %s.
\n
"
,
hr
,
wine_dbgstr_guid
(
subtype_tests
[
i
]));
hr
=
IFilterGraph2_Disconnect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
}
req_mt
.
formattype
=
FORMAT_None
;
hr
=
IFilterGraph2_ConnectDirect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
,
pin
,
&
req_mt
);
ok
(
hr
==
VFW_E_TYPE_NOT_ACCEPTED
,
"Got hr %#x.
\n
"
,
hr
);
req_mt
.
formattype
=
GUID_NULL
;
hr
=
IFilterGraph2_ConnectDirect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
,
pin
,
&
req_mt
);
ok
(
hr
==
VFW_E_TYPE_NOT_ACCEPTED
,
"Got hr %#x.
\n
"
,
hr
);
req_mt
.
formattype
=
FORMAT_VideoInfo
;
req_mt
.
subtype
=
MEDIASUBTYPE_RGB8
;
hr
=
IFilterGraph2_ConnectDirect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
,
pin
,
&
req_mt
);
todo_wine
ok
(
hr
==
VFW_E_TYPE_NOT_ACCEPTED
,
"Got hr %#x.
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
IFilterGraph2_Disconnect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
);
IFilterGraph2_Disconnect
(
graph
,
pin
);
}
req_mt
.
subtype
=
MEDIASUBTYPE_RGB32
;
peer
=
(
IPin
*
)
0xdeadbeef
;
hr
=
IPin_ConnectedTo
(
pin
,
&
peer
);
ok
(
hr
==
VFW_E_NOT_CONNECTED
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
!
peer
,
"Got peer %p.
\n
"
,
peer
);
hr
=
IPin_ConnectionMediaType
(
pin
,
&
mt
);
ok
(
hr
==
VFW_E_NOT_CONNECTED
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IFilterGraph2_ConnectDirect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
,
pin
,
&
req_mt
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IPin_ConnectedTo
(
pin
,
&
peer
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
peer
==
&
source
.
source
.
pin
.
IPin_iface
,
"Got peer %p.
\n
"
,
peer
);
IPin_Release
(
peer
);
hr
=
IPin_ConnectionMediaType
(
pin
,
&
mt
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
compare_media_types
(
&
mt
,
&
req_mt
),
"Media types didn't match.
\n
"
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
todo_wine
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
source
.
source
.
pin
.
peer
==
pin
,
"Got peer %p.
\n
"
,
peer
);
IFilterGraph2_Disconnect
(
graph
,
&
source
.
source
.
pin
.
IPin_iface
);
peer
=
(
IPin
*
)
0xdeadbeef
;
hr
=
IPin_ConnectedTo
(
pin
,
&
peer
);
ok
(
hr
==
VFW_E_NOT_CONNECTED
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
!
peer
,
"Got peer %p.
\n
"
,
peer
);
hr
=
IPin_ConnectionMediaType
(
pin
,
&
mt
);
ok
(
hr
==
VFW_E_NOT_CONNECTED
,
"Got hr %#x.
\n
"
,
hr
);
IPin_Release
(
pin
);
ref
=
IFilterGraph2_Release
(
graph
);
ok
(
!
ref
,
"Got outstanding refcount %d.
\n
"
,
ref
);
ref
=
IBaseFilter_Release
(
filter
);
ok
(
!
ref
,
"Got outstanding refcount %d.
\n
"
,
ref
);
ref
=
IBaseFilter_Release
(
&
source
.
filter
.
IBaseFilter_iface
);
ok
(
!
ref
,
"Got outstanding refcount %d.
\n
"
,
ref
);
}
START_TEST
(
vmr7
)
START_TEST
(
vmr7
)
{
{
CoInitialize
(
NULL
);
CoInitialize
(
NULL
);
...
@@ -845,6 +1110,7 @@ START_TEST(vmr7)
...
@@ -845,6 +1110,7 @@ START_TEST(vmr7)
test_media_types
();
test_media_types
();
test_enum_media_types
();
test_enum_media_types
();
test_unconnected_filter_state
();
test_unconnected_filter_state
();
test_connect_pin
();
CoUninitialize
();
CoUninitialize
();
}
}
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