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

strmbase: More properly standardized pin implementations for NewSegment.

parent 362da026
......@@ -792,15 +792,6 @@ VfwPin_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin)
return E_NOTIMPL;
}
static HRESULT WINAPI
VfwPin_NewSegment(IPin * iface, REFERENCE_TIME tStart,
REFERENCE_TIME tStop, double dRate)
{
TRACE("(%p)->(%s, %s, %e)\n", iface, wine_dbgstr_longlong(tStart),
wine_dbgstr_longlong(tStop), dRate);
return E_UNEXPECTED;
}
static const IPinVtbl VfwPin_Vtbl =
{
VfwPin_QueryInterface,
......@@ -820,5 +811,5 @@ static const IPinVtbl VfwPin_Vtbl =
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
VfwPin_NewSegment
BasePinImpl_NewSegment
};
......@@ -779,7 +779,7 @@ static const IPinVtbl FileAsyncReaderPin_Vtbl =
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
BaseOutputPinImpl_NewSegment
BasePinImpl_NewSegment
};
/* Function called as a helper to IPin_Connect */
......
......@@ -701,7 +701,7 @@ static const IPinVtbl Parser_OutputPin_Vtbl =
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
BaseOutputPinImpl_NewSegment
BasePinImpl_NewSegment
};
static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
......
......@@ -455,7 +455,7 @@ static HRESULT WINAPI VideoRenderer_Receive(BaseInputPin* pin, IMediaSample * pS
IReferenceClock_GetTime(This->filter.pClock, &time);
trefstart = This->filter.rtStreamStart;
trefstop = (REFERENCE_TIME)((double)(tStop - tStart) / This->pInputPin->dRate) + This->filter.rtStreamStart;
trefstop = (REFERENCE_TIME)((double)(tStop - tStart) / This->pInputPin->pin.dRate) + This->filter.rtStreamStart;
delta = (LONG)((trefstart-time)/10000);
This->filter.rtStreamStart = trefstop;
This->rtLastStop = tStop;
......
......@@ -332,6 +332,19 @@ HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin,
return E_NOTIMPL; /* to tell caller that all input pins connected to all output pins */
}
HRESULT WINAPI BasePinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
BasePin *This = (BasePin *)iface;
TRACE("(%x%08x, %x%08x, %e)\n", (ULONG)(tStart >> 32), (ULONG)tStart, (ULONG)(tStop >> 32), (ULONG)tStop, dRate);
This->tStart = tStart;
This->tStop = tStop;
This->dRate = dRate;
return S_OK;
}
/*** OutputPin implementation ***/
HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
......@@ -522,15 +535,6 @@ HRESULT WINAPI BaseOutputPinImpl_EndFlush(IPin * iface)
return E_UNEXPECTED;
}
HRESULT WINAPI BaseOutputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{
TRACE("(%p)->(%x%08x, %x%08x, %e)\n", iface, (ULONG)(tStart >> 32), (ULONG)tStart, (ULONG)(tStop >> 32), (ULONG)tStop, dRate);
/* not supposed to do anything in an output pin */
return E_UNEXPECTED;
}
static const IPinVtbl OutputPin_Vtbl =
{
BaseOutputPinImpl_QueryInterface,
......@@ -550,7 +554,7 @@ static const IPinVtbl OutputPin_Vtbl =
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
BaseOutputPinImpl_NewSegment
BasePinImpl_NewSegment
};
HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(BaseOutputPin *This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags)
......@@ -813,6 +817,9 @@ static HRESULT OutputPin_Init(const IPinVtbl *OutputPin_Vtbl, const PIN_INFO * p
pPinImpl->pin.refCount = 1;
pPinImpl->pin.pConnectedTo = NULL;
pPinImpl->pin.pCritSec = pCritSec;
pPinImpl->pin.tStart = 0;
pPinImpl->pin.tStop = 0;
pPinImpl->pin.dRate = 1.0;
Copy_PinInfo(&pPinImpl->pin.pinInfo, pPinInfo);
pPinImpl->pin.pFuncsTable = pBaseFuncsTable;
ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
......@@ -1048,9 +1055,9 @@ HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart,
TRACE("(%x%08x, %x%08x, %e)\n", (ULONG)(tStart >> 32), (ULONG)tStart, (ULONG)(tStop >> 32), (ULONG)tStop, dRate);
args.tStart = This->tStart = tStart;
args.tStop = This->tStop = tStop;
args.rate = This->dRate = dRate;
args.tStart = This->pin.tStart = tStart;
args.tStop = This->pin.tStop = tStop;
args.rate = This->pin.dRate = dRate;
return SendFurther( iface, deliver_newsegment, &args, NULL );
}
......@@ -1218,6 +1225,9 @@ static HRESULT InputPin_Init(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPi
pPinImpl->pin.refCount = 1;
pPinImpl->pin.pConnectedTo = NULL;
pPinImpl->pin.pCritSec = pCritSec;
pPinImpl->pin.tStart = 0;
pPinImpl->pin.tStop = 0;
pPinImpl->pin.dRate = 1.0;
Copy_PinInfo(&pPinImpl->pin.pinInfo, pPinInfo);
ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
pPinImpl->pin.pFuncsTable = pBaseFuncsTable;
......@@ -1227,9 +1237,6 @@ static HRESULT InputPin_Init(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPi
pPinImpl->pAllocator = pPinImpl->preferred_allocator = allocator;
if (pPinImpl->preferred_allocator)
IMemAllocator_AddRef(pPinImpl->preferred_allocator);
pPinImpl->tStart = 0;
pPinImpl->tStop = 0;
pPinImpl->dRate = 1.0;
pPinImpl->pin.lpVtbl = InputPin_Vtbl;
pPinImpl->lpVtblMemInput = &MemInputPin_Vtbl;
pPinImpl->flushing = pPinImpl->end_of_stream = 0;
......
......@@ -545,5 +545,5 @@ static const IPinVtbl TransformFilter_OutputPin_Vtbl =
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
BaseOutputPinImpl_NewSegment
BasePinImpl_NewSegment
};
......@@ -1387,7 +1387,7 @@ static const IPinVtbl GST_OutputPin_Vtbl = {
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
BaseOutputPinImpl_NewSegment
BasePinImpl_NewSegment
};
static const BasePinFuncTable output_BaseFuncTable = {
......@@ -1580,6 +1580,7 @@ static HRESULT WINAPI GSTInPin_NewSegment(IPin *iface, REFERENCE_TIME tStart, RE
GSTInPin *pin = (GSTInPin*)iface;
GSTImpl *This = (GSTImpl*)pin->pin.pinInfo.pFilter;
BasePinImpl_NewSegment(iface, tStart, tStop, dRate);
FIXME("Propagate message on %p\n", This);
return S_OK;
}
......
......@@ -34,6 +34,9 @@ typedef struct BasePin
PIN_INFO pinInfo;
IPin * pConnectedTo;
AM_MEDIA_TYPE mtCurrent;
REFERENCE_TIME tStart;
REFERENCE_TIME tStop;
double dRate;
const struct BasePinFuncTable* pFuncsTable;
} BasePin;
......@@ -81,9 +84,6 @@ typedef struct BaseInputPin
const IMemInputPinVtbl * lpVtblMemInput;
IMemAllocator * pAllocator;
REFERENCE_TIME tStart;
REFERENCE_TIME tStop;
double dRate;
BOOL flushing, end_of_stream;
IMemAllocator *preferred_allocator;
......@@ -110,6 +110,7 @@ HRESULT WINAPI BasePinImpl_QueryId(IPin * iface, LPWSTR * Id);
HRESULT WINAPI BasePinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum);
HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin);
HRESULT WINAPI BasePinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
/* Base Output Pin */
HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
......@@ -120,7 +121,6 @@ HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_EndOfStream(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_BeginFlush(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_EndFlush(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(BaseOutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin * This, IMediaSample * pSample);
......
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