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
439458af
Commit
439458af
authored
Apr 23, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qcap/filewriter: Implement state change methods.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ea753c38
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
2 deletions
+86
-2
filewriter.c
dlls/qcap/filewriter.c
+26
-0
filewriter.c
dlls/qcap/tests/filewriter.c
+60
-2
No files found.
dlls/qcap/filewriter.c
View file @
439458af
...
...
@@ -34,6 +34,7 @@ struct file_writer
struct
strmbase_sink
sink
;
WCHAR
*
filename
;
HANDLE
file
;
};
static
inline
struct
file_writer
*
impl_from_strmbase_pin
(
struct
strmbase_pin
*
iface
)
...
...
@@ -106,11 +107,36 @@ static void file_writer_destroy(struct strmbase_filter *iface)
heap_free
(
filter
);
}
static
HRESULT
file_writer_init_stream
(
struct
strmbase_filter
*
iface
)
{
struct
file_writer
*
filter
=
impl_from_strmbase_filter
(
iface
);
HANDLE
file
;
if
((
file
=
CreateFileW
(
filter
->
filename
,
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
))
==
INVALID_HANDLE_VALUE
)
{
ERR
(
"Failed to create %s, error %u.
\n
"
,
debugstr_w
(
filter
->
filename
),
GetLastError
());
return
HRESULT_FROM_WIN32
(
GetLastError
());
}
filter
->
file
=
file
;
return
S_OK
;
}
static
HRESULT
file_writer_cleanup_stream
(
struct
strmbase_filter
*
iface
)
{
struct
file_writer
*
filter
=
impl_from_strmbase_filter
(
iface
);
CloseHandle
(
filter
->
file
);
return
S_OK
;
}
static
struct
strmbase_filter_ops
filter_ops
=
{
.
filter_query_interface
=
file_writer_query_interface
,
.
filter_get_pin
=
file_writer_get_pin
,
.
filter_destroy
=
file_writer_destroy
,
.
filter_init_stream
=
file_writer_init_stream
,
.
filter_cleanup_stream
=
file_writer_cleanup_stream
,
};
static
inline
struct
file_writer
*
impl_from_IFileSinkFilter
(
IFileSinkFilter
*
iface
)
...
...
dlls/qcap/tests/filewriter.c
View file @
439458af
...
...
@@ -564,6 +564,58 @@ static void test_allocator(IMemInputPin *input, IMemAllocator *allocator)
IMemAllocator_Release
(
ret_allocator
);
}
static
void
test_filter_state
(
IMediaControl
*
control
)
{
OAFilterState
state
;
HRESULT
hr
;
hr
=
IMediaControl_GetState
(
control
,
0
,
&
state
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
state
==
State_Stopped
,
"Got state %u.
\n
"
,
state
);
hr
=
IMediaControl_Pause
(
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
);
ok
(
state
==
State_Paused
,
"Got state %u.
\n
"
,
state
);
hr
=
IMediaControl_Run
(
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
);
ok
(
state
==
State_Running
,
"Got state %u.
\n
"
,
state
);
hr
=
IMediaControl_Pause
(
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
);
ok
(
state
==
State_Paused
,
"Got state %u.
\n
"
,
state
);
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
);
ok
(
state
==
State_Stopped
,
"Got state %u.
\n
"
,
state
);
hr
=
IMediaControl_Run
(
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
);
ok
(
state
==
State_Running
,
"Got state %u.
\n
"
,
state
);
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
);
ok
(
state
==
State_Stopped
,
"Got state %u.
\n
"
,
state
);
}
static
void
test_connect_pin
(
void
)
{
AM_MEDIA_TYPE
req_mt
=
...
...
@@ -574,19 +626,21 @@ static void test_connect_pin(void)
};
IBaseFilter
*
filter
=
create_file_writer
();
WCHAR
*
filename
=
set_filename
(
filter
);
struct
testfilter
source
;
IMemAllocator
*
allocator
;
IMediaControl
*
control
;
IMemInputPin
*
meminput
;
IFilterGraph2
*
graph
;
AM_MEDIA_TYPE
mt
;
IPin
*
pin
,
*
peer
;
HRESULT
hr
;
ULONG
ref
;
set_filename
(
filter
);
BOOL
ret
;
testfilter_init
(
&
source
);
CoCreateInstance
(
&
CLSID_FilterGraph
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IFilterGraph2
,
(
void
**
)
&
graph
);
IFilterGraph2_QueryInterface
(
graph
,
&
IID_IMediaControl
,
(
void
**
)
&
control
);
hr
=
IFilterGraph2_AddFilter
(
graph
,
filter
,
L"filewriter"
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
IFilterGraph2_AddFilter
(
graph
,
&
source
.
filter
.
IBaseFilter_iface
,
L"source"
);
...
...
@@ -620,6 +674,7 @@ static void test_connect_pin(void)
&
IID_IMemAllocator
,
(
void
**
)
&
allocator
);
test_allocator
(
meminput
,
allocator
);
test_filter_state
(
control
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
...
...
@@ -636,6 +691,9 @@ static void test_connect_pin(void)
hr
=
IPin_ConnectionMediaType
(
pin
,
&
mt
);
ok
(
hr
==
VFW_E_NOT_CONNECTED
,
"Got hr %#x.
\n
"
,
hr
);
ret
=
DeleteFileW
(
filename
);
ok
(
ret
,
"Failed to delete file, error %u.
\n
"
,
GetLastError
());
IMediaControl_Release
(
control
);
ref
=
IFilterGraph2_Release
(
graph
);
ok
(
!
ref
,
"Got outstanding refcount %d.
\n
"
,
ref
);
IMemInputPin_Release
(
meminput
);
...
...
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