Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/avisplit.c | 8 ++++---- dlls/quartz/mpegsplit.c | 4 ++-- dlls/quartz/parser.c | 38 +++++++++++++++++++------------------- dlls/quartz/waveparser.c | 10 +++++----- 4 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c index 1fbaaf63ba3..aa43e0131e8 100644 --- a/dlls/quartz/avisplit.c +++ b/dlls/quartz/avisplit.c @@ -137,7 +137,7 @@ static HRESULT AVISplitter_SendEndOfFile(AVISplitterImpl *This, DWORD streamnumb
TRACE("End of file reached\n");
- hr = IPin_ConnectedTo(This->Parser.ppPins[streamnumber+1], &ppin); + hr = IPin_ConnectedTo(This->Parser.ppPins[streamnumber], &ppin); if (SUCCEEDED(hr)) { hr = IPin_EndOfStream(ppin); @@ -297,7 +297,7 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample, DWORD streamnumber) { - Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1+streamnumber]); + Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[streamnumber]); HRESULT hr; LONGLONG start, stop, rtstart, rtstop; StreamData *stream = &This->streams[streamnumber]; @@ -571,7 +571,7 @@ static HRESULT AVISplitter_ProcessIndex(AVISplitterImpl *This, AVISTDINDEX **ind if (!pIndex) return E_OUTOFMEMORY;
- IAsyncReader_SyncRead((impl_PullPin_from_IPin(This->Parser.ppPins[0]))->pReader, qwOffset, cb, (BYTE *)pIndex); + IAsyncReader_SyncRead(This->Parser.pInputPin->pReader, qwOffset, cb, (BYTE *)pIndex); rest = cb - sizeof(AVISUPERINDEX) + sizeof(RIFFCHUNK) + sizeof(pIndex->aIndex);
TRACE("FOURCC: %s\n", debugstr_an((char *)&pIndex->fcc, 4)); @@ -1292,7 +1292,7 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface) EnterCriticalSection(&This->Parser.filter.csFilter); for (x = 0; x < This->Parser.cStreams; ++x) { - Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1+x]); + Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[x]); StreamData *stream = This->streams + x; LONGLONG wanted_frames; DWORD last_keyframe = 0, last_keyframeidx = 0, preroll = 0; diff --git a/dlls/quartz/mpegsplit.c b/dlls/quartz/mpegsplit.c index 80c714cec75..f80ab1cb210 100644 --- a/dlls/quartz/mpegsplit.c +++ b/dlls/quartz/mpegsplit.c @@ -168,7 +168,7 @@ static HRESULT parse_header(BYTE *header, LONGLONG *plen, LONGLONG *pduration)
static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample) { - Parser_OutputPin * pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]); + Parser_OutputPin * pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0]); LONGLONG length = 0; LONGLONG pos = BYTES_FROM_MEDIATIME(This->Parser.pInputPin->rtNext); LONGLONG time = This->position, rtstop, rtstart; @@ -322,7 +322,7 @@ static HRESULT MPEGSplitter_process_sample(LPVOID iface, IMediaSample * pSample, { IPin* ppin;
- hr = IPin_ConnectedTo(This->Parser.ppPins[i+1], &ppin); + hr = IPin_ConnectedTo(This->Parser.ppPins[i], &ppin); if (SUCCEEDED(hr)) { hr = IPin_EndOfStream(ppin); diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index 652d4109f41..6c8ddf80f47 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -66,8 +66,10 @@ IPin *parser_get_pin(BaseFilter *iface, unsigned int index) { ParserImpl *filter = impl_from_BaseFilter(iface);
- if (index <= filter->cStreams) - return filter->ppPins[index]; + if (!index) + return &filter->pInputPin->pin.IPin_iface; + else if (index <= filter->cStreams) + return filter->ppPins[index - 1]; return NULL; }
@@ -87,7 +89,7 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown pParser->fnDisconnect = fnDisconnect;
pParser->cStreams = 0; - pParser->ppPins = CoTaskMemAlloc(1 * sizeof(IPin *)); + pParser->ppPins = CoTaskMemAlloc(0 * sizeof(IPin *));
/* construct input pin */ piInput.dir = PINDIR_INPUT; @@ -109,7 +111,6 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown
if (SUCCEEDED(hr)) { - pParser->ppPins[0] = &pParser->pInputPin->pin.IPin_iface; pParser->pInputPin->fnPreConnect = fnPreConnect; } else @@ -184,7 +185,7 @@ void Parser_Destroy(ParserImpl *This) HRESULT WINAPI Parser_Stop(IBaseFilter * iface) { ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin; ULONG i;
TRACE("%p->()\n", This); @@ -204,7 +205,7 @@ HRESULT WINAPI Parser_Stop(IBaseFilter * iface)
This->filter.state = State_Stopped;
- for (i = 1; i < (This->cStreams + 1); i++) + for (i = 0; i < This->cStreams; ++i) { BaseOutputPinImpl_Inactive((BaseOutputPin *)This->ppPins[i]); } @@ -223,7 +224,7 @@ HRESULT WINAPI Parser_Pause(IBaseFilter * iface) { HRESULT hr = S_OK; ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin;
TRACE("%p->()\n", This);
@@ -257,7 +258,7 @@ HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart) { HRESULT hr = S_OK; ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin;
ULONG i;
@@ -277,7 +278,7 @@ HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart) return S_OK; }
- for (i = 1; i < (This->cStreams + 1); i++) + for (i = 0; i < This->cStreams; ++i) { hr = BaseOutputPinImpl_Active((BaseOutputPin *)This->ppPins[i]); if (SUCCEEDED(hr)) @@ -304,7 +305,7 @@ HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart) HRESULT WINAPI Parser_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState) { ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin; HRESULT hr = S_OK;
TRACE("%p->(%d, %p)\n", This, dwMilliSecsTimeout, pState); @@ -326,7 +327,7 @@ HRESULT WINAPI Parser_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FI HRESULT WINAPI Parser_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock) { ParserImpl *This = impl_from_IBaseFilter(iface); - PullPin *pin = impl_PullPin_from_IPin(This->ppPins[0]); + PullPin *pin = This->pInputPin;
TRACE("%p->(%p)\n", This, pClock);
@@ -354,14 +355,15 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR
ppOldPins = This->ppPins;
- This->ppPins = CoTaskMemAlloc((This->cStreams + 2) * sizeof(IPin *)); - memcpy(This->ppPins, ppOldPins, (This->cStreams + 1) * sizeof(IPin *)); + This->ppPins = CoTaskMemAlloc((This->cStreams + 1) * sizeof(IPin *)); + memcpy(This->ppPins, ppOldPins, This->cStreams * sizeof(IPin *));
- hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, &output_BaseOutputFuncTable, &This->filter.csFilter, This->ppPins + (This->cStreams + 1)); + hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, + &output_BaseOutputFuncTable, &This->filter.csFilter, &This->ppPins[This->cStreams]);
if (SUCCEEDED(hr)) { - IPin *pPin = This->ppPins[This->cStreams + 1]; + IPin *pPin = This->ppPins[This->cStreams]; Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(pPin); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); CopyMediaType(pin->pmt, amt); @@ -409,12 +411,10 @@ static HRESULT Parser_RemoveOutputPins(ParserImpl * This)
TRACE("(%p)\n", This);
- /* reduce the pin array down to 1 (just our input pin) */ - This->ppPins = CoTaskMemAlloc(sizeof(IPin *) * 1); - memcpy(This->ppPins, ppOldPins, sizeof(IPin *) * 1); + This->ppPins = CoTaskMemAlloc(0);
for (i = 0; i < This->cStreams; i++) - free_source_pin(ppOldPins[i + 1]); + free_source_pin(ppOldPins[i]);
BaseFilterImpl_IncrementPinVersion(&This->filter); This->cStreams = 0; diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c index 1767adf2352..5b2608ac88e 100644 --- a/dlls/quartz/waveparser.c +++ b/dlls/quartz/waveparser.c @@ -102,7 +102,7 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR return S_OK; }
- pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]); + pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0]);
if (SUCCEEDED(hr)) hr = IMemAllocator_GetBuffer(pin->pAlloc, &newsample, NULL, NULL, 0); @@ -161,7 +161,7 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR
TRACE("Send End Of Stream to output pin %u\n", i);
- hr = IPin_ConnectedTo(This->Parser.ppPins[i+1], &ppin); + hr = IPin_ConnectedTo(This->Parser.ppPins[i], &ppin); if (SUCCEEDED(hr)) { hr = IPin_EndOfStream(ppin); @@ -225,7 +225,7 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface)
/* Make sure this is done while stopped, BeginFlush takes care of this */ EnterCriticalSection(&This->Parser.filter.csFilter); - IPin_ConnectedTo(This->Parser.ppPins[1], &victim); + IPin_ConnectedTo(This->Parser.ppPins[0], &victim); if (victim) { IPin_NewSegment(victim, newpos, endpos, pPin->dRate); @@ -233,7 +233,7 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface) }
pPin->rtStart = pPin->rtCurrent = bytepos; - unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1])->dwSamplesProcessed = 0; + unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0])->dwSamplesProcessed = 0; LeaveCriticalSection(&This->Parser.filter.csFilter);
TRACE("Done flushing\n"); @@ -364,7 +364,7 @@ static HRESULT WAVEParser_first_request(LPVOID iface) LONGLONG rtSampleStart = pin->rtNext; /* Add 4 for the next header, which should hopefully work */ LONGLONG rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(sample)); - Parser_OutputPin *outpin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]); + Parser_OutputPin *outpin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[0]);
if (rtSampleStop > pin->rtStop) rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(pin->rtStop), pin->cbAlign));