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
3066116f
Commit
3066116f
authored
Apr 30, 2008
by
Maarten Lankhorst
Committed by
Alexandre Julliard
May 01, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz: Clean up pullpin code.
parent
c4cdfdac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
94 deletions
+21
-94
pin.c
dlls/quartz/pin.c
+21
-94
No files found.
dlls/quartz/pin.c
View file @
3066116f
...
...
@@ -1233,6 +1233,7 @@ static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinI
pPinImpl
->
rtStop
=
((
LONGLONG
)
0x7fffffff
<<
32
)
|
0xffffffff
;
pPinImpl
->
dRate
=
1
.
0
;
pPinImpl
->
state
=
Req_Die
;
assert
(
pCustomRequest
);
pPinImpl
->
fnCustomRequest
=
pCustomRequest
;
pPinImpl
->
stop_playback
=
1
;
...
...
@@ -1399,44 +1400,6 @@ ULONG WINAPI PullPin_Release(IPin *iface)
return
refCount
;
}
static
HRESULT
PullPin_Standard_Request
(
PullPin
*
This
,
BOOL
start
)
{
REFERENCE_TIME
rtSampleStart
;
REFERENCE_TIME
rtSampleStop
;
IMediaSample
*
sample
=
NULL
;
HRESULT
hr
;
TRACE
(
"Requesting sample!
\n
"
);
if
(
start
)
This
->
rtNext
=
This
->
rtCurrent
;
if
(
This
->
rtNext
>=
This
->
rtStop
)
/* Last sample has already been queued, request nothing more */
return
S_OK
;
hr
=
IMemAllocator_GetBuffer
(
This
->
pAlloc
,
&
sample
,
NULL
,
NULL
,
0
);
if
(
SUCCEEDED
(
hr
))
{
rtSampleStart
=
This
->
rtNext
;
rtSampleStop
=
rtSampleStart
+
MEDIATIME_FROM_BYTES
(
IMediaSample_GetSize
(
sample
));
if
(
rtSampleStop
>
This
->
rtStop
)
rtSampleStop
=
MEDIATIME_FROM_BYTES
(
ALIGNUP
(
BYTES_FROM_MEDIATIME
(
This
->
rtStop
),
This
->
cbAlign
));
hr
=
IMediaSample_SetTime
(
sample
,
&
rtSampleStart
,
&
rtSampleStop
);
This
->
rtCurrent
=
This
->
rtNext
;
This
->
rtNext
=
rtSampleStop
;
if
(
SUCCEEDED
(
hr
))
hr
=
IAsyncReader_Request
(
This
->
pReader
,
sample
,
0
);
}
if
(
FAILED
(
hr
))
FIXME
(
"Failed to queue sample : %08x
\n
"
,
hr
);
return
hr
;
}
static
void
CALLBACK
PullPin_Flush
(
PullPin
*
This
)
{
IMediaSample
*
pSample
;
...
...
@@ -1445,6 +1408,8 @@ static void CALLBACK PullPin_Flush(PullPin *This)
EnterCriticalSection
(
This
->
pin
.
pCritSec
);
if
(
This
->
pReader
)
{
SendFurther
((
IPin
*
)
This
,
deliver_beginflush
,
NULL
,
NULL
);
/* Flush outstanding samples */
IAsyncReader_BeginFlush
(
This
->
pReader
);
for
(;;)
...
...
@@ -1457,13 +1422,12 @@ static void CALLBACK PullPin_Flush(PullPin *This)
break
;
assert
(
!
IMediaSample_GetActualDataLength
(
pSample
));
if
(
This
->
fnCustomRequest
)
This
->
fnSampleProc
(
This
->
pin
.
pUserData
,
pSample
,
dwUser
);
IMediaSample_Release
(
pSample
);
}
IAsyncReader_EndFlush
(
This
->
pReader
);
SendFurther
((
IPin
*
)
This
,
deliver_endflush
,
NULL
,
NULL
);
This
->
fnCleanProc
(
This
->
pin
.
pUserData
);
}
LeaveCriticalSection
(
This
->
pin
.
pCritSec
);
}
...
...
@@ -1490,10 +1454,7 @@ static void CALLBACK PullPin_Thread_Process(PullPin *This)
}
/* There is no sample in our buffer */
if
(
!
This
->
fnCustomRequest
)
hr
=
PullPin_Standard_Request
(
This
,
TRUE
);
else
hr
=
This
->
fnCustomRequest
(
This
->
pin
.
pUserData
);
hr
=
This
->
fnCustomRequest
(
This
->
pin
.
pUserData
);
if
(
FAILED
(
hr
))
ERR
(
"Request error: %x
\n
"
,
hr
);
...
...
@@ -1510,46 +1471,18 @@ static void CALLBACK PullPin_Thread_Process(PullPin *This)
hr
=
IAsyncReader_WaitForNext
(
This
->
pReader
,
10000
,
&
pSample
,
&
dwUser
);
/* Calling fnCustomRequest is not specifically useful here: It can be handled inside fnSampleProc */
if
(
pSample
&&
!
This
->
fnCustomRequest
)
hr
=
PullPin_Standard_Request
(
This
,
FALSE
);
/* Return an empty sample on error to the implementation in case it does custom parsing, so it knows it's gone */
if
(
SUCCEEDED
(
hr
)
||
(
This
->
fnCustomRequest
&&
pSample
))
if
(
SUCCEEDED
(
hr
))
{
REFERENCE_TIME
rtStart
,
rtStop
;
BOOL
rejected
;
IMediaSample_GetTime
(
pSample
,
&
rtStart
,
&
rtStop
);
do
{
hr
=
This
->
fnSampleProc
(
This
->
pin
.
pUserData
,
pSample
,
dwUser
);
if
(
This
->
fnCustomRequest
)
break
;
rejected
=
FALSE
;
if
(
This
->
rtCurrent
==
rtStart
)
{
rejected
=
TRUE
;
TRACE
(
"DENIED!
\n
"
);
Sleep
(
10
);
/* Maybe it's transient? */
}
/* rtNext = rtCurrent, because the next sample is already queued */
else
if
(
rtStop
!=
This
->
rtCurrent
&&
rtStop
<
This
->
rtStop
)
{
WARN
(
"Position changed! rtStop: %u, rtCurrent: %u
\n
"
,
(
DWORD
)
BYTES_FROM_MEDIATIME
(
rtStop
),
(
DWORD
)
BYTES_FROM_MEDIATIME
(
This
->
rtCurrent
));
PullPin_Flush
(
This
);
hr
=
PullPin_Standard_Request
(
This
,
TRUE
);
}
}
while
(
rejected
&&
(
This
->
rtCurrent
<
This
->
rtStop
&&
hr
==
S_OK
&&
!
This
->
stop_playback
));
hr
=
This
->
fnSampleProc
(
This
->
pin
.
pUserData
,
pSample
,
dwUser
);
}
else
{
/* FIXME: This is not well handled yet! */
ERR
(
"Processing error: %x
\n
"
,
hr
);
ERR
(
"Processing
/wait
error: %x
\n
"
,
hr
);
}
if
(
pSample
)
...
...
@@ -1764,12 +1697,6 @@ HRESULT WINAPI PullPin_BeginFlush(IPin * iface)
PullPin
*
This
=
(
PullPin
*
)
iface
;
TRACE
(
"(%p)->()
\n
"
,
This
);
EnterCriticalSection
(
This
->
pin
.
pCritSec
);
{
SendFurther
(
iface
,
deliver_beginflush
,
NULL
,
NULL
);
}
LeaveCriticalSection
(
This
->
pin
.
pCritSec
);
EnterCriticalSection
(
&
This
->
thread_lock
);
{
PullPin_WaitForStateChange
(
This
,
INFINITE
);
...
...
@@ -1779,14 +1706,13 @@ HRESULT WINAPI PullPin_BeginFlush(IPin * iface)
PullPin_PauseProcessing
(
This
);
PullPin_WaitForStateChange
(
This
,
INFINITE
);
}
}
LeaveCriticalSection
(
&
This
->
thread_lock
);
EnterCriticalSection
(
This
->
pin
.
pCritSec
);
{
This
->
fnCleanProc
(
This
->
pin
.
pUserData
);
EnterCriticalSection
(
This
->
pin
.
pCritSec
);
SendFurther
(
iface
,
deliver_beginflush
,
NULL
,
NULL
);
LeaveCriticalSection
(
This
->
pin
.
pCritSec
);
}
LeaveCriticalSection
(
This
->
pin
.
pCritSec
);
LeaveCriticalSection
(
&
This
->
thread_lock
);
return
S_OK
;
}
...
...
@@ -1802,17 +1728,18 @@ HRESULT WINAPI PullPin_EndFlush(IPin * iface)
FILTER_STATE
state
;
IBaseFilter_GetState
(
This
->
pin
.
pinInfo
.
pFilter
,
INFINITE
,
&
state
);
EnterCriticalSection
(
This
->
pin
.
pCritSec
);
SendFurther
(
iface
,
deliver_endflush
,
NULL
,
NULL
);
LeaveCriticalSection
(
This
->
pin
.
pCritSec
);
if
(
This
->
stop_playback
&&
state
==
State_Running
)
{
PullPin_StartProcessing
(
This
);
PullPin_WaitForStateChange
(
This
,
INFINITE
);
PullPin_WaitForStateChange
(
This
,
INFINITE
);
}
}
LeaveCriticalSection
(
&
This
->
thread_lock
);
EnterCriticalSection
(
This
->
pin
.
pCritSec
);
SendFurther
(
iface
,
deliver_endflush
,
NULL
,
NULL
);
LeaveCriticalSection
(
This
->
pin
.
pCritSec
);
return
S_OK
;
}
...
...
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