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
b6b67f69
Commit
b6b67f69
authored
Jul 04, 2008
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Jul 04, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz: Implement state transitions in directsound renderer, and block on pause.
parent
620d7836
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
3 deletions
+78
-3
dsoundrender.c
dlls/quartz/dsoundrender.c
+78
-3
No files found.
dlls/quartz/dsoundrender.c
View file @
b6b67f69
...
...
@@ -73,6 +73,8 @@ typedef struct DSoundRenderImpl
REFERENCE_TIME
play_time
;
MediaSeekingImpl
mediaSeeking
;
HANDLE
state_change
,
blocked
;
long
volume
;
long
pan
;
}
DSoundRenderImpl
;
...
...
@@ -246,6 +248,8 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample)
if
(
This
->
state
==
State_Stopped
)
return
VFW_E_WRONG_STATE
;
SetEvent
(
This
->
state_change
);
hr
=
IMediaSample_GetPointer
(
pSample
,
&
pbSrcStream
);
if
(
FAILED
(
hr
))
{
...
...
@@ -270,7 +274,19 @@ static HRESULT DSoundRender_Sample(LPVOID iface, IMediaSample * pSample)
}
if
(
This
->
state
==
State_Paused
)
return
S_OK
;
{
LeaveCriticalSection
(
&
This
->
csFilter
);
WaitForSingleObject
(
This
->
blocked
,
INFINITE
);
EnterCriticalSection
(
&
This
->
csFilter
);
if
(
This
->
state
==
State_Stopped
)
return
VFW_E_WRONG_STATE
;
if
(
This
->
state
==
State_Paused
)
{
/* Assuming we return because of flushing */
return
S_OK
;
}
}
cbSrcStream
=
IMediaSample_GetActualDataLength
(
pSample
);
TRACE
(
"Sample data ptr = %p, size = %ld
\n
"
,
pbSrcStream
,
cbSrcStream
);
...
...
@@ -359,6 +375,15 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
MediaSeekingImpl_Init
((
IBaseFilter
*
)
pDSoundRender
,
sound_mod_stop
,
sound_mod_start
,
sound_mod_rate
,
&
pDSoundRender
->
mediaSeeking
,
&
pDSoundRender
->
csFilter
);
pDSoundRender
->
mediaSeeking
.
lpVtbl
=
&
IMediaSeeking_Vtbl
;
pDSoundRender
->
state_change
=
CreateEventW
(
NULL
,
TRUE
,
TRUE
,
NULL
);
pDSoundRender
->
blocked
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
if
(
!
pDSoundRender
->
state_change
||
!
pDSoundRender
->
blocked
)
{
IUnknown_Release
((
IUnknown
*
)
pDSoundRender
);
return
HRESULT_FROM_WIN32
(
GetLastError
());
}
*
ppv
=
(
LPVOID
)
pDSoundRender
;
}
else
...
...
@@ -453,6 +478,9 @@ static ULONG WINAPI DSoundRender_Release(IBaseFilter * iface)
This
->
csFilter
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
csFilter
);
CloseHandle
(
This
->
state_change
);
CloseHandle
(
This
->
blocked
);
TRACE
(
"Destroying Audio Renderer
\n
"
);
CoTaskMemFree
(
This
);
...
...
@@ -497,6 +525,10 @@ static HRESULT WINAPI DSoundRender_Stop(IBaseFilter * iface)
}
if
(
SUCCEEDED
(
hr
))
This
->
state
=
State_Stopped
;
/* Complete our transition */
SetEvent
(
This
->
state_change
);
SetEvent
(
This
->
blocked
);
}
LeaveCriticalSection
(
&
This
->
csFilter
);
...
...
@@ -511,10 +543,13 @@ static HRESULT WINAPI DSoundRender_Pause(IBaseFilter * iface)
TRACE
(
"(%p/%p)->()
\n
"
,
This
,
iface
);
EnterCriticalSection
(
&
This
->
csFilter
);
if
(
This
->
state
!=
State_Paused
)
{
DWORD
state
=
0
;
if
(
This
->
state
==
State_Stopped
)
{
This
->
pInputPin
->
end_of_stream
=
0
;
}
if
(
This
->
dsbuffer
)
{
...
...
@@ -527,6 +562,9 @@ static HRESULT WINAPI DSoundRender_Pause(IBaseFilter * iface)
}
if
(
SUCCEEDED
(
hr
))
This
->
state
=
State_Paused
;
ResetEvent
(
This
->
blocked
);
ResetEvent
(
This
->
state_change
);
}
LeaveCriticalSection
(
&
This
->
csFilter
);
...
...
@@ -543,8 +581,18 @@ static HRESULT WINAPI DSoundRender_Run(IBaseFilter * iface, REFERENCE_TIME tStar
EnterCriticalSection
(
&
This
->
csFilter
);
{
This
->
rtStreamStart
=
tStart
;
if
(
This
->
state
==
State_Paused
)
{
/* Unblock our thread, state changing from paused to running doesn't need a reset for state change */
SetEvent
(
This
->
blocked
);
}
else
if
(
This
->
state
==
State_Stopped
)
{
ResetEvent
(
This
->
state_change
);
This
->
pInputPin
->
end_of_stream
=
0
;
}
This
->
state
=
State_Running
;
This
->
pInputPin
->
end_of_stream
=
0
;
}
LeaveCriticalSection
(
&
This
->
csFilter
);
...
...
@@ -553,10 +601,16 @@ static HRESULT WINAPI DSoundRender_Run(IBaseFilter * iface, REFERENCE_TIME tStar
static
HRESULT
WINAPI
DSoundRender_GetState
(
IBaseFilter
*
iface
,
DWORD
dwMilliSecsTimeout
,
FILTER_STATE
*
pState
)
{
HRESULT
hr
;
DSoundRenderImpl
*
This
=
(
DSoundRenderImpl
*
)
iface
;
TRACE
(
"(%p/%p)->(%d, %p)
\n
"
,
This
,
iface
,
dwMilliSecsTimeout
,
pState
);
if
(
WaitForSingleObject
(
This
->
state_change
,
dwMilliSecsTimeout
)
==
WAIT_TIMEOUT
)
hr
=
VFW_S_STATE_INTERMEDIATE
;
else
hr
=
S_OK
;
EnterCriticalSection
(
&
This
->
csFilter
);
{
*
pState
=
This
->
state
;
...
...
@@ -866,6 +920,27 @@ static HRESULT WINAPI DSoundRender_InputPin_BeginFlush(IPin * iface)
memset
(
buffer
,
0
,
size
);
IDirectSoundBuffer_Unlock
(
pFilter
->
dsbuffer
,
buffer
,
size
,
NULL
,
0
);
}
if
(
pFilter
->
state
==
State_Paused
)
SetEvent
(
pFilter
->
blocked
);
LeaveCriticalSection
(
This
->
pin
.
pCritSec
);
return
hr
;
}
static
HRESULT
WINAPI
DSoundRender_InputPin_EndFlush
(
IPin
*
iface
)
{
InputPin
*
This
=
(
InputPin
*
)
iface
;
DSoundRenderImpl
*
pFilter
=
(
DSoundRenderImpl
*
)
This
->
pin
.
pinInfo
.
pFilter
;
HRESULT
hr
;
TRACE
(
"
\n
"
);
EnterCriticalSection
(
This
->
pin
.
pCritSec
);
hr
=
InputPin_EndFlush
(
iface
);
if
(
pFilter
->
state
==
State_Paused
)
SetEvent
(
pFilter
->
blocked
);
LeaveCriticalSection
(
This
->
pin
.
pCritSec
);
return
hr
;
...
...
@@ -889,7 +964,7 @@ static const IPinVtbl DSoundRender_InputPin_Vtbl =
IPinImpl_QueryInternalConnections
,
DSoundRender_InputPin_EndOfStream
,
DSoundRender_InputPin_BeginFlush
,
InputPin_EndFlush
,
DSoundRender_
InputPin_EndFlush
,
InputPin_NewSegment
};
...
...
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