2005-11-07 17:38:48 +01:00
|
|
|
/*
|
|
|
|
* Implementation of IMediaStream Interface
|
|
|
|
*
|
2008-12-14 19:06:49 +01:00
|
|
|
* Copyright 2005, 2008 Christian Costa
|
2005-11-07 17:38:48 +01:00
|
|
|
*
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-11-07 17:38:48 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
|
|
|
|
#include "amstream_private.h"
|
|
|
|
#include "amstream.h"
|
|
|
|
|
2008-12-14 19:06:49 +01:00
|
|
|
#include "ddstream.h"
|
|
|
|
|
2005-11-07 17:38:48 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
|
|
|
|
2008-12-14 19:06:49 +01:00
|
|
|
typedef struct {
|
2011-08-16 10:11:54 +02:00
|
|
|
IDirectDrawMediaStream IDirectDrawMediaStream_iface;
|
2008-12-14 19:06:49 +01:00
|
|
|
LONG ref;
|
|
|
|
IMultiMediaStream* Parent;
|
|
|
|
MSPID PurposeId;
|
|
|
|
STREAM_TYPE StreamType;
|
|
|
|
} IDirectDrawMediaStreamImpl;
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
static inline IDirectDrawMediaStreamImpl *impl_from_IDirectDrawMediaStream(IDirectDrawMediaStream *iface)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
return CONTAINING_RECORD(iface, IDirectDrawMediaStreamImpl, IDirectDrawMediaStream_iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
}
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_QueryInterface(IDirectDrawMediaStream *iface,
|
|
|
|
REFIID riid, void **ppv)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppv);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
2011-08-16 10:24:15 +02:00
|
|
|
IsEqualGUID(riid, &IID_IMediaStream) ||
|
|
|
|
IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2010-04-05 20:30:15 +02:00
|
|
|
IUnknown_AddRef(iface);
|
2011-08-16 10:24:15 +02:00
|
|
|
*ppv = This;
|
2010-04-05 20:30:15 +02:00
|
|
|
return S_OK;
|
2005-11-07 17:38:48 +01:00
|
|
|
}
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
|
2005-11-07 17:38:48 +01:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
static ULONG WINAPI IDirectDrawMediaStreamImpl_AddRef(IDirectDrawMediaStream *iface)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
TRACE("(%p/%p)\n", iface, This);
|
|
|
|
|
|
|
|
return InterlockedIncrement(&This->ref);
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
static ULONG WINAPI IDirectDrawMediaStreamImpl_Release(IDirectDrawMediaStream *iface)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)\n", iface, This);
|
|
|
|
|
|
|
|
if (!ref)
|
2011-08-16 10:24:15 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IMediaStream methods ***/
|
2011-08-16 10:24:15 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetMultiMediaStream(IDirectDrawMediaStream *iface,
|
|
|
|
IMultiMediaStream** ppMultiMediaStream)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppMultiMediaStream);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetInformation(IDirectDrawMediaStream *iface,
|
|
|
|
MSPID *pPurposeId, STREAM_TYPE *pType)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p,%p)\n", This, iface, pPurposeId, pType);
|
|
|
|
|
|
|
|
if (pPurposeId)
|
|
|
|
*pPurposeId = This->PurposeId;
|
|
|
|
if (pType)
|
|
|
|
*pType = This->StreamType;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetSameFormat(IDirectDrawMediaStream *iface,
|
|
|
|
IMediaStream *pStreamThatHasDesiredFormat, DWORD dwFlags)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
2006-10-06 23:01:52 +02:00
|
|
|
FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, dwFlags);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_AllocateSample(IDirectDrawMediaStream *iface,
|
|
|
|
DWORD dwFlags, IStreamSample **ppSample)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
2006-10-06 23:01:52 +02:00
|
|
|
FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, dwFlags, ppSample);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_CreateSharedSample(IDirectDrawMediaStream *iface,
|
|
|
|
IStreamSample *pExistingSample, DWORD dwFlags, IStreamSample **ppSample)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
2006-10-06 23:01:52 +02:00
|
|
|
FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, pExistingSample, dwFlags, ppSample);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SendEndOfStream(IDirectDrawMediaStream *iface,
|
|
|
|
DWORD dwFlags)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
2006-10-06 23:01:52 +02:00
|
|
|
FIXME("(%p/%p)->(%x) stub!\n", This, iface, dwFlags);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:11:54 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetFormat(IDirectDrawMediaStream *iface,
|
|
|
|
DDSURFACEDESC *pDDSDCurrent, IDirectDrawPalette **ppDirectDrawPalette,
|
|
|
|
DDSURFACEDESC *pDDSDDesired, DWORD *pdwFlags)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
2011-08-16 10:11:54 +02:00
|
|
|
FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, pDDSDCurrent, ppDirectDrawPalette, pDDSDDesired,
|
|
|
|
pdwFlags);
|
2008-12-14 19:06:49 +01:00
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:11:54 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetFormat(IDirectDrawMediaStream *iface,
|
|
|
|
const DDSURFACEDESC *pDDSurfaceDesc, IDirectDrawPalette *pDirectDrawPalette)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p,%p) stub!\n", iface, pDDSurfaceDesc, pDirectDrawPalette);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:11:54 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetDirectDraw(IDirectDrawMediaStream *iface,
|
|
|
|
IDirectDraw **ppDirectDraw)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub!\n", iface, ppDirectDraw);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:11:54 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetDirectDraw(IDirectDrawMediaStream *iface,
|
|
|
|
IDirectDraw *pDirectDraw)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub!\n", iface, pDirectDraw);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:11:54 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_CreateSample(IDirectDrawMediaStream *iface,
|
|
|
|
IDirectDrawSurface *pSurface, const RECT *pRect, DWORD dwFlags,
|
|
|
|
IDirectDrawStreamSample **ppSample)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p,%p,%x,%p) stub!\n", iface, pSurface, pRect, dwFlags, ppSample);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-08-16 10:11:54 +02:00
|
|
|
static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetTimePerFrame(IDirectDrawMediaStream *iface,
|
|
|
|
STREAM_TIME *pFrameTime)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub!\n", iface, pFrameTime);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStream_Vtbl =
|
|
|
|
{
|
|
|
|
IDirectDrawMediaStreamImpl_QueryInterface,
|
2011-08-16 10:24:15 +02:00
|
|
|
IDirectDrawMediaStreamImpl_AddRef,
|
|
|
|
IDirectDrawMediaStreamImpl_Release,
|
|
|
|
IDirectDrawMediaStreamImpl_GetMultiMediaStream,
|
|
|
|
IDirectDrawMediaStreamImpl_GetInformation,
|
|
|
|
IDirectDrawMediaStreamImpl_SetSameFormat,
|
|
|
|
IDirectDrawMediaStreamImpl_AllocateSample,
|
|
|
|
IDirectDrawMediaStreamImpl_CreateSharedSample,
|
|
|
|
IDirectDrawMediaStreamImpl_SendEndOfStream,
|
2008-12-14 19:06:49 +01:00
|
|
|
IDirectDrawMediaStreamImpl_GetFormat,
|
|
|
|
IDirectDrawMediaStreamImpl_SetFormat,
|
|
|
|
IDirectDrawMediaStreamImpl_GetDirectDraw,
|
|
|
|
IDirectDrawMediaStreamImpl_SetDirectDraw,
|
|
|
|
IDirectDrawMediaStreamImpl_CreateSample,
|
|
|
|
IDirectDrawMediaStreamImpl_GetTimePerFrame
|
|
|
|
};
|
2011-08-16 10:13:31 +02:00
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
HRESULT mediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
|
2011-08-16 10:13:31 +02:00
|
|
|
STREAM_TYPE StreamType, IMediaStream **ppMediaStream)
|
|
|
|
{
|
|
|
|
IDirectDrawMediaStreamImpl *object;
|
|
|
|
|
|
|
|
TRACE("(%p,%s,%p)\n", Parent, debugstr_guid(pPurposeId), ppMediaStream);
|
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawMediaStreamImpl));
|
2011-08-16 10:13:31 +02:00
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Out of memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStream_Vtbl;
|
|
|
|
object->ref = 1;
|
|
|
|
|
|
|
|
object->Parent = Parent;
|
|
|
|
object->PurposeId = *pPurposeId;
|
|
|
|
object->StreamType = StreamType;
|
|
|
|
|
|
|
|
*ppMediaStream = (IMediaStream*)&object->IDirectDrawMediaStream_iface;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|