Commit 7fab2428 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

quartz: COM cleanup for Parser_OutputPin.

parent 8560f36c
...@@ -288,7 +288,7 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe ...@@ -288,7 +288,7 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample, DWORD streamnumber) static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample, DWORD streamnumber)
{ {
Parser_OutputPin *pin = (Parser_OutputPin *)This->Parser.ppPins[1+streamnumber]; Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1+streamnumber]);
HRESULT hr; HRESULT hr;
LONGLONG start, stop, rtstart, rtstop; LONGLONG start, stop, rtstart, rtstop;
StreamData *stream = &This->streams[streamnumber]; StreamData *stream = &This->streams[streamnumber];
...@@ -318,7 +318,7 @@ static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample, ...@@ -318,7 +318,7 @@ static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample,
EnterCriticalSection(&This->Parser.filter.csFilter); EnterCriticalSection(&This->Parser.filter.csFilter);
pin->pin.pin.tStart = start; pin->pin.pin.tStart = start;
pin->pin.pin.dRate = This->Parser.sourceSeeking.dRate; pin->pin.pin.dRate = This->Parser.sourceSeeking.dRate;
hr = IPin_ConnectedTo((IPin *)pin, &victim); hr = IPin_ConnectedTo(&pin->pin.pin.IPin_iface, &victim);
if (hr == S_OK) if (hr == S_OK)
{ {
hr = IPin_NewSegment(victim, start, This->Parser.sourceSeeking.llStop, hr = IPin_NewSegment(victim, start, This->Parser.sourceSeeking.llStop,
...@@ -337,7 +337,7 @@ static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample, ...@@ -337,7 +337,7 @@ static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample,
IMediaSample_SetTime(sample, &rtstart, &rtstop); IMediaSample_SetTime(sample, &rtstart, &rtstop);
IMediaSample_SetMediaTime(sample, &start, &stop); IMediaSample_SetMediaTime(sample, &start, &stop);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)&pin->pin, sample); hr = BaseOutputPinImpl_Deliver(&pin->pin, sample);
/* Uncomment this if you want to debug the time differences between the /* Uncomment this if you want to debug the time differences between the
* different streams, it is useful for that * different streams, it is useful for that
...@@ -1307,7 +1307,7 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface) ...@@ -1307,7 +1307,7 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface)
EnterCriticalSection(&This->Parser.filter.csFilter); EnterCriticalSection(&This->Parser.filter.csFilter);
for (x = 0; x < This->Parser.cStreams; ++x) for (x = 0; x < This->Parser.cStreams; ++x)
{ {
Parser_OutputPin *pin = (Parser_OutputPin *)This->Parser.ppPins[1+x]; Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1+x]);
StreamData *stream = This->streams + x; StreamData *stream = This->streams + x;
LONGLONG wanted_frames; LONGLONG wanted_frames;
DWORD last_keyframe = 0, last_keyframeidx = 0, preroll = 0; DWORD last_keyframe = 0, last_keyframeidx = 0, preroll = 0;
......
...@@ -169,7 +169,7 @@ static HRESULT parse_header(BYTE *header, LONGLONG *plen, LONGLONG *pduration) ...@@ -169,7 +169,7 @@ static HRESULT parse_header(BYTE *header, LONGLONG *plen, LONGLONG *pduration)
static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample) static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample)
{ {
Parser_OutputPin * pOutputPin = (Parser_OutputPin*)This->Parser.ppPins[1]; Parser_OutputPin * pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]);
LONGLONG length = 0; LONGLONG length = 0;
LONGLONG pos = BYTES_FROM_MEDIATIME(This->Parser.pInputPin->rtNext); LONGLONG pos = BYTES_FROM_MEDIATIME(This->Parser.pInputPin->rtNext);
LONGLONG time = This->position, rtstop, rtstart; LONGLONG time = This->position, rtstop, rtstart;
...@@ -241,7 +241,7 @@ static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample) ...@@ -241,7 +241,7 @@ static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample)
EnterCriticalSection(&This->Parser.filter.csFilter); EnterCriticalSection(&This->Parser.filter.csFilter);
pOutputPin->pin.pin.tStart = time; pOutputPin->pin.pin.tStart = time;
pOutputPin->pin.pin.dRate = This->Parser.sourceSeeking.dRate; pOutputPin->pin.pin.dRate = This->Parser.sourceSeeking.dRate;
hr = IPin_ConnectedTo((IPin *)pOutputPin, &victim); hr = IPin_ConnectedTo(&pOutputPin->pin.pin.IPin_iface, &victim);
if (hr == S_OK) if (hr == S_OK)
{ {
hr = IPin_NewSegment(victim, time, This->Parser.sourceSeeking.llStop, hr = IPin_NewSegment(victim, time, This->Parser.sourceSeeking.llStop,
...@@ -259,7 +259,7 @@ static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample) ...@@ -259,7 +259,7 @@ static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample)
IMediaSample_SetTime(pCurrentSample, &rtstart, &rtstop); IMediaSample_SetTime(pCurrentSample, &rtstart, &rtstop);
IMediaSample_SetMediaTime(pCurrentSample, &time, &This->position); IMediaSample_SetMediaTime(pCurrentSample, &time, &This->position);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)&pOutputPin->pin, pCurrentSample); hr = BaseOutputPinImpl_Deliver(&pOutputPin->pin, pCurrentSample);
if (hr != S_OK) if (hr != S_OK)
{ {
......
...@@ -437,7 +437,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR ...@@ -437,7 +437,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
IPin *pPin = This->ppPins[This->cStreams + 1]; IPin *pPin = This->ppPins[This->cStreams + 1];
Parser_OutputPin *pin = (Parser_OutputPin *)pPin; Parser_OutputPin *pin = unsafe_impl_Parser_OutputPin_from_IPin(pPin);
pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(pin->pmt, amt); CopyMediaType(pin->pmt, amt);
pin->dwSamplesProcessed = 0; pin->dwSamplesProcessed = 0;
...@@ -614,7 +614,7 @@ static HRESULT WINAPI Parser_OutputPin_BreakConnect(BaseOutputPin *This) ...@@ -614,7 +614,7 @@ static HRESULT WINAPI Parser_OutputPin_BreakConnect(BaseOutputPin *This)
static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv) static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
{ {
Parser_OutputPin *This = (Parser_OutputPin *)iface; Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface);
TRACE("(%s, %p)\n", qzdebugstr_guid(riid), ppv); TRACE("(%s, %p)\n", qzdebugstr_guid(riid), ppv);
...@@ -641,7 +641,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid, ...@@ -641,7 +641,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid,
static ULONG WINAPI Parser_OutputPin_Release(IPin * iface) static ULONG WINAPI Parser_OutputPin_Release(IPin * iface)
{ {
Parser_OutputPin *This = (Parser_OutputPin *)iface; Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface);
ULONG refCount = InterlockedDecrement(&This->pin.pin.refCount); ULONG refCount = InterlockedDecrement(&This->pin.pin.refCount);
TRACE("(%p)->() Release from %d\n", iface, refCount + 1); TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
...@@ -659,7 +659,7 @@ static ULONG WINAPI Parser_OutputPin_Release(IPin * iface) ...@@ -659,7 +659,7 @@ static ULONG WINAPI Parser_OutputPin_Release(IPin * iface)
static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
{ {
Parser_OutputPin *This = (Parser_OutputPin *)iface; Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface);
ParserImpl *parser = (ParserImpl *)This->pin.pin.pinInfo.pFilter; ParserImpl *parser = (ParserImpl *)This->pin.pin.pinInfo.pFilter;
/* Set the allocator to our input pin's */ /* Set the allocator to our input pin's */
...@@ -672,7 +672,7 @@ static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, ...@@ -672,7 +672,7 @@ static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin,
static HRESULT WINAPI Parser_OutputPin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI Parser_OutputPin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE * pmt)
{ {
Parser_OutputPin *This = (Parser_OutputPin *)iface; Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface);
TRACE("()\n"); TRACE("()\n");
dump_AM_MEDIA_TYPE(pmt); dump_AM_MEDIA_TYPE(pmt);
......
...@@ -74,3 +74,9 @@ extern HRESULT WINAPI Parser_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppP ...@@ -74,3 +74,9 @@ extern HRESULT WINAPI Parser_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppP
extern HRESULT WINAPI Parser_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo); extern HRESULT WINAPI Parser_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo);
extern HRESULT WINAPI Parser_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName); extern HRESULT WINAPI Parser_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName);
extern HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo); extern HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo);
/* COM helpers */
static inline Parser_OutputPin *unsafe_impl_Parser_OutputPin_from_IPin( IPin *iface )
{
return CONTAINING_RECORD(iface, Parser_OutputPin, pin.pin.IPin_iface);
}
...@@ -103,7 +103,7 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR ...@@ -103,7 +103,7 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR
return S_OK; return S_OK;
} }
pOutputPin = (Parser_OutputPin *)This->Parser.ppPins[1]; pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = IMemAllocator_GetBuffer(pin->pAlloc, &newsample, NULL, NULL, 0); hr = IMemAllocator_GetBuffer(pin->pAlloc, &newsample, NULL, NULL, 0);
...@@ -232,7 +232,7 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface) ...@@ -232,7 +232,7 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface)
} }
pPin->rtStart = pPin->rtCurrent = bytepos; pPin->rtStart = pPin->rtCurrent = bytepos;
((Parser_OutputPin *)This->Parser.ppPins[1])->dwSamplesProcessed = 0; unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1])->dwSamplesProcessed = 0;
LeaveCriticalSection(&This->Parser.filter.csFilter); LeaveCriticalSection(&This->Parser.filter.csFilter);
TRACE("Done flushing\n"); TRACE("Done flushing\n");
...@@ -371,7 +371,7 @@ static HRESULT WAVEParser_first_request(LPVOID iface) ...@@ -371,7 +371,7 @@ static HRESULT WAVEParser_first_request(LPVOID iface)
LONGLONG rtSampleStart = pin->rtNext; LONGLONG rtSampleStart = pin->rtNext;
/* Add 4 for the next header, which should hopefully work */ /* Add 4 for the next header, which should hopefully work */
LONGLONG rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(sample)); LONGLONG rtSampleStop = rtSampleStart + MEDIATIME_FROM_BYTES(IMediaSample_GetSize(sample));
Parser_OutputPin *outpin = (Parser_OutputPin *)This->Parser.ppPins[1]; Parser_OutputPin *outpin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]);
if (rtSampleStop > pin->rtStop) if (rtSampleStop > pin->rtStop)
rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(pin->rtStop), pin->cbAlign)); rtSampleStop = MEDIATIME_FROM_BYTES(ALIGNUP(BYTES_FROM_MEDIATIME(pin->rtStop), pin->cbAlign));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment