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
6bac5919
Commit
6bac5919
authored
Nov 20, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Nov 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz/tests: Add some tests for VMR7 filter state.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
448fc532
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
226 additions
and
0 deletions
+226
-0
vmr7.c
dlls/quartz/tests/vmr7.c
+226
-0
No files found.
dlls/quartz/tests/vmr7.c
View file @
6bac5919
...
@@ -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/heap.h"
#include "wine/strmbase.h"
#include "wine/strmbase.h"
#include "wine/test.h"
#include "wine/test.h"
...
@@ -1010,6 +1011,215 @@ static void test_allocator(IMemInputPin *input)
...
@@ -1010,6 +1011,215 @@ static void test_allocator(IMemInputPin *input)
IMemAllocator_Release
(
req_allocator
);
IMemAllocator_Release
(
req_allocator
);
}
}
struct
frame_thread_params
{
IMemInputPin
*
sink
;
IMediaSample
*
sample
;
};
static
DWORD
WINAPI
frame_thread
(
void
*
arg
)
{
struct
frame_thread_params
*
params
=
arg
;
HRESULT
hr
;
if
(
winetest_debug
>
1
)
trace
(
"%04x: Sending frame.
\n
"
,
GetCurrentThreadId
());
hr
=
IMemInputPin_Receive
(
params
->
sink
,
params
->
sample
);
if
(
winetest_debug
>
1
)
trace
(
"%04x: Returned %#x.
\n
"
,
GetCurrentThreadId
(),
hr
);
IMediaSample_Release
(
params
->
sample
);
heap_free
(
params
);
return
hr
;
}
static
HANDLE
send_frame
(
IMemInputPin
*
sink
)
{
struct
frame_thread_params
*
params
=
heap_alloc
(
sizeof
(
*
params
));
REFERENCE_TIME
start_time
,
end_time
;
IMemAllocator
*
allocator
;
IMediaSample
*
sample
;
HANDLE
thread
;
HRESULT
hr
;
BYTE
*
data
;
hr
=
IMemInputPin_GetAllocator
(
sink
,
&
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_GetBuffer
(
allocator
,
&
sample
,
NULL
,
NULL
,
0
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaSample_GetPointer
(
sample
,
&
data
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
memset
(
data
,
0x55
,
32
*
16
*
4
);
hr
=
IMediaSample_SetActualDataLength
(
sample
,
32
*
16
*
4
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
start_time
=
0
;
end_time
=
start_time
+
10000000
;
hr
=
IMediaSample_SetTime
(
sample
,
&
start_time
,
&
end_time
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
params
->
sink
=
sink
;
params
->
sample
=
sample
;
thread
=
CreateThread
(
NULL
,
0
,
frame_thread
,
params
,
0
,
NULL
);
IMemAllocator_Release
(
allocator
);
return
thread
;
}
static
HRESULT
join_thread_
(
int
line
,
HANDLE
thread
)
{
DWORD
ret
;
ok_
(
__FILE__
,
line
)(
!
WaitForSingleObject
(
thread
,
1000
),
"Wait failed.
\n
"
);
GetExitCodeThread
(
thread
,
&
ret
);
CloseHandle
(
thread
);
return
ret
;
}
#define join_thread(a) join_thread_(__LINE__, a)
static
void
test_filter_state
(
IMemInputPin
*
input
,
IFilterGraph2
*
graph
)
{
IMemAllocator
*
allocator
;
IMediaControl
*
control
;
IMediaSample
*
sample
;
OAFilterState
state
;
HANDLE
thread
;
HRESULT
hr
;
IFilterGraph2_QueryInterface
(
graph
,
&
IID_IMediaControl
,
(
void
**
)
&
control
);
thread
=
send_frame
(
input
);
hr
=
join_thread
(
thread
);
ok
(
hr
==
VFW_E_WRONG_STATE
,
"Got hr %#x.
\n
"
,
hr
);
/* The renderer is not fully paused until it receives a sample. The thread
* sending the sample blocks in IMemInputPin_Receive() until the filter is
* stopped or run. */
hr
=
IMediaControl_Pause
(
control
);
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
todo_wine
ok
(
hr
==
VFW_S_STATE_INTERMEDIATE
,
"Got hr %#x.
\n
"
,
hr
);
thread
=
send_frame
(
input
);
hr
=
IMediaControl_GetState
(
control
,
1000
,
&
state
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
WaitForSingleObject
(
thread
,
100
)
==
WAIT_TIMEOUT
,
"Thread should block in Receive().
\n
"
);
hr
=
IMediaControl_Stop
(
control
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
join_thread
(
thread
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
/* The sink will decommit our allocator for us when stopping, however it
* will not recommit it when pausing. */
hr
=
IMemInputPin_GetAllocator
(
input
,
&
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_GetBuffer
(
allocator
,
&
sample
,
NULL
,
NULL
,
0
);
todo_wine
ok
(
hr
==
VFW_E_NOT_COMMITTED
,
"Got hr %#x.
\n
"
,
hr
);
if
(
hr
==
S_OK
)
IMediaSample_Release
(
sample
);
hr
=
IMemAllocator_Commit
(
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
thread
=
send_frame
(
input
);
hr
=
join_thread
(
thread
);
ok
(
hr
==
VFW_E_WRONG_STATE
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_Pause
(
control
);
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
todo_wine
ok
(
hr
==
VFW_S_STATE_INTERMEDIATE
,
"Got hr %#x.
\n
"
,
hr
);
thread
=
send_frame
(
input
);
hr
=
IMediaControl_GetState
(
control
,
1000
,
&
state
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
WaitForSingleObject
(
thread
,
100
)
==
WAIT_TIMEOUT
,
"Thread should block in Receive().
\n
"
);
hr
=
IMediaControl_Run
(
control
);
todo_wine
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
join_thread
(
thread
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
thread
=
send_frame
(
input
);
hr
=
join_thread
(
thread
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_Pause
(
control
);
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
todo_wine
ok
(
hr
==
VFW_S_STATE_INTERMEDIATE
,
"Got hr %#x.
\n
"
,
hr
);
thread
=
send_frame
(
input
);
hr
=
IMediaControl_GetState
(
control
,
1000
,
&
state
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
todo_wine
ok
(
WaitForSingleObject
(
thread
,
100
)
==
WAIT_TIMEOUT
,
"Thread should block in Receive().
\n
"
);
hr
=
IMediaControl_Run
(
control
);
todo_wine
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
join_thread
(
thread
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_Pause
(
control
);
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
todo_wine
ok
(
hr
==
VFW_S_STATE_INTERMEDIATE
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_Stop
(
control
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_Commit
(
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_Pause
(
control
);
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
todo_wine
ok
(
hr
==
VFW_S_STATE_INTERMEDIATE
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_Run
(
control
);
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
todo_wine
ok
(
hr
==
VFW_S_STATE_INTERMEDIATE
,
"Got hr %#x.
\n
"
,
hr
);
thread
=
send_frame
(
input
);
hr
=
join_thread
(
thread
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_Stop
(
control
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
IMemAllocator_Release
(
allocator
);
IMediaControl_Release
(
control
);
}
static
void
test_connect_pin
(
void
)
static
void
test_connect_pin
(
void
)
{
{
VIDEOINFOHEADER
vih
=
VIDEOINFOHEADER
vih
=
...
@@ -1028,9 +1238,11 @@ static void test_connect_pin(void)
...
@@ -1028,9 +1238,11 @@ static void test_connect_pin(void)
.
cbFormat
=
sizeof
(
vih
),
.
cbFormat
=
sizeof
(
vih
),
.
pbFormat
=
(
BYTE
*
)
&
vih
,
.
pbFormat
=
(
BYTE
*
)
&
vih
,
};
};
ALLOCATOR_PROPERTIES
req_props
=
{
1
,
32
*
16
*
4
,
1
,
0
},
ret_props
;
IBaseFilter
*
filter
=
create_vmr7
(
VMRMode_Windowed
);
IBaseFilter
*
filter
=
create_vmr7
(
VMRMode_Windowed
);
IFilterGraph2
*
graph
=
create_graph
();
IFilterGraph2
*
graph
=
create_graph
();
struct
testfilter
source
;
struct
testfilter
source
;
IMemAllocator
*
allocator
;
IMemInputPin
*
input
;
IMemInputPin
*
input
;
AM_MEDIA_TYPE
mt
;
AM_MEDIA_TYPE
mt
;
IPin
*
pin
,
*
peer
;
IPin
*
pin
,
*
peer
;
...
@@ -1128,6 +1340,20 @@ static void test_connect_pin(void)
...
@@ -1128,6 +1340,20 @@ static void test_connect_pin(void)
test_allocator
(
input
);
test_allocator
(
input
);
hr
=
IMemInputPin_GetAllocator
(
input
,
&
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IMemAllocator_SetProperties
(
allocator
,
&
req_props
,
&
ret_props
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
!
memcmp
(
&
ret_props
,
&
req_props
,
sizeof
(
req_props
)),
"Properties did not match.
\n
"
);
hr
=
IMemAllocator_Commit
(
allocator
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
IMemAllocator_Release
(
allocator
);
hr
=
IMemInputPin_ReceiveCanBlock
(
input
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
test_filter_state
(
input
,
graph
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
...
...
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