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
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;
LONGLONG start, stop, rtstart, rtstop;
StreamData *stream = &This->streams[streamnumber];
......@@ -318,7 +318,7 @@ static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample,
EnterCriticalSection(&This->Parser.filter.csFilter);
pin->pin.pin.tStart = start;
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)
{
hr = IPin_NewSegment(victim, start, This->Parser.sourceSeeking.llStop,
......@@ -337,7 +337,7 @@ static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample,
IMediaSample_SetTime(sample, &rtstart, &rtstop);
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
* different streams, it is useful for that
......@@ -1307,7 +1307,7 @@ static HRESULT WINAPI AVISplitter_seek(IMediaSeeking *iface)
EnterCriticalSection(&This->Parser.filter.csFilter);
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;
LONGLONG wanted_frames;
DWORD last_keyframe = 0, last_keyframeidx = 0, preroll = 0;
......
......@@ -169,7 +169,7 @@ static HRESULT parse_header(BYTE *header, LONGLONG *plen, LONGLONG *pduration)
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 pos = BYTES_FROM_MEDIATIME(This->Parser.pInputPin->rtNext);
LONGLONG time = This->position, rtstop, rtstart;
......@@ -241,7 +241,7 @@ static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample)
EnterCriticalSection(&This->Parser.filter.csFilter);
pOutputPin->pin.pin.tStart = time;
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)
{
hr = IPin_NewSegment(victim, time, This->Parser.sourceSeeking.llStop,
......@@ -259,7 +259,7 @@ static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample)
IMediaSample_SetTime(pCurrentSample, &rtstart, &rtstop);
IMediaSample_SetMediaTime(pCurrentSample, &time, &This->position);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)&pOutputPin->pin, pCurrentSample);
hr = BaseOutputPinImpl_Deliver(&pOutputPin->pin, pCurrentSample);
if (hr != S_OK)
{
......
......@@ -437,7 +437,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR
if (SUCCEEDED(hr))
{
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));
CopyMediaType(pin->pmt, amt);
pin->dwSamplesProcessed = 0;
......@@ -614,7 +614,7 @@ static HRESULT WINAPI Parser_OutputPin_BreakConnect(BaseOutputPin *This)
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);
......@@ -641,7 +641,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid,
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);
TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
......@@ -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)
{
Parser_OutputPin *This = (Parser_OutputPin *)iface;
Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface);
ParserImpl *parser = (ParserImpl *)This->pin.pin.pinInfo.pFilter;
/* Set the allocator to our input pin's */
......@@ -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)
{
Parser_OutputPin *This = (Parser_OutputPin *)iface;
Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface);
TRACE("()\n");
dump_AM_MEDIA_TYPE(pmt);
......
......@@ -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_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName);
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
return S_OK;
}
pOutputPin = (Parser_OutputPin *)This->Parser.ppPins[1];
pOutputPin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]);
if (SUCCEEDED(hr))
hr = IMemAllocator_GetBuffer(pin->pAlloc, &newsample, NULL, NULL, 0);
......@@ -232,7 +232,7 @@ static HRESULT WINAPI WAVEParserImpl_seek(IMediaSeeking *iface)
}
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);
TRACE("Done flushing\n");
......@@ -371,7 +371,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 = (Parser_OutputPin *)This->Parser.ppPins[1];
Parser_OutputPin *outpin = unsafe_impl_Parser_OutputPin_from_IPin(This->Parser.ppPins[1]);
if (rtSampleStop > pin->rtStop)
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