Maarten Lankhorst : quartz: Get rid of the sample holding code in the wave parser.
Alexandre Julliard
julliard at winehq.org
Thu May 1 06:39:12 CDT 2008
Module: wine
Branch: master
Commit: 8099a624697dbf1a72c58e95fa960f3355345aef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8099a624697dbf1a72c58e95fa960f3355345aef
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Wed Apr 30 14:34:19 2008 -0700
quartz: Get rid of the sample holding code in the wave parser.
---
dlls/quartz/waveparser.c | 45 ++++++---------------------------------------
1 files changed, 6 insertions(+), 39 deletions(-)
diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c
index 3818214..a40bb65 100644
--- a/dlls/quartz/waveparser.c
+++ b/dlls/quartz/waveparser.c
@@ -42,7 +42,6 @@ static const WCHAR wcsOutputPinName[] = {'o','u','t','p','u','t',' ','p','i','n'
typedef struct WAVEParserImpl
{
ParserImpl Parser;
- IMediaSample * pCurrentSample;
LONGLONG StartOfFile; /* in media time */
LONGLONG EndOfFile;
DWORD dwSampleSize;
@@ -97,28 +96,6 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR
pOutputPin = (Parser_OutputPin *)This->Parser.ppPins[1];
- /* Try to get rid of the current sample in case we had a S_FALSE last time */
- if (This->pCurrentSample)
- {
- Parser_OutputPin * pOutputPin = (Parser_OutputPin*)This->Parser.ppPins[1];
- IMediaSample *pCurrentSample = This->pCurrentSample;
-
- /* Requeue buffer */
- hr = OutputPin_SendSample(&pOutputPin->pin, pCurrentSample);
-
- if (hr != S_OK)
- {
- Sleep(10);
- TRACE("Requeueing!\n");
- IMediaSample_AddRef(pSample);
- IAsyncReader_Request(This->Parser.pInputPin->pReader, pSample, 0);
- return hr;
- }
-
- IMediaSample_Release(This->pCurrentSample);
- This->pCurrentSample = NULL;
- }
-
if (SUCCEEDED(hr))
hr = IMemAllocator_GetBuffer(pin->pAlloc, &newsample, NULL, NULL, 0);
@@ -156,18 +133,14 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR
IMediaSample_SetTime(pSample, &tAviStart, &tAviStop);
hr = OutputPin_SendSample(&pOutputPin->pin, pSample);
- if (hr != S_OK && hr != VFW_E_NOT_CONNECTED && hr != S_FALSE)
+ if (hr != S_OK && hr != S_FALSE && hr != VFW_E_WRONG_STATE)
ERR("Error sending sample (%x)\n", hr);
-
- if (hr == S_FALSE)
- {
- This->pCurrentSample = pSample;
- IMediaSample_AddRef(pSample);
- hr = S_OK;
- }
+ else if (hr != S_OK)
+ /* Unset progression if denied! */
+ This->Parser.pInputPin->rtCurrent = tStart;
}
- if (tStop >= This->EndOfFile || (bytepos_to_duration(This, tStop) >= This->Parser.mediaSeeking.llStop))
+ if (tStop >= This->EndOfFile || (bytepos_to_duration(This, tStop) >= This->Parser.mediaSeeking.llStop) || hr == VFW_E_NOT_CONNECTED)
{
int i;
@@ -338,7 +311,7 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
props->cbAlign = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign;
props->cbPrefix = 0;
props->cbBuffer = 4096;
- props->cBuffers = 2;
+ props->cBuffers = 3;
pWAVEParser->dwSampleSize = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign;
IAsyncReader_Length(This->pReader, &length, &avail);
pWAVEParser->dwLength = length / (ULONGLONG)pWAVEParser->dwSampleSize;
@@ -364,10 +337,6 @@ static HRESULT WAVEParser_Cleanup(LPVOID iface)
TRACE("(%p)->()\n", This);
- if (This->pCurrentSample)
- IMediaSample_Release(This->pCurrentSample);
- This->pCurrentSample = NULL;
-
return S_OK;
}
@@ -457,8 +426,6 @@ HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv)
/* Note: This memory is managed by the transform filter once created */
This = CoTaskMemAlloc(sizeof(WAVEParserImpl));
- This->pCurrentSample = NULL;
-
hr = Parser_Create(&(This->Parser), &WAVEParser_Vtbl, &CLSID_WAVEParser, WAVEParser_Sample, WAVEParser_QueryAccept, WAVEParser_InputPin_PreConnect, WAVEParser_Cleanup, WAVEParser_disconnect, WAVEParser_first_request, NULL, NULL, WAVEParserImpl_seek, NULL);
if (FAILED(hr))
More information about the wine-cvs
mailing list