Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
dc78a97c
Commit
dc78a97c
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: Post EC_COMPLETE on receiving EOS.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
91d0d9ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
0 deletions
+94
-0
filewriter.c
dlls/qcap/filewriter.c
+42
-0
filewriter.c
dlls/qcap/tests/filewriter.c
+52
-0
No files found.
dlls/qcap/filewriter.c
View file @
dc78a97c
...
...
@@ -36,6 +36,8 @@ struct file_writer
WCHAR
*
filename
;
HANDLE
file
;
BOOL
eos
;
};
static
inline
struct
file_writer
*
impl_from_strmbase_pin
(
struct
strmbase_pin
*
iface
)
...
...
@@ -90,11 +92,40 @@ static HRESULT WINAPI file_writer_sink_receive(struct strmbase_sink *iface, IMed
return
S_OK
;
}
static
void
deliver_ec_complete
(
struct
file_writer
*
filter
)
{
IMediaEventSink
*
event_sink
;
if
(
SUCCEEDED
(
IFilterGraph_QueryInterface
(
filter
->
filter
.
graph
,
&
IID_IMediaEventSink
,
(
void
**
)
&
event_sink
)))
{
IMediaEventSink_Notify
(
event_sink
,
EC_COMPLETE
,
S_OK
,
(
LONG_PTR
)
&
filter
->
filter
.
IBaseFilter_iface
);
IMediaEventSink_Release
(
event_sink
);
}
}
static
HRESULT
file_writer_sink_eos
(
struct
strmbase_sink
*
iface
)
{
struct
file_writer
*
filter
=
impl_from_strmbase_pin
(
&
iface
->
pin
);
EnterCriticalSection
(
&
filter
->
filter
.
csFilter
);
if
(
filter
->
filter
.
state
==
State_Running
)
deliver_ec_complete
(
filter
);
else
filter
->
eos
=
TRUE
;
LeaveCriticalSection
(
&
filter
->
filter
.
csFilter
);
return
S_OK
;
}
static
const
struct
strmbase_sink_ops
sink_ops
=
{
.
base
.
pin_query_interface
=
file_writer_sink_query_interface
,
.
base
.
pin_query_accept
=
file_writer_sink_query_accept
,
.
pfnReceive
=
file_writer_sink_receive
,
.
sink_eos
=
file_writer_sink_eos
,
};
static
inline
struct
file_writer
*
impl_from_strmbase_filter
(
struct
strmbase_filter
*
iface
)
...
...
@@ -151,6 +182,16 @@ static HRESULT file_writer_init_stream(struct strmbase_filter *iface)
return
S_OK
;
}
static
HRESULT
file_writer_start_stream
(
struct
strmbase_filter
*
iface
,
REFERENCE_TIME
start
)
{
struct
file_writer
*
filter
=
impl_from_strmbase_filter
(
iface
);
if
(
filter
->
eos
)
deliver_ec_complete
(
filter
);
filter
->
eos
=
FALSE
;
return
S_OK
;
}
static
HRESULT
file_writer_cleanup_stream
(
struct
strmbase_filter
*
iface
)
{
struct
file_writer
*
filter
=
impl_from_strmbase_filter
(
iface
);
...
...
@@ -165,6 +206,7 @@ static struct strmbase_filter_ops filter_ops =
.
filter_get_pin
=
file_writer_get_pin
,
.
filter_destroy
=
file_writer_destroy
,
.
filter_init_stream
=
file_writer_init_stream
,
.
filter_start_stream
=
file_writer_start_stream
,
.
filter_cleanup_stream
=
file_writer_cleanup_stream
,
};
...
...
dlls/qcap/tests/filewriter.c
View file @
dc78a97c
...
...
@@ -678,6 +678,57 @@ static void test_sample_processing(IMediaControl *control, IMemInputPin *input,
IMediaSample_Release
(
sample
);
}
static
unsigned
int
check_ec_complete
(
IMediaEvent
*
eventsrc
,
DWORD
timeout
)
{
LONG_PTR
param1
,
param2
;
unsigned
int
ret
=
0
;
HRESULT
hr
;
LONG
code
;
while
((
hr
=
IMediaEvent_GetEvent
(
eventsrc
,
&
code
,
&
param1
,
&
param2
,
timeout
))
==
S_OK
)
{
if
(
code
==
EC_COMPLETE
)
{
ok
(
param1
==
S_OK
,
"Got param1 %#lx.
\n
"
,
param1
);
ok
(
!
param2
,
"Got param2 %#lx.
\n
"
,
param2
);
ret
++
;
}
IMediaEvent_FreeEventParams
(
eventsrc
,
code
,
param1
,
param2
);
timeout
=
0
;
}
ok
(
hr
==
E_ABORT
,
"Got hr %#x.
\n
"
,
hr
);
return
ret
;
}
static
void
test_eos
(
IFilterGraph2
*
graph
,
IMediaControl
*
control
,
IPin
*
pin
)
{
IMediaEvent
*
eventsrc
;
HRESULT
hr
;
BOOL
ret
;
IFilterGraph2_QueryInterface
(
graph
,
&
IID_IMediaEvent
,
(
void
**
)
&
eventsrc
);
hr
=
IMediaControl_Pause
(
control
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ret
=
check_ec_complete
(
eventsrc
,
0
);
ok
(
!
ret
,
"Got unexpected EC_COMPLETE.
\n
"
);
hr
=
IPin_EndOfStream
(
pin
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ret
=
check_ec_complete
(
eventsrc
,
0
);
ok
(
!
ret
,
"Got unexpected EC_COMPLETE.
\n
"
);
hr
=
IMediaControl_Run
(
control
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ret
=
check_ec_complete
(
eventsrc
,
0
);
ok
(
ret
==
1
,
"Expected EC_COMPLETE.
\n
"
);
hr
=
IMediaControl_Stop
(
control
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
IMediaEvent_Release
(
eventsrc
);
}
static
void
test_connect_pin
(
void
)
{
AM_MEDIA_TYPE
req_mt
=
...
...
@@ -738,6 +789,7 @@ static void test_connect_pin(void)
test_allocator
(
meminput
,
allocator
);
test_filter_state
(
control
);
test_sample_processing
(
control
,
meminput
,
allocator
,
filename
);
test_eos
(
graph
,
control
,
pin
);
hr
=
IFilterGraph2_Disconnect
(
graph
,
pin
);
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