[QEDIT]
authorChristoph von Wittich <christoph_vw@reactos.org>
Sat, 6 Feb 2010 21:46:26 +0000 (21:46 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sat, 6 Feb 2010 21:46:26 +0000 (21:46 +0000)
sync qedit to wine 1.1.38

svn path=/trunk/; revision=45472

reactos/dll/directx/qedit/main.c
reactos/dll/directx/qedit/mediadet.c
reactos/dll/directx/qedit/qedit.rbuild
reactos/dll/directx/qedit/qedit_private.h
reactos/dll/directx/qedit/regsvr.c
reactos/dll/directx/qedit/samplegrabber.c [new file with mode: 0644]
reactos/include/dxsdk/qedit.idl
reactos/include/dxsdk/uuids.h

index df00137..ede377f 100644 (file)
@@ -53,6 +53,7 @@ struct object_creation_info
 static const struct object_creation_info object_creation[] =
 {
     { &CLSID_MediaDet, MediaDet_create },
 static const struct object_creation_info object_creation[] =
 {
     { &CLSID_MediaDet, MediaDet_create },
+    { &CLSID_SampleGrabber, SampleGrabber_create },
 };
 
 static HRESULT WINAPI
 };
 
 static HRESULT WINAPI
index 2cf37f9..3a13f71 100644 (file)
@@ -112,7 +112,7 @@ static HRESULT WINAPI MediaDet_put_Filter(IMediaDet* iface, IUnknown *newVal)
     return E_NOTIMPL;
 }
 
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet* iface, long *pVal)
+static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet* iface, LONG *pVal)
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
     IEnumPins *pins;
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
     IEnumPins *pins;
@@ -156,7 +156,7 @@ static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet* iface, long *pVal)
     return S_OK;
 }
 
     return S_OK;
 }
 
-static HRESULT WINAPI MediaDet_get_CurrentStream(IMediaDet* iface, long *pVal)
+static HRESULT WINAPI MediaDet_get_CurrentStream(IMediaDet* iface, LONG *pVal)
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
     TRACE("(%p)\n", This);
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
     TRACE("(%p)\n", This);
@@ -209,16 +209,16 @@ static HRESULT SetCurPin(MediaDetImpl *This, long strm)
     return S_OK;
 }
 
     return S_OK;
 }
 
-static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet* iface, long newVal)
+static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet* iface, LONG newVal)
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
     HRESULT hr;
 
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
     HRESULT hr;
 
-    TRACE("(%p)->(%ld)\n", This, newVal);
+    TRACE("(%p)->(%d)\n", This, newVal);
 
     if (This->num_streams == -1)
     {
 
     if (This->num_streams == -1)
     {
-        long n;
+        LONG n;
         hr = MediaDet_get_OutputStreams(iface, &n);
         if (FAILED(hr))
             return hr;
         hr = MediaDet_get_OutputStreams(iface, &n);
         if (FAILED(hr))
             return hr;
@@ -310,7 +310,11 @@ static HRESULT GetFilterInfo(IMoniker *pMoniker, GUID *pclsid, VARIANT *pvar)
         hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
 
     if (SUCCEEDED(hr))
         hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
 
     if (SUCCEEDED(hr))
+    {
         hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid);
         hr = CLSIDFromString(V_UNION(pvar, bstrVal), pclsid);
+        VariantClear(pvar);
+        V_VT(pvar) = VT_BSTR;
+    }
 
     if (SUCCEEDED(hr))
         hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
 
     if (SUCCEEDED(hr))
         hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
@@ -387,10 +391,14 @@ static HRESULT GetSplitter(MediaDetImpl *This)
     hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER,
                           &IID_IBaseFilter, (void **) &splitter);
     if (FAILED(hr))
     hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER,
                           &IID_IBaseFilter, (void **) &splitter);
     if (FAILED(hr))
+    {
+        VariantClear(&var);
         return hr;
         return hr;
+    }
 
     hr = IGraphBuilder_AddFilter(This->graph, splitter,
                                  V_UNION(&var, bstrVal));
 
     hr = IGraphBuilder_AddFilter(This->graph, splitter,
                                  V_UNION(&var, bstrVal));
+    VariantClear(&var);
     if (FAILED(hr))
     {
         IBaseFilter_Release(splitter);
     if (FAILED(hr))
     {
         IBaseFilter_Release(splitter);
@@ -461,21 +469,21 @@ static HRESULT WINAPI MediaDet_put_Filename(IMediaDet* iface, BSTR newVal)
 
 static HRESULT WINAPI MediaDet_GetBitmapBits(IMediaDet* iface,
                                              double StreamTime,
 
 static HRESULT WINAPI MediaDet_GetBitmapBits(IMediaDet* iface,
                                              double StreamTime,
-                                             long *pBufferSize, char *pBuffer,
-                                             long Width, long Height)
+                                             LONG *pBufferSize, char *pBuffer,
+                                             LONG Width, LONG Height)
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
-    FIXME("(%p)->(%f %p %p %ld %ld): not implemented!\n", This, StreamTime, pBufferSize, pBuffer,
+    FIXME("(%p)->(%f %p %p %d %d): not implemented!\n", This, StreamTime, pBufferSize, pBuffer,
           Width, Height);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI MediaDet_WriteBitmapBits(IMediaDet* iface,
           Width, Height);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI MediaDet_WriteBitmapBits(IMediaDet* iface,
-                                               double StreamTime, long Width,
-                                               long Height, BSTR Filename)
+                                               double StreamTime, LONG Width,
+                                               LONG Height, BSTR Filename)
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
 {
     MediaDetImpl *This = (MediaDetImpl *)iface;
-    FIXME("(%p)->(%f %ld %ld %p): not implemented!\n", This, StreamTime, Width, Height, Filename);
+    FIXME("(%p)->(%f %d %d %p): not implemented!\n", This, StreamTime, Width, Height, Filename);
     return E_NOTIMPL;
 }
 
     return E_NOTIMPL;
 }
 
index 78f7a55..f3285f4 100644 (file)
@@ -8,6 +8,7 @@
        <file>main.c</file>
        <file>mediadet.c</file>
        <file>regsvr.c</file>
        <file>main.c</file>
        <file>mediadet.c</file>
        <file>regsvr.c</file>
+       <file>samplegrabber.c</file>
        <library>wine</library>
        <library>strmiids</library>
        <library>uuid</library>
        <library>wine</library>
        <library>strmiids</library>
        <library>uuid</library>
index 87bcab0..cf4747f 100644 (file)
@@ -37,5 +37,6 @@
 #include "qedit.h"
 
 HRESULT MediaDet_create(IUnknown *pUnkOuter, LPVOID *ppObj);
 #include "qedit.h"
 
 HRESULT MediaDet_create(IUnknown *pUnkOuter, LPVOID *ppObj);
+HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppObj);
 
 #endif /* __QEDIT_PRIVATE_INCLUDED__ */
 
 #endif /* __QEDIT_PRIVATE_INCLUDED__ */
index 9ff1852..d70c822 100644 (file)
@@ -294,6 +294,12 @@ static struct regsvr_coclass const coclass_list[] = {
         "qedit.dll",
         "Both"
     },
         "qedit.dll",
         "Both"
     },
+    {   &CLSID_SampleGrabber,
+        "Sample Grabber",
+        NULL,
+        "qedit.dll",
+        "Both"
+    },
     { NULL }                    /* list terminator */
 };
 
     { NULL }                    /* list terminator */
 };
 
diff --git a/reactos/dll/directx/qedit/samplegrabber.c b/reactos/dll/directx/qedit/samplegrabber.c
new file mode 100644 (file)
index 0000000..4e80f24
--- /dev/null
@@ -0,0 +1,453 @@
+/*              DirectShow Sample Grabber object (QEDIT.DLL)
+ *
+ * Copyright 2009 Paul Chitescu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <assert.h>
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+
+#include "qedit_private.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(qedit);
+
+static WCHAR const vendor_name[] = { 'W', 'i', 'n', 'e', 0 };
+
+/* Sample Grabber filter implementation */
+typedef struct _SG_Impl {
+    const IBaseFilterVtbl* IBaseFilter_Vtbl;
+    const ISampleGrabberVtbl* ISampleGrabber_Vtbl;
+    /* TODO: IMediaPosition, IMediaSeeking, IQualityControl */
+    LONG refCount;
+    FILTER_INFO info;
+    FILTER_STATE state;
+    IMemAllocator *allocator;
+    IReferenceClock *refClock;
+} SG_Impl;
+
+/* Get the SampleGrabber implementation This pointer from various interface pointers */
+static inline SG_Impl *impl_from_IBaseFilter(IBaseFilter *iface)
+{
+    return (SG_Impl *)((char*)iface - FIELD_OFFSET(SG_Impl, IBaseFilter_Vtbl));
+}
+
+static inline SG_Impl *impl_from_ISampleGrabber(ISampleGrabber *iface)
+{
+    return (SG_Impl *)((char*)iface - FIELD_OFFSET(SG_Impl, ISampleGrabber_Vtbl));
+}
+
+
+/* Cleanup at end of life */
+static void SampleGrabber_cleanup(SG_Impl *This)
+{
+    TRACE("(%p)\n", This);
+    if (This->info.pGraph)
+       WARN("(%p) still joined to filter graph %p\n", This, This->info.pGraph);
+    if (This->allocator)
+        IMemAllocator_Release(This->allocator);
+    if (This->refClock)
+       IReferenceClock_Release(This->refClock);
+}
+
+/* Common helper AddRef called from all interfaces */
+static ULONG SampleGrabber_addref(SG_Impl *This)
+{
+    ULONG refCount = InterlockedIncrement(&This->refCount);
+    TRACE("(%p) new ref = %u\n", This, refCount);
+    return refCount;
+}
+
+/* Common helper Release called from all interfaces */
+static ULONG SampleGrabber_release(SG_Impl *This)
+{
+    ULONG refCount = InterlockedDecrement(&This->refCount);
+    TRACE("(%p) new ref = %u\n", This, refCount);
+    if (refCount == 0)
+    {
+        SampleGrabber_cleanup(This);
+        CoTaskMemFree(This);
+        return 0;
+    }
+    return refCount;
+}
+
+/* Common helper QueryInterface called from all interfaces */
+static HRESULT SampleGrabber_query(SG_Impl *This, REFIID riid, void **ppvObject)
+{
+    TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
+
+    if (IsEqualIID(riid, &IID_IUnknown) ||
+        IsEqualIID(riid, &IID_IPersist) ||
+        IsEqualIID(riid, &IID_IMediaFilter) ||
+        IsEqualIID(riid, &IID_IBaseFilter)) {
+        SampleGrabber_addref(This);
+        *ppvObject = &(This->IBaseFilter_Vtbl);
+        return S_OK;
+    }
+    else if (IsEqualIID(riid, &IID_ISampleGrabber)) {
+        SampleGrabber_addref(This);
+        *ppvObject = &(This->ISampleGrabber_Vtbl);
+        return S_OK;
+    }
+    else if (IsEqualIID(riid, &IID_IMemInputPin))
+        FIXME("IMemInputPin not implemented\n");
+    else if (IsEqualIID(riid, &IID_IMediaPosition))
+        FIXME("IMediaPosition not implemented\n");
+    else if (IsEqualIID(riid, &IID_IMediaSeeking))
+        FIXME("IMediaSeeking not implemented\n");
+    else if (IsEqualIID(riid, &IID_IQualityControl))
+        FIXME("IQualityControl not implemented\n");
+    *ppvObject = NULL;
+    WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppvObject);
+    return E_NOINTERFACE;
+}
+
+
+/* SampleGrabber implementation of IBaseFilter interface */
+
+/* IUnknown */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_QueryInterface(IBaseFilter *iface, REFIID riid, void **ppvObject)
+{
+    return SampleGrabber_query(impl_from_IBaseFilter(iface), riid, ppvObject);
+}
+
+/* IUnknown */
+static ULONG WINAPI
+SampleGrabber_IBaseFilter_AddRef(IBaseFilter *iface)
+{
+    return SampleGrabber_addref(impl_from_IBaseFilter(iface));
+}
+
+/* IUnknown */
+static ULONG WINAPI
+SampleGrabber_IBaseFilter_Release(IBaseFilter *iface)
+{
+    return SampleGrabber_release(impl_from_IBaseFilter(iface));
+}
+
+/* IPersist */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_GetClassID(IBaseFilter *iface, CLSID *pClassID)
+{
+    TRACE("(%p)\n", pClassID);
+    if (!pClassID)
+        return E_POINTER;
+    *pClassID = CLSID_SampleGrabber;
+    return S_OK;
+}
+
+/* IMediaFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_Stop(IBaseFilter *iface)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    TRACE("(%p)\n", This);
+    This->state = State_Stopped;
+    return S_OK;
+}
+
+/* IMediaFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_Pause(IBaseFilter *iface)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    TRACE("(%p)\n", This);
+    This->state = State_Paused;
+    return S_OK;
+}
+
+/* IMediaFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    TRACE("(%p)\n", This);
+    This->state = State_Running;
+    return S_OK;
+}
+
+/* IMediaFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_GetState(IBaseFilter *iface, DWORD msTout, FILTER_STATE *state)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    TRACE("(%p)->(%u, %p)\n", This, msTout, state);
+    if (!state)
+        return E_POINTER;
+    *state = This->state;
+    return S_OK;
+}
+
+/* IMediaFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    TRACE("(%p)->(%p)\n", This, clock);
+    if (clock != This->refClock)
+    {
+       if (clock)
+           IReferenceClock_AddRef(clock);
+       if (This->refClock)
+           IReferenceClock_Release(This->refClock);
+       This->refClock = clock;
+    }
+    return S_OK;
+}
+
+/* IMediaFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_GetSyncSource(IBaseFilter *iface, IReferenceClock **clock)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    TRACE("(%p)->(%p)\n", This, clock);
+    if (!clock)
+        return E_POINTER;
+    if (This->refClock)
+       IReferenceClock_AddRef(This->refClock);
+    *clock = This->refClock;
+    return S_OK;
+}
+
+/* IBaseFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_EnumPins(IBaseFilter *iface, IEnumPins **pins)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    FIXME("(%p)->(%p): stub\n", This, pins);
+    if (!pins)
+        return E_POINTER;
+    return E_OUTOFMEMORY;
+}
+
+/* IBaseFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_FindPin(IBaseFilter *iface, LPCWSTR id, IPin **pin)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    FIXME("(%p)->(%s, %p): stub\n", This, debugstr_w(id), pin);
+    if (!id || !pin)
+        return E_POINTER;
+    *pin = NULL;
+    return VFW_E_NOT_FOUND;
+}
+
+/* IBaseFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *info)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    TRACE("(%p)->(%p)\n", This, info);
+    if (!info)
+        return E_POINTER;
+    if (This->info.pGraph)
+       IFilterGraph_AddRef(This->info.pGraph);
+    *info = This->info;
+    return S_OK;
+}
+
+/* IBaseFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *graph, LPCWSTR name)
+{
+    SG_Impl *This = impl_from_IBaseFilter(iface);
+    TRACE("(%p)->(%p, %s)\n", This, graph, debugstr_w(name));
+    This->info.pGraph = graph;
+    if (name)
+       lstrcpynW(This->info.achName,name,MAX_FILTER_NAME);
+    return S_OK;
+}
+
+/* IBaseFilter */
+static HRESULT WINAPI
+SampleGrabber_IBaseFilter_QueryVendorInfo(IBaseFilter *iface, LPWSTR *vendor)
+{
+    TRACE("(%p)\n", vendor);
+    if (!vendor)
+        return E_POINTER;
+    *vendor = CoTaskMemAlloc(sizeof(vendor_name));
+    CopyMemory(*vendor, vendor_name, sizeof(vendor_name));
+    return S_OK;
+}
+
+
+/* SampleGrabber implementation of ISampleGrabber interface */
+
+/* IUnknown */
+static HRESULT WINAPI
+SampleGrabber_ISampleGrabber_QueryInterface(ISampleGrabber *iface, REFIID riid, void **ppvObject)
+{
+    return SampleGrabber_query(impl_from_ISampleGrabber(iface), riid, ppvObject);
+}
+
+/* IUnknown */
+static ULONG WINAPI
+SampleGrabber_ISampleGrabber_AddRef(ISampleGrabber *iface)
+{
+    return SampleGrabber_addref(impl_from_ISampleGrabber(iface));
+}
+
+/* IUnknown */
+static ULONG WINAPI
+SampleGrabber_ISampleGrabber_Release(ISampleGrabber *iface)
+{
+    return SampleGrabber_release(impl_from_ISampleGrabber(iface));
+}
+
+/* ISampleGrabber */
+static HRESULT WINAPI
+SampleGrabber_ISampleGrabber_SetOneShot(ISampleGrabber *iface, BOOL oneShot)
+{
+    SG_Impl *This = impl_from_ISampleGrabber(iface);
+    FIXME("(%p)->(%u): stub\n", This, oneShot);
+    return E_NOTIMPL;
+}
+
+/* ISampleGrabber */
+static HRESULT WINAPI
+SampleGrabber_ISampleGrabber_SetMediaType(ISampleGrabber *iface, const AM_MEDIA_TYPE *type)
+{
+    SG_Impl *This = impl_from_ISampleGrabber(iface);
+    FIXME("(%p)->(%p): stub\n", This, type);
+    if (!type)
+        return E_POINTER;
+    return E_NOTIMPL;
+}
+
+/* ISampleGrabber */
+static HRESULT WINAPI
+SampleGrabber_ISampleGrabber_GetConnectedMediaType(ISampleGrabber *iface, AM_MEDIA_TYPE *type)
+{
+    SG_Impl *This = impl_from_ISampleGrabber(iface);
+    FIXME("(%p)->(%p): stub\n", This, type);
+    if (!type)
+        return E_POINTER;
+    return E_NOTIMPL;
+}
+
+/* ISampleGrabber */
+static HRESULT WINAPI
+SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL bufferEm)
+{
+    TRACE("(%u)\n", bufferEm);
+    if (bufferEm) {
+        FIXME("buffering not implemented\n");
+        return E_NOTIMPL;
+    }
+    return S_OK;
+}
+
+/* ISampleGrabber */
+static HRESULT WINAPI
+SampleGrabber_ISampleGrabber_GetCurrentBuffer(ISampleGrabber *iface, LONG *bufSize, LONG *buffer)
+{
+    FIXME("(%p, %p): stub\n", bufSize, buffer);
+    if (!bufSize)
+        return E_POINTER;
+    return E_INVALIDARG;
+}
+
+/* ISampleGrabber */
+static HRESULT WINAPI
+SampleGrabber_ISampleGrabber_GetCurrentSample(ISampleGrabber *iface, IMediaSample **sample)
+{
+    /* MS doesn't implement it either, noone should call it */
+    WARN("(%p): not implemented\n", sample);
+    return E_NOTIMPL;
+}
+
+/* ISampleGrabber */
+static HRESULT WINAPI
+SampleGrabber_ISampleGrabber_SetCallback(ISampleGrabber *iface, ISampleGrabberCB *cb, LONG whichMethod)
+{
+    SG_Impl *This = impl_from_ISampleGrabber(iface);
+    FIXME("(%p)->(%p, %u): stub\n", This, cb, whichMethod);
+    return E_NOTIMPL;
+}
+
+
+/* SampleGrabber vtables and constructor */
+
+static const IBaseFilterVtbl IBaseFilter_VTable =
+{
+    SampleGrabber_IBaseFilter_QueryInterface,
+    SampleGrabber_IBaseFilter_AddRef,
+    SampleGrabber_IBaseFilter_Release,
+    SampleGrabber_IBaseFilter_GetClassID,
+    SampleGrabber_IBaseFilter_Stop,
+    SampleGrabber_IBaseFilter_Pause,
+    SampleGrabber_IBaseFilter_Run,
+    SampleGrabber_IBaseFilter_GetState,
+    SampleGrabber_IBaseFilter_SetSyncSource,
+    SampleGrabber_IBaseFilter_GetSyncSource,
+    SampleGrabber_IBaseFilter_EnumPins,
+    SampleGrabber_IBaseFilter_FindPin,
+    SampleGrabber_IBaseFilter_QueryFilterInfo,
+    SampleGrabber_IBaseFilter_JoinFilterGraph,
+    SampleGrabber_IBaseFilter_QueryVendorInfo,
+};
+
+static const ISampleGrabberVtbl ISampleGrabber_VTable =
+{
+    SampleGrabber_ISampleGrabber_QueryInterface,
+    SampleGrabber_ISampleGrabber_AddRef,
+    SampleGrabber_ISampleGrabber_Release,
+    SampleGrabber_ISampleGrabber_SetOneShot,
+    SampleGrabber_ISampleGrabber_SetMediaType,
+    SampleGrabber_ISampleGrabber_GetConnectedMediaType,
+    SampleGrabber_ISampleGrabber_SetBufferSamples,
+    SampleGrabber_ISampleGrabber_GetCurrentBuffer,
+    SampleGrabber_ISampleGrabber_GetCurrentSample,
+    SampleGrabber_ISampleGrabber_SetCallback,
+};
+
+HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv)
+{
+    SG_Impl* obj = NULL;
+
+    TRACE("(%p,%p)\n", ppv, pUnkOuter);
+
+    if (pUnkOuter)
+        return CLASS_E_NOAGGREGATION;
+
+    obj = CoTaskMemAlloc(sizeof(SG_Impl));
+    if (NULL == obj) {
+        *ppv = NULL;
+        return E_OUTOFMEMORY;
+    }
+    ZeroMemory(obj, sizeof(SG_Impl));
+
+    obj->refCount = 1;
+    obj->IBaseFilter_Vtbl = &IBaseFilter_VTable;
+    obj->ISampleGrabber_Vtbl = &ISampleGrabber_VTable;
+    obj->info.achName[0] = 0;
+    obj->info.pGraph = NULL;
+    obj->state = State_Stopped;
+    obj->allocator = NULL;
+    obj->refClock = NULL;
+    *ppv = obj;
+
+    return S_OK;
+}
index 48764c1..ea1e593 100644 (file)
@@ -37,7 +37,7 @@ interface ISampleGrabberCB : IUnknown
     HRESULT BufferCB(
         double SampleTime,
         BYTE * pBuffer,
     HRESULT BufferCB(
         double SampleTime,
         BYTE * pBuffer,
-        long BufferLen
+        LONG BufferLen
     );
 }
 
     );
 }
 
@@ -66,8 +66,8 @@ interface ISampleGrabber: IUnknown
     );
 
     HRESULT GetCurrentBuffer(
     );
 
     HRESULT GetCurrentBuffer(
-        [in,out] long * pBufferSize,
-        [out] long * pBuffer
+        [in,out] LONG * pBufferSize,
+        [out] LONG * pBuffer
     );
 
     HRESULT GetCurrentSample(
     );
 
     HRESULT GetCurrentSample(
@@ -76,7 +76,7 @@ interface ISampleGrabber: IUnknown
 
     HRESULT SetCallback(
         ISampleGrabberCB * pCallback,
 
     HRESULT SetCallback(
         ISampleGrabberCB * pCallback,
-        long WhichMethodToCallback
+        LONG WhichMethodToCallback
     );
 };
 
     );
 };
 
@@ -96,15 +96,15 @@ interface IMediaDet : IUnknown
     );
 
     HRESULT get_OutputStreams(
     );
 
     HRESULT get_OutputStreams(
-        [out] long *pVal
+        [out] LONG *pVal
     );
 
     HRESULT get_CurrentStream(
     );
 
     HRESULT get_CurrentStream(
-        [out] long *pVal
+        [out] LONG *pVal
     );
 
     HRESULT put_CurrentStream(
     );
 
     HRESULT put_CurrentStream(
-        long newVal
+        LONG newVal
     );
 
     HRESULT get_StreamType(
     );
 
     HRESULT get_StreamType(
@@ -129,16 +129,16 @@ interface IMediaDet : IUnknown
 
     HRESULT GetBitmapBits(
         double StreamTime,
 
     HRESULT GetBitmapBits(
         double StreamTime,
-        long * pBufferSize,
+        LONG * pBufferSize,
         char * pBuffer,
         char * pBuffer,
-        long Width,
-        long Height
+        LONG Width,
+        LONG Height
     );
 
     HRESULT WriteBitmapBits(
         double StreamTime,
     );
 
     HRESULT WriteBitmapBits(
         double StreamTime,
-        long Width,
-        long Height,
+        LONG Width,
+        LONG Height,
         BSTR Filename
     );
 
         BSTR Filename
     );
 
index 54a30fc..376cca7 100644 (file)
@@ -135,6 +135,7 @@ OUR_GUID_ENTRY(CLSID_WAVEParser,                     0xd51bd5a1, 0x7548, 0x11cf,
 OUR_GUID_ENTRY(CLSID_QTDec,                          0xfdfe9681, 0x74a3, 0x11d0, 0xaf, 0xa7, 0x00, 0xaa, 0x00, 0xb6, 0x7a, 0x42)
 OUR_GUID_ENTRY(CLSID_AVIDoc,                         0xd3588ab0, 0x0781, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
 OUR_GUID_ENTRY(CLSID_AVIDocWriter,                   0xd3588ab1, 0x0781, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
 OUR_GUID_ENTRY(CLSID_QTDec,                          0xfdfe9681, 0x74a3, 0x11d0, 0xaf, 0xa7, 0x00, 0xaa, 0x00, 0xb6, 0x7a, 0x42)
 OUR_GUID_ENTRY(CLSID_AVIDoc,                         0xd3588ab0, 0x0781, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
 OUR_GUID_ENTRY(CLSID_AVIDocWriter,                   0xd3588ab1, 0x0781, 0x11ce, 0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
+OUR_GUID_ENTRY(CLSID_SampleGrabber,                  0xc1f400a0, 0x3f08, 0x11d3, 0x9f, 0x0b, 0x00, 0x60, 0x08, 0x03, 0x9e, 0x37)
 OUR_GUID_ENTRY(CLSID_NullRenderer,                   0xc1f400a4, 0x3f08, 0x11d3, 0x9f, 0x0b, 0x00, 0x60, 0x08, 0x03, 0x9e, 0x37)
 OUR_GUID_ENTRY(CLSID_VideoRenderer,                  0x70e102b0, 0x5556, 0x11ce, 0x97, 0xc0, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a)
 OUR_GUID_ENTRY(CLSID_VideoRendererDefault,           0x6bc1cffa, 0x8fc1, 0x4261, 0xac, 0x22, 0xcf, 0xb4, 0xcc, 0x38, 0xdb, 0x50)
 OUR_GUID_ENTRY(CLSID_NullRenderer,                   0xc1f400a4, 0x3f08, 0x11d3, 0x9f, 0x0b, 0x00, 0x60, 0x08, 0x03, 0x9e, 0x37)
 OUR_GUID_ENTRY(CLSID_VideoRenderer,                  0x70e102b0, 0x5556, 0x11ce, 0x97, 0xc0, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a)
 OUR_GUID_ENTRY(CLSID_VideoRendererDefault,           0x6bc1cffa, 0x8fc1, 0x4261, 0xac, 0x22, 0xcf, 0xb4, 0xcc, 0x38, 0xdb, 0x50)