[AMSTREAM]
authorChristoph von Wittich <christoph_vw@reactos.org>
Sat, 6 Mar 2010 12:23:59 +0000 (12:23 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sat, 6 Mar 2010 12:23:59 +0000 (12:23 +0000)
sync amstream to wine 1.1.40

svn path=/trunk/; revision=45925

reactos/dll/directx/amstream/amstream.c
reactos/dll/directx/amstream/mediastream.c
reactos/dll/directx/amstream/mediastreamfilter.c
reactos/dll/directx/amstream/regsvr.c

index 9e4d45a..f8ae2a6 100644 (file)
@@ -35,7 +35,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(amstream);
 
 typedef struct {
-    IAMMultiMediaStream lpVtbl;
+    const IAMMultiMediaStreamVtbl *lpVtbl;
     LONG ref;
     IGraphBuilder* pFilterGraph;
     IPin* ipin;
@@ -63,7 +63,7 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj)
         return E_OUTOFMEMORY;
     }
 
-    object->lpVtbl.lpVtbl = &AM_Vtbl;
+    object->lpVtbl = &AM_Vtbl;
     object->ref = 1;
 
     *ppObj = object;
@@ -129,7 +129,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream
     MSPID PurposeId;
     unsigned int i;
 
-    TRACE("(%p/%p)->(%p,%p)\n", This, iface, idPurpose, ppMediaStream);
+    TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(idPurpose), ppMediaStream);
 
     for (i = 0; i < This->nbStreams; i++)
     {
@@ -214,7 +214,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* if
     IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
     HRESULT hr = S_OK;
 
-    FIXME("(%p/%p)->(%x,%x,%p) partial stub!\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph);
+    TRACE("(%p/%p)->(%x,%x,%p)\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph);
 
     if (pFilterGraph)
     {
@@ -238,9 +238,17 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream
 {
     IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
 
-    FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppGraphBuilder);
+    TRACE("(%p/%p)->(%p)\n", This, iface, ppGraphBuilder);
 
-    return E_NOTIMPL;
+    if (!ppGraphBuilder)
+        return E_POINTER;
+
+    if (This->pFilterGraph)
+        return IFilterGraph_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder, (void**)ppGraphBuilder);
+    else
+        *ppGraphBuilder = NULL;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter)
@@ -260,7 +268,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
     IMediaStream* pStream;
     IMediaStream** pNewStreams;
 
-    FIXME("(%p/%p)->(%p,%p,%x,%p) partial stub!\n", This, iface, pStreamObject, PurposeId, dwFlags, ppNewStream);
+    FIXME("(%p/%p)->(%p,%s,%x,%p) partial stub!\n", This, iface, pStreamObject, debugstr_guid(PurposeId), dwFlags, ppNewStream);
 
     if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
         hr = DirectDrawMediaStream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
@@ -341,6 +349,14 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* ifac
         goto end;
     }
 
+    /* If Initialize was not called before, we do it here */
+    if (!This->pFilterGraph)
+    {
+        ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL);
+        if (FAILED(ret))
+            goto end;
+    }
+
     ret = IFilterGraph_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder, (void**)&This->GraphBuilder);
     if(ret != S_OK)
     {
index bf197aa..dc4ec64 100644 (file)
 #include "wingdi.h"
 
 #include "amstream_private.h"
-#include "ddstream.h"
 #include "amstream.h"
 
+#include "ddstream.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(amstream);
 
 typedef struct {
-    IMediaStream lpVtbl;
+    const IMediaStreamVtbl *lpVtbl;
     LONG ref;
     IMultiMediaStream* Parent;
     MSPID PurposeId;
@@ -43,7 +44,7 @@ typedef struct {
 } IMediaStreamImpl;
 
 typedef struct {
-    IDirectDrawMediaStream lpVtbl;
+    const IDirectDrawMediaStreamVtbl *lpVtbl;
     LONG ref;
     IMultiMediaStream* Parent;
     MSPID PurposeId;
@@ -57,7 +58,7 @@ HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, S
 {
     IMediaStreamImpl* object; 
 
-    TRACE("(%p,%p,%p)\n", Parent, pPurposeId, ppMediaStream);
+    TRACE("(%p,%s,%p)\n", Parent, debugstr_guid(pPurposeId), ppMediaStream);
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamImpl));
     if (!object)
@@ -66,7 +67,7 @@ HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, S
         return E_OUTOFMEMORY;
     }
 
-    object->lpVtbl.lpVtbl = &MediaStream_Vtbl;
+    object->lpVtbl = &MediaStream_Vtbl;
     object->ref = 1;
 
     object->Parent = Parent;
@@ -197,7 +198,7 @@ HRESULT DirectDrawMediaStream_create(IMultiMediaStream* Parent, const MSPID* pPu
 {
     IDirectDrawMediaStreamImpl* object;
 
-    TRACE("(%p,%p,%p)\n", Parent, pPurposeId, ppMediaStream);
+    TRACE("(%p,%s,%p)\n", Parent, debugstr_guid(pPurposeId), ppMediaStream);
 
     object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamImpl));
     if (!object)
@@ -206,7 +207,7 @@ HRESULT DirectDrawMediaStream_create(IMultiMediaStream* Parent, const MSPID* pPu
         return E_OUTOFMEMORY;
     }
 
-    object->lpVtbl.lpVtbl = &DirectDrawMediaStream_Vtbl;
+    object->lpVtbl = &DirectDrawMediaStream_Vtbl;
     object->ref = 1;
 
     object->Parent = Parent;
index af335fd..4a4d712 100644 (file)
@@ -36,7 +36,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(amstream);
 
 typedef struct {
-    IMediaStreamFilter lpVtbl;
+    const IMediaStreamFilterVtbl *lpVtbl;
     LONG ref;
     CRITICAL_SECTION csFilter;
     FILTER_STATE state;
@@ -63,7 +63,7 @@ HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj)
         return E_OUTOFMEMORY;
     }
 
-    object->lpVtbl.lpVtbl = &MediaStreamFilter_Vtbl;
+    object->lpVtbl = &MediaStreamFilter_Vtbl;
     object->ref = 1;
 
     *ppObj = object;
@@ -120,7 +120,7 @@ static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter * iface)
 
     if (!refCount)
     {
-        This->lpVtbl.lpVtbl = NULL;
+        This->lpVtbl = NULL;
         HeapFree(GetProcessHeap(), 0, This);
     }
 
index 028c68d..9c32891 100644 (file)
@@ -456,6 +456,13 @@ static struct regsvr_coclass const coclass_list[] = {
        "Both"
     },
 
+    {   &CLSID_MediaStreamFilter,
+       "SFilter Class",
+       NULL,
+       "amstream.dll",
+       "Both"
+    },
+
     { NULL }                   /* list terminator */
 };