Aric Stewart : strmbase: More properly standardized pin implementations for NewSegment.

Alexandre Julliard julliard at winehq.org
Mon Nov 1 11:54:39 CDT 2010


Module: wine
Branch: master
Commit: 7e8751b2e1e9cc6faa0bca527063f17a7de5f33e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7e8751b2e1e9cc6faa0bca527063f17a7de5f33e

Author: Aric Stewart <aric at codeweavers.com>
Date:   Mon Nov  1 07:42:14 2010 -0500

strmbase: More properly standardized pin implementations for NewSegment.

---

 dlls/qcap/vfwcapture.c        |   11 +----------
 dlls/quartz/filesource.c      |    2 +-
 dlls/quartz/parser.c          |    2 +-
 dlls/quartz/videorenderer.c   |    2 +-
 dlls/strmbase/pin.c           |   39 +++++++++++++++++++++++----------------
 dlls/strmbase/transform.c     |    2 +-
 dlls/winegstreamer/gstdemux.c |    3 ++-
 include/wine/strmbase.h       |    8 ++++----
 8 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c
index 93542f4..387a05e 100644
--- a/dlls/qcap/vfwcapture.c
+++ b/dlls/qcap/vfwcapture.c
@@ -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
 };
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c
index a05f605..2f91849 100644
--- a/dlls/quartz/filesource.c
+++ b/dlls/quartz/filesource.c
@@ -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 */
diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c
index 1a2e7b3..f60bd23 100644
--- a/dlls/quartz/parser.c
+++ b/dlls/quartz/parser.c
@@ -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)
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c
index b309b1c..11e6099 100644
--- a/dlls/quartz/videorenderer.c
+++ b/dlls/quartz/videorenderer.c
@@ -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;
diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c
index d985d6d..1b0b48c 100644
--- a/dlls/strmbase/pin.c
+++ b/dlls/strmbase/pin.c
@@ -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;
diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c
index 7a4cb84..e17620c 100644
--- a/dlls/strmbase/transform.c
+++ b/dlls/strmbase/transform.c
@@ -545,5 +545,5 @@ static const IPinVtbl TransformFilter_OutputPin_Vtbl =
     BaseOutputPinImpl_EndOfStream,
     BaseOutputPinImpl_BeginFlush,
     BaseOutputPinImpl_EndFlush,
-    BaseOutputPinImpl_NewSegment
+    BasePinImpl_NewSegment
 };
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 45a3c4e..84d9dad 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -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;
 }
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index 07913fe..21b6dfc 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -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);




More information about the wine-cvs mailing list