Maarten Lankhorst : quartz: Implement seeking stubs for transform filters.

Alexandre Julliard julliard at winehq.org
Wed Apr 2 06:55:22 CDT 2008


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

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Tue Apr  1 13:41:25 2008 -0700

quartz: Implement seeking stubs for transform filters.

---

 dlls/quartz/acmwrapper.c      |    2 +-
 dlls/quartz/avidec.c          |    2 +-
 dlls/quartz/control_private.h |    5 ++
 dlls/quartz/transform.c       |   89 +++++++++++++++++++++++++++++++++++++++-
 dlls/quartz/transform.h       |    5 ++-
 5 files changed, 97 insertions(+), 6 deletions(-)

diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c
index d34fcc6..ffe14c9 100644
--- a/dlls/quartz/acmwrapper.c
+++ b/dlls/quartz/acmwrapper.c
@@ -261,7 +261,7 @@ HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
 
     This->reinit_codec = TRUE;
 
-    hr = TransformFilter_Create(&(This->tf), &CLSID_ACMWrapper, &ACMWrapper_FuncsTable);
+    hr = TransformFilter_Create(&(This->tf), &CLSID_ACMWrapper, &ACMWrapper_FuncsTable, NULL, NULL, NULL);
 
     if (FAILED(hr))
         return hr;
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c
index 16dfe69..b8a1b19 100644
--- a/dlls/quartz/avidec.c
+++ b/dlls/quartz/avidec.c
@@ -291,7 +291,7 @@ HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
     This->pBihIn = NULL;
     This->pBihOut = NULL;
 
-    hr = TransformFilter_Create(&(This->tf), &CLSID_AVIDec, &AVIDec_FuncsTable);
+    hr = TransformFilter_Create(&(This->tf), &CLSID_AVIDec, &AVIDec_FuncsTable, NULL, NULL, NULL);
 
     if (FAILED(hr))
         return hr;
diff --git a/dlls/quartz/control_private.h b/dlls/quartz/control_private.h
index 15855d6..b5e3997 100644
--- a/dlls/quartz/control_private.h
+++ b/dlls/quartz/control_private.h
@@ -18,6 +18,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#ifndef QUARTZ_CONTROL_H
+#define QUARTZ_CONTROL_H
+
 typedef HRESULT (* CHANGEPROC)(IBaseFilter *pUserData);
 
 typedef struct MediaSeekingImpl
@@ -55,3 +58,5 @@ HRESULT WINAPI MediaSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG * p
 HRESULT WINAPI MediaSeekingImpl_SetRate(IMediaSeeking * iface, double dRate);
 HRESULT WINAPI MediaSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate);
 HRESULT WINAPI MediaSeekingImpl_GetPreroll(IMediaSeeking * iface, LONGLONG * pPreroll);
+
+#endif /*QUARTZ_CONTROL_H*/
diff --git a/dlls/quartz/transform.c b/dlls/quartz/transform.c
index ccbca58..acf9352 100644
--- a/dlls/quartz/transform.c
+++ b/dlls/quartz/transform.c
@@ -143,7 +143,76 @@ static HRESULT TransformFilter_OutputPin_Construct(const PIN_INFO * pPinInfo, co
     return E_FAIL;
 }
 
-HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSID* pClsid, const TransformFuncsTable* pFuncsTable)
+
+static inline TransformFilterImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
+{
+    return (TransformFilterImpl *)((char*)iface - FIELD_OFFSET(TransformFilterImpl, mediaSeeking.lpVtbl));
+}
+
+static HRESULT WINAPI TransformFilter_Seeking_QueryInterface(IMediaSeeking * iface, REFIID riid, LPVOID * ppv)
+{
+    TransformFilterImpl *This = impl_from_IMediaSeeking(iface);
+
+    return IUnknown_QueryInterface((IUnknown *)This, riid, ppv);
+}
+
+static ULONG WINAPI TransformFilter_Seeking_AddRef(IMediaSeeking * iface)
+{
+    TransformFilterImpl *This = impl_from_IMediaSeeking(iface);
+
+    return IUnknown_AddRef((IUnknown *)This);
+}
+
+static ULONG WINAPI TransformFilter_Seeking_Release(IMediaSeeking * iface)
+{
+    TransformFilterImpl *This = impl_from_IMediaSeeking(iface);
+
+    return IUnknown_Release((IUnknown *)This);
+}
+
+static const IMediaSeekingVtbl TransformFilter_Seeking_Vtbl =
+{
+    TransformFilter_Seeking_QueryInterface,
+    TransformFilter_Seeking_AddRef,
+    TransformFilter_Seeking_Release,
+    MediaSeekingImpl_GetCapabilities,
+    MediaSeekingImpl_CheckCapabilities,
+    MediaSeekingImpl_IsFormatSupported,
+    MediaSeekingImpl_QueryPreferredFormat,
+    MediaSeekingImpl_GetTimeFormat,
+    MediaSeekingImpl_IsUsingTimeFormat,
+    MediaSeekingImpl_SetTimeFormat,
+    MediaSeekingImpl_GetDuration,
+    MediaSeekingImpl_GetStopPosition,
+    MediaSeekingImpl_GetCurrentPosition,
+    MediaSeekingImpl_ConvertTimeFormat,
+    MediaSeekingImpl_SetPositions,
+    MediaSeekingImpl_GetPositions,
+    MediaSeekingImpl_GetAvailable,
+    MediaSeekingImpl_SetRate,
+    MediaSeekingImpl_GetRate,
+    MediaSeekingImpl_GetPreroll
+};
+
+static HRESULT TransformFilter_ChangeCurrent(IBaseFilter *iface)
+{
+    FIXME("(%p) filter hasn't implemented current position change!\n", iface);
+    return S_OK;
+}
+
+static HRESULT TransformFilter_ChangeStop(IBaseFilter *iface)
+{
+    FIXME("(%p) filter hasn't implemented stop position change!\n", iface);
+    return S_OK;
+}
+
+static HRESULT TransformFilter_ChangeRate(IBaseFilter *iface)
+{
+    FIXME("(%p) filter hasn't implemented rate change!\n", iface);
+    return S_OK;
+}
+
+HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSID* pClsid, const TransformFuncsTable* pFuncsTable, CHANGEPROC stop, CHANGEPROC current, CHANGEPROC rate)
 {
     HRESULT hr;
     PIN_INFO piInput;
@@ -184,8 +253,20 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
 
         hr = TransformFilter_OutputPin_Construct(&piOutput, &props, pTransformFilter, TransformFilter_Output_QueryAccept, &pTransformFilter->csFilter, &pTransformFilter->ppPins[1]);
 
-	if (FAILED(hr))
-	    ERR("Cannot create output pin (%x)\n", hr);
+        if (FAILED(hr))
+            ERR("Cannot create output pin (%x)\n", hr);
+        else
+        {
+            if (!stop)
+                stop = TransformFilter_ChangeStop;
+            if (!current)
+                current = TransformFilter_ChangeCurrent;
+            if (!rate)
+                rate = TransformFilter_ChangeRate;
+
+            MediaSeekingImpl_Init((IBaseFilter*)pTransformFilter, stop, current, rate, &pTransformFilter->mediaSeeking, &pTransformFilter->csFilter);
+            pTransformFilter->mediaSeeking.lpVtbl = &TransformFilter_Seeking_Vtbl;
+        }
     }
     else
     {
@@ -213,6 +294,8 @@ static HRESULT WINAPI TransformFilter_QueryInterface(IBaseFilter * iface, REFIID
         *ppv = (LPVOID)This;
     else if (IsEqualIID(riid, &IID_IBaseFilter))
         *ppv = (LPVOID)This;
+    else if (IsEqualIID(riid, &IID_IMediaSeeking))
+        *ppv = &This->mediaSeeking;
 
     if (*ppv)
     {
diff --git a/dlls/quartz/transform.h b/dlls/quartz/transform.h
index 209225e..89d7dfb 100644
--- a/dlls/quartz/transform.h
+++ b/dlls/quartz/transform.h
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#include "control_private.h"
+
 typedef struct TransformFilterImpl TransformFilterImpl;
 
 typedef struct TransformFuncsTable {
@@ -40,10 +42,11 @@ struct TransformFilterImpl
     IReferenceClock * pClock;
     FILTER_INFO filterInfo;
     CLSID clsid;
+    struct MediaSeekingImpl mediaSeeking;
 
     IPin ** ppPins;
 
     const TransformFuncsTable * pFuncsTable;
 };
 
-HRESULT TransformFilter_Create(TransformFilterImpl*, const CLSID*, const TransformFuncsTable* pFuncsTable);
+HRESULT TransformFilter_Create(TransformFilterImpl*, const CLSID*, const TransformFuncsTable* pFuncsTable, CHANGEPROC stop, CHANGEPROC current, CHANGEPROC rate);




More information about the wine-cvs mailing list