Commit fc94be11 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

Add stub implementation of IMediaStream interface.

parent 63ad7110
...@@ -9,6 +9,7 @@ EXTRALIBS = -lstrmiids -luuid ...@@ -9,6 +9,7 @@ EXTRALIBS = -lstrmiids -luuid
C_SRCS = \ C_SRCS = \
amstream.c \ amstream.c \
main.c \ main.c \
mediastream.c \
regsvr.c regsvr.c
RC_SRCS = version.rc RC_SRCS = version.rc
......
...@@ -37,6 +37,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(amstream); ...@@ -37,6 +37,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(amstream);
typedef struct { typedef struct {
IAMMultiMediaStream lpVtbl; IAMMultiMediaStream lpVtbl;
LONG ref; LONG ref;
IGraphBuilder* pFilterGraph;
ULONG nbStreams;
IMediaStream** pStreams;
STREAM_TYPE StreamType;
} IAMMultiMediaStreamImpl; } IAMMultiMediaStreamImpl;
static const struct IAMMultiMediaStreamVtbl AM_Vtbl; static const struct IAMMultiMediaStreamVtbl AM_Vtbl;
...@@ -45,7 +49,7 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) ...@@ -45,7 +49,7 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj)
{ {
IAMMultiMediaStreamImpl* object; IAMMultiMediaStreamImpl* object;
FIXME("(%p,%p)\n", pUnkOuter, ppObj); TRACE("(%p,%p)\n", pUnkOuter, ppObj);
if( pUnkOuter ) if( pUnkOuter )
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
...@@ -115,10 +119,23 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetInformation(IAMMultiMediaStream ...@@ -115,10 +119,23 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetInformation(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream* iface, REFMSPID idPurpose, IMediaStream** ppMediaStream) static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream* iface, REFMSPID idPurpose, IMediaStream** ppMediaStream)
{ {
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
MSPID PurposeId;
int i;
FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, idPurpose, ppMediaStream); TRACE("(%p/%p)->(%p,%p)\n", This, iface, idPurpose, ppMediaStream);
return E_NOTIMPL; for (i = 0; i < This->nbStreams; i++)
{
IMediaStream_GetInformation(This->pStreams[i], &PurposeId, NULL);
if (IsEqualIID(&PurposeId, idPurpose))
{
*ppMediaStream = This->pStreams[i];
IMediaStream_AddRef(*ppMediaStream);
return S_OK;
}
}
return MS_E_NOSTREAM;
} }
static HRESULT WINAPI IAMMultiMediaStreamImpl_EnumMediaStreams(IAMMultiMediaStream* iface, long Index, IMediaStream** ppMediaStream) static HRESULT WINAPI IAMMultiMediaStreamImpl_EnumMediaStreams(IAMMultiMediaStream* iface, long Index, IMediaStream** ppMediaStream)
...@@ -188,10 +205,26 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream ...@@ -188,10 +205,26 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream
static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* iface, STREAM_TYPE StreamType, DWORD dwFlags, IGraphBuilder* pFilterGraph) static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* iface, STREAM_TYPE StreamType, DWORD dwFlags, IGraphBuilder* pFilterGraph)
{ {
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
HRESULT hr = S_OK;
FIXME("(%p/%p)->(%lx,%lx,%p) stub!\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph); FIXME("(%p/%p)->(%lx,%lx,%p) partial stub!\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph);
return E_NOTIMPL; if (pFilterGraph)
{
This->pFilterGraph = pFilterGraph;
IGraphBuilder_AddRef(This->pFilterGraph);
}
else
{
hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&This->pFilterGraph);
}
if (SUCCEEDED(hr))
{
This->StreamType = StreamType;
}
return hr;
} }
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream* iface, IGraphBuilder** ppGraphBuilder) static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream* iface, IGraphBuilder** ppGraphBuilder)
...@@ -216,17 +249,40 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream ...@@ -216,17 +249,40 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
DWORD dwFlags, IMediaStream** ppNewStream) DWORD dwFlags, IMediaStream** ppNewStream)
{ {
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
HRESULT hr;
IMediaStream* pStream;
IMediaStream** pNewStreams;
FIXME("(%p/%p)->(%p,%p,%lx,%p) stub!\n", This, iface, pStreamObject, PurposeId, dwFlags, ppNewStream); FIXME("(%p/%p)->(%p,%p,%lx,%p) partial stub!\n", This, iface, pStreamObject, PurposeId, dwFlags, ppNewStream);
return E_NOTIMPL; hr = MediaStream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
if (SUCCEEDED(hr))
{
pNewStreams = (IMediaStream**)CoTaskMemAlloc((This->nbStreams+1)*sizeof(IMediaStream*));
if (!pNewStreams)
{
IMediaStream_Release(pStream);
return E_OUTOFMEMORY;
}
if (This->nbStreams)
CopyMemory(pNewStreams, This->pStreams, This->nbStreams*sizeof(IMediaStream*));
CoTaskMemFree(This->pStreams);
This->pStreams = pNewStreams;
This->pStreams[This->nbStreams] = pStream;
This->nbStreams++;
if (ppNewStream)
*ppNewStream = pStream;
}
return hr;
} }
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR pszFileName, DWORD dwFlags) static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR pszFileName, DWORD dwFlags)
{ {
IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface;
FIXME("(%p/%p)->(%p,%lx) stub!\n", This, iface, pszFileName, dwFlags); FIXME("(%p/%p)->(%s,%lx) stub!\n", This, iface, debugstr_w(pszFileName), dwFlags);
return E_NOTIMPL; return E_NOTIMPL;
} }
......
...@@ -32,7 +32,9 @@ ...@@ -32,7 +32,9 @@
#include "wingdi.h" #include "wingdi.h"
#include "winuser.h" #include "winuser.h"
#include "dshow.h" #include "dshow.h"
#include "mmstream.h"
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj); HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj);
HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream);
#endif /* __AMSTREAM_PRIVATE_INCLUDED__ */ #endif /* __AMSTREAM_PRIVATE_INCLUDED__ */
/*
* Implementation of IMediaStream Interface
*
* Copyright 2005 Christian Costa
*
* This file contains the (internal) driver registration functions,
* driver enumeration APIs and DirectDraw creation functions.
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/debug.h"
#define COBJMACROS
#include "winbase.h"
#include "wingdi.h"
#include "amstream_private.h"
#include "amstream.h"
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
typedef struct {
IMediaStream lpVtbl;
LONG ref;
IMultiMediaStream* Parent;
MSPID PurposeId;
STREAM_TYPE StreamType;
} IMediaStreamImpl;
static struct IMediaStreamVtbl MediaStream_Vtbl;
HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream)
{
IMediaStreamImpl* object;
TRACE("(%p,%p,%p)\n", Parent, pPurposeId, ppMediaStream);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamImpl));
object->lpVtbl.lpVtbl = &MediaStream_Vtbl;
object->ref = 1;
object->Parent = Parent;
object->PurposeId = *pPurposeId;
object->StreamType = StreamType;
*ppMediaStream = (IMediaStream*)object;
return S_OK;
}
/*** IUnknown methods ***/
static HRESULT WINAPI IMediaStreamImpl_QueryInterface(IMediaStream* iface, REFIID riid, void** ppvObject)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IAMMultiMediaStream))
{
IClassFactory_AddRef(iface);
*ppvObject = This;
return S_OK;
}
ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
return E_NOINTERFACE;
}
static ULONG WINAPI IMediaStreamImpl_AddRef(IMediaStream* iface)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
TRACE("(%p/%p)\n", iface, This);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI IMediaStreamImpl_Release(IMediaStream* iface)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p/%p)\n", iface, This);
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
return ref;
}
/*** IMediaStream methods ***/
static HRESULT WINAPI IMediaStreamImpl_GetMultiMediaStream(IMediaStream* iface, IMultiMediaStream** ppMultiMediaStream)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppMultiMediaStream);
return S_FALSE;
}
static HRESULT WINAPI IMediaStreamImpl_GetInformation(IMediaStream* iface, MSPID* pPurposeId, STREAM_TYPE* pType)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
TRACE("(%p/%p)->(%p,%p)\n", This, iface, pPurposeId, pType);
if (pPurposeId)
*pPurposeId = This->PurposeId;
if (pType)
*pType = This->StreamType;
return S_OK;
}
static HRESULT WINAPI IMediaStreamImpl_SetSameFormat(IMediaStream* iface, IMediaStream* pStreamThatHasDesiredFormat, DWORD dwFlags)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
FIXME("(%p/%p)->(%p,%lx) stub!\n", This, iface, pStreamThatHasDesiredFormat, dwFlags);
return S_FALSE;
}
static HRESULT WINAPI IMediaStreamImpl_AllocateSample(IMediaStream* iface, DWORD dwFlags, IStreamSample** ppSample)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
FIXME("(%p/%p)->(%lx,%p) stub!\n", This, iface, dwFlags, ppSample);
return S_FALSE;
}
static HRESULT WINAPI IMediaStreamImpl_CreateSharedSample(IMediaStream* iface, IStreamSample* pExistingSample, DWORD dwFlags, IStreamSample** ppSample)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
FIXME("(%p/%p)->(%p,%lx,%p) stub!\n", This, iface, pExistingSample, dwFlags, ppSample);
return S_FALSE;
}
static HRESULT WINAPI IMediaStreamImpl_SendEndOfStream(IMediaStream* iface, DWORD dwFlags)
{
IMediaStreamImpl *This = (IMediaStreamImpl *)iface;
FIXME("(%p/%p)->(%lx) stub!\n", This, iface, dwFlags);
return S_FALSE;
}
static IMediaStreamVtbl MediaStream_Vtbl =
{
IMediaStreamImpl_QueryInterface,
IMediaStreamImpl_AddRef,
IMediaStreamImpl_Release,
IMediaStreamImpl_GetMultiMediaStream,
IMediaStreamImpl_GetInformation,
IMediaStreamImpl_SetSameFormat,
IMediaStreamImpl_AllocateSample,
IMediaStreamImpl_CreateSharedSample,
IMediaStreamImpl_SendEndOfStream
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment