Zebediah Figura : strmbase: Introduce callbacks for streaming events.

Alexandre Julliard julliard at winehq.org
Fri Dec 13 15:27:21 CST 2019


Module: wine
Branch: master
Commit: 57a7d6d4c7d7854bafd464d5fd2a480a7951663f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=57a7d6d4c7d7854bafd464d5fd2a480a7951663f

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Dec 12 21:24:34 2019 -0600

strmbase: Introduce callbacks for streaming events.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/strmbase/pin.c     | 42 ++++++++++++++++++++++++++++++------------
 include/wine/strmbase.h |  4 ++++
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c
index 3dd00b27cc..177d52740d 100644
--- a/dlls/strmbase/pin.c
+++ b/dlls/strmbase/pin.c
@@ -718,6 +718,9 @@ HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface)
 
     TRACE("(%p)->()\n", This);
 
+    if (This->pFuncsTable->sink_eos)
+        return This->pFuncsTable->sink_eos(This);
+
     EnterCriticalSection(&This->pin.filter->csFilter);
     if (This->flushing)
         hr = S_FALSE;
@@ -735,15 +738,21 @@ static HRESULT deliver_beginflush(IPin* pin, LPVOID unused)
 
 HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface)
 {
-    struct strmbase_sink *This = impl_sink_from_IPin(iface);
+    struct strmbase_sink *pin = impl_sink_from_IPin(iface);
     HRESULT hr;
-    TRACE("(%p) semi-stub\n", This);
 
-    EnterCriticalSection(&This->pin.filter->csFilter);
-    This->flushing = TRUE;
+    TRACE("pin %p.\n", pin);
 
-    hr = SendFurther(This, deliver_beginflush, NULL);
-    LeaveCriticalSection(&This->pin.filter->csFilter);
+    EnterCriticalSection(&pin->pin.filter->csFilter);
+
+    pin->flushing = TRUE;
+
+    if (pin->pFuncsTable->sink_begin_flush)
+        hr = pin->pFuncsTable->sink_begin_flush(pin);
+    else
+        hr = SendFurther(pin, deliver_beginflush, NULL);
+
+    LeaveCriticalSection(&pin->pin.filter->csFilter);
 
     return hr;
 }
@@ -755,15 +764,21 @@ static HRESULT deliver_endflush(IPin* pin, LPVOID unused)
 
 HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface)
 {
-    struct strmbase_sink *This = impl_sink_from_IPin(iface);
+    struct strmbase_sink *pin = impl_sink_from_IPin(iface);
     HRESULT hr;
-    TRACE("(%p)->()\n", This);
 
-    EnterCriticalSection(&This->pin.filter->csFilter);
-    This->flushing = FALSE;
+    TRACE("pin %p.\n", pin);
 
-    hr = SendFurther(This, deliver_endflush, NULL);
-    LeaveCriticalSection(&This->pin.filter->csFilter);
+    EnterCriticalSection(&pin->pin.filter->csFilter);
+
+    pin->flushing = FALSE;
+
+    if (pin->pFuncsTable->sink_end_flush)
+        hr = pin->pFuncsTable->sink_end_flush(pin);
+    else
+        hr = SendFurther(pin, deliver_endflush, NULL);
+
+    LeaveCriticalSection(&pin->pin.filter->csFilter);
 
     return hr;
 }
@@ -788,6 +803,9 @@ HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME start, R
     TRACE("iface %p, start %s, stop %s, rate %.16e.\n",
             iface, debugstr_time(start), debugstr_time(stop), rate);
 
+    if (pin->pFuncsTable->sink_new_segment)
+        return pin->pFuncsTable->sink_new_segment(pin, start, stop, rate);
+
     args.tStart = start;
     args.tStop = stop;
     args.rate = rate;
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h
index 83ad2e0bd6..c01ef6133f 100644
--- a/include/wine/strmbase.h
+++ b/include/wine/strmbase.h
@@ -95,6 +95,10 @@ struct strmbase_sink_ops
     BaseInputPin_Receive pfnReceive;
     HRESULT (*sink_connect)(struct strmbase_sink *pin, IPin *peer, const AM_MEDIA_TYPE *mt);
     void (*sink_disconnect)(struct strmbase_sink *pin);
+    HRESULT (*sink_eos)(struct strmbase_sink *pin);
+    HRESULT (*sink_begin_flush)(struct strmbase_sink *pin);
+    HRESULT (*sink_end_flush)(struct strmbase_sink *pin);
+    HRESULT (*sink_new_segment)(struct strmbase_sink *pin, REFERENCE_TIME start, REFERENCE_TIME stop, double rate);
 };
 
 /* Base Pin */




More information about the wine-cvs mailing list