2005-11-07 17:38:48 +01:00
|
|
|
/*
|
2012-04-23 21:44:28 +02:00
|
|
|
* Implementation of IMediaStream Interfaces
|
2005-11-07 17:38:48 +01:00
|
|
|
*
|
2012-04-23 21:44:28 +02:00
|
|
|
* Copyright 2005, 2008, 2012 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"
|
|
|
|
|
2008-12-14 19:06:49 +01:00
|
|
|
#include "ddstream.h"
|
|
|
|
|
2005-11-07 17:38:48 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
|
|
|
|
2015-06-22 21:39:41 +02:00
|
|
|
static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawSurface *surface,
|
|
|
|
const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample);
|
2012-04-26 07:58:14 +02:00
|
|
|
static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample);
|
2012-04-26 07:58:05 +02:00
|
|
|
|
2008-12-14 19:06:49 +01:00
|
|
|
typedef struct {
|
2012-09-23 20:43:40 +02:00
|
|
|
IAMMediaStream IAMMediaStream_iface;
|
2011-08-16 10:11:54 +02:00
|
|
|
IDirectDrawMediaStream IDirectDrawMediaStream_iface;
|
2008-12-14 19:06:49 +01:00
|
|
|
LONG ref;
|
2012-09-23 20:43:40 +02:00
|
|
|
IMultiMediaStream* parent;
|
|
|
|
MSPID purpose_id;
|
|
|
|
STREAM_TYPE stream_type;
|
2015-06-22 22:52:08 +02:00
|
|
|
IDirectDraw7 *ddraw;
|
2012-09-23 20:43:31 +02:00
|
|
|
} DirectDrawMediaStreamImpl;
|
2008-12-14 19:06:49 +01:00
|
|
|
|
2012-09-23 20:43:40 +02:00
|
|
|
static inline DirectDrawMediaStreamImpl *impl_from_DirectDrawMediaStream_IAMMediaStream(IAMMediaStream *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl, IAMMediaStream_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream *iface,
|
|
|
|
REFIID riid, void **ret_iface)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualGUID(riid, &IID_IMediaStream) ||
|
|
|
|
IsEqualGUID(riid, &IID_IAMMediaStream))
|
|
|
|
{
|
|
|
|
IAMMediaStream_AddRef(iface);
|
|
|
|
*ret_iface = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(riid, &IID_IDirectDrawMediaStream))
|
|
|
|
{
|
|
|
|
IAMMediaStream_AddRef(iface);
|
|
|
|
*ret_iface = &This->IDirectDrawMediaStream_iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
2015-06-22 22:52:08 +02:00
|
|
|
{
|
|
|
|
if (This->ddraw)
|
|
|
|
IDirectDraw7_Release(This->ddraw);
|
2012-09-23 20:43:40 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2015-06-22 22:52:08 +02:00
|
|
|
}
|
2012-09-23 20:43:40 +02:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IMediaStream methods ***/
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface,
|
|
|
|
IMultiMediaStream** multi_media_stream)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, multi_media_stream);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream *iface,
|
|
|
|
MSPID *purpose_id, STREAM_TYPE *type)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
|
|
|
|
|
|
|
|
if (purpose_id)
|
|
|
|
*purpose_id = This->purpose_id;
|
|
|
|
if (type)
|
|
|
|
*type = This->stream_type;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream *iface,
|
|
|
|
IMediaStream *pStreamThatHasDesiredFormat, DWORD flags)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, flags);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream *iface,
|
|
|
|
DWORD flags, IStreamSample **sample)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, flags, sample);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface,
|
|
|
|
IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, existing_sample, flags, sample);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD flags)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%x) stub!\n", This, iface, flags);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IAMMediaStream methods ***/
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags,
|
|
|
|
REFMSPID purpose_id, const STREAM_TYPE stream_type)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
|
|
|
|
{
|
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_DirectDrawMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IAMMediaStreamVtbl DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl =
|
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_QueryInterface,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_AddRef,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_Release,
|
|
|
|
/*** IMediaStream methods ***/
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_GetMultiMediaStream,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_GetInformation,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_SetSameFormat,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_AllocateSample,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_CreateSharedSample,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_SendEndOfStream,
|
|
|
|
/*** IAMMediaStream methods ***/
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_Initialize,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_SetState,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilter,
|
|
|
|
DirectDrawMediaStreamImpl_IAMMediaStream_JoinFilterGraph
|
|
|
|
};
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static inline DirectDrawMediaStreamImpl *impl_from_IDirectDrawMediaStream(IDirectDrawMediaStream *iface)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
return CONTAINING_RECORD(iface, DirectDrawMediaStreamImpl, IDirectDrawMediaStream_iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
}
|
|
|
|
|
2012-04-23 21:44:19 +02:00
|
|
|
/*** IUnknown methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInterface(IDirectDrawMediaStream *iface,
|
2012-09-23 20:43:40 +02:00
|
|
|
REFIID riid, void **ret_iface)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2012-09-23 20:43:40 +02:00
|
|
|
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
|
2015-06-23 09:09:08 +02:00
|
|
|
return IAMMediaStream_QueryInterface(&This->IAMMediaStream_iface, riid, ret_iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static ULONG WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AddRef(IDirectDrawMediaStream *iface)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
TRACE("(%p/%p)\n", iface, This);
|
2015-06-23 09:09:08 +02:00
|
|
|
return IAMMediaStream_AddRef(&This->IAMMediaStream_iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static ULONG WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release(IDirectDrawMediaStream *iface)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
TRACE("(%p/%p)\n", iface, This);
|
2015-06-23 09:09:08 +02:00
|
|
|
return IAMMediaStream_Release(&This->IAMMediaStream_iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IMediaStream methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiMediaStream(IDirectDrawMediaStream *iface,
|
2011-08-16 10:24:15 +02:00
|
|
|
IMultiMediaStream** ppMultiMediaStream)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *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;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInformation(IDirectDrawMediaStream *iface,
|
2012-09-23 20:43:40 +02:00
|
|
|
MSPID *purpose_id, STREAM_TYPE *type)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
2012-09-23 20:43:40 +02:00
|
|
|
TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
|
2005-11-07 17:38:48 +01:00
|
|
|
|
2012-09-23 20:43:40 +02:00
|
|
|
if (purpose_id)
|
|
|
|
*purpose_id = This->purpose_id;
|
|
|
|
if (type)
|
|
|
|
*type = This->stream_type;
|
2005-11-07 17:38:48 +01:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFormat(IDirectDrawMediaStream *iface,
|
2011-08-16 10:24:15 +02:00
|
|
|
IMediaStream *pStreamThatHasDesiredFormat, DWORD dwFlags)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *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;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateSample(IDirectDrawMediaStream *iface,
|
2011-08-16 10:24:15 +02:00
|
|
|
DWORD dwFlags, IStreamSample **ppSample)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *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;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSharedSample(IDirectDrawMediaStream *iface,
|
2011-08-16 10:24:15 +02:00
|
|
|
IStreamSample *pExistingSample, DWORD dwFlags, IStreamSample **ppSample)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *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;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream(IDirectDrawMediaStream *iface,
|
2011-08-16 10:24:15 +02:00
|
|
|
DWORD dwFlags)
|
2005-11-07 17:38:48 +01:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *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;
|
|
|
|
}
|
|
|
|
|
2012-04-23 21:44:19 +02:00
|
|
|
/*** IDirectDrawMediaStream methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat(IDirectDrawMediaStream *iface,
|
2012-05-01 10:21:20 +02:00
|
|
|
DDSURFACEDESC *current_format, IDirectDrawPalette **palette,
|
|
|
|
DDSURFACEDESC *desired_format, DWORD *flags)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
2012-05-01 10:21:20 +02:00
|
|
|
FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, current_format, palette, desired_format,
|
|
|
|
flags);
|
2008-12-14 19:06:49 +01:00
|
|
|
|
2012-05-01 10:21:20 +02:00
|
|
|
return MS_E_NOSTREAM;
|
2008-12-14 19:06:49 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat(IDirectDrawMediaStream *iface,
|
2011-08-16 10:11:54 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw(IDirectDrawMediaStream *iface,
|
2015-06-22 22:52:08 +02:00
|
|
|
IDirectDraw **ddraw)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
2015-06-22 22:52:08 +02:00
|
|
|
DirectDrawMediaStreamImpl *This = impl_from_IDirectDrawMediaStream(iface);
|
2008-12-14 19:06:49 +01:00
|
|
|
|
2015-06-22 22:52:08 +02:00
|
|
|
TRACE("(%p)->(%p)\n", iface, ddraw);
|
|
|
|
|
|
|
|
*ddraw = NULL;
|
|
|
|
if (!This->ddraw)
|
|
|
|
{
|
|
|
|
HRESULT hr = DirectDrawCreateEx(NULL, (void**)&This->ddraw, &IID_IDirectDraw7, NULL);
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
2015-06-23 22:24:46 +02:00
|
|
|
IDirectDraw7_SetCooperativeLevel(This->ddraw, NULL, DDSCL_NORMAL);
|
2015-06-22 22:52:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return IDirectDraw7_QueryInterface(This->ddraw, &IID_IDirectDraw, (void**)ddraw);
|
2008-12-14 19:06:49 +01:00
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw(IDirectDrawMediaStream *iface,
|
2011-08-16 10:11:54 +02:00
|
|
|
IDirectDraw *pDirectDraw)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub!\n", iface, pDirectDraw);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample(IDirectDrawMediaStream *iface,
|
2015-06-22 21:39:41 +02:00
|
|
|
IDirectDrawSurface *surface, const RECT *rect, DWORD dwFlags,
|
2011-08-16 10:11:54 +02:00
|
|
|
IDirectDrawStreamSample **ppSample)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
2015-06-22 21:39:41 +02:00
|
|
|
TRACE("(%p)->(%p,%s,%x,%p)\n", iface, surface, wine_dbgstr_rect(rect), dwFlags, ppSample);
|
2008-12-14 19:06:49 +01:00
|
|
|
|
2015-06-22 21:39:41 +02:00
|
|
|
return ddrawstreamsample_create(iface, surface, rect, ppSample);
|
2008-12-14 19:06:49 +01:00
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame(IDirectDrawMediaStream *iface,
|
2011-08-16 10:11:54 +02:00
|
|
|
STREAM_TIME *pFrameTime)
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p) stub!\n", iface, pFrameTime);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl =
|
2008-12-14 19:06:49 +01:00
|
|
|
{
|
2012-04-23 21:44:19 +02:00
|
|
|
/*** IUnknown methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_QueryInterface,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AddRef,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Release,
|
2012-04-23 21:44:19 +02:00
|
|
|
/*** IMediaStream methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetMultiMediaStream,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetInformation,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetSameFormat,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_AllocateSample,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSharedSample,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SendEndOfStream,
|
2012-04-23 21:44:19 +02:00
|
|
|
/*** IDirectDrawMediaStream methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetFormat,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetFormat,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetDirectDraw,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_SetDirectDraw,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_CreateSample,
|
|
|
|
DirectDrawMediaStreamImpl_IDirectDrawMediaStream_GetTimePerFrame
|
2008-12-14 19:06:49 +01:00
|
|
|
};
|
2011-08-16 10:13:31 +02:00
|
|
|
|
2012-09-23 20:43:40 +02:00
|
|
|
HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
|
2015-06-20 22:34:58 +02:00
|
|
|
STREAM_TYPE stream_type, IAMMediaStream **media_stream)
|
2011-08-16 10:13:31 +02:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
DirectDrawMediaStreamImpl *object;
|
2011-08-16 10:13:31 +02:00
|
|
|
|
2012-09-23 20:43:40 +02:00
|
|
|
TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
|
2011-08-16 10:13:31 +02:00
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DirectDrawMediaStreamImpl));
|
2011-08-16 10:13:31 +02:00
|
|
|
if (!object)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2012-09-23 20:43:40 +02:00
|
|
|
object->IAMMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IAMMediaStream_Vtbl;
|
2012-09-23 20:43:31 +02:00
|
|
|
object->IDirectDrawMediaStream_iface.lpVtbl = &DirectDrawMediaStreamImpl_IDirectDrawMediaStream_Vtbl;
|
2011-08-16 10:13:31 +02:00
|
|
|
object->ref = 1;
|
|
|
|
|
2012-09-23 20:43:40 +02:00
|
|
|
object->parent = parent;
|
|
|
|
object->purpose_id = *purpose_id;
|
|
|
|
object->stream_type = stream_type;
|
2011-08-16 10:13:31 +02:00
|
|
|
|
2015-06-20 22:34:58 +02:00
|
|
|
*media_stream = &object->IAMMediaStream_iface;
|
2011-08-16 10:13:31 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
typedef struct {
|
2012-09-23 20:43:48 +02:00
|
|
|
IAMMediaStream IAMMediaStream_iface;
|
2012-04-23 21:44:28 +02:00
|
|
|
IAudioMediaStream IAudioMediaStream_iface;
|
|
|
|
LONG ref;
|
|
|
|
IMultiMediaStream* parent;
|
|
|
|
MSPID purpose_id;
|
|
|
|
STREAM_TYPE stream_type;
|
2012-09-23 20:43:31 +02:00
|
|
|
} AudioMediaStreamImpl;
|
2012-04-23 21:44:28 +02:00
|
|
|
|
2012-09-23 20:43:48 +02:00
|
|
|
static inline AudioMediaStreamImpl *impl_from_AudioMediaStream_IAMMediaStream(IAMMediaStream *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAMMediaStream_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_QueryInterface(IAMMediaStream *iface,
|
|
|
|
REFIID riid, void **ret_iface)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualGUID(riid, &IID_IMediaStream) ||
|
|
|
|
IsEqualGUID(riid, &IID_IAMMediaStream))
|
|
|
|
{
|
|
|
|
IAMMediaStream_AddRef(iface);
|
|
|
|
*ret_iface = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(riid, &IID_IAudioMediaStream))
|
|
|
|
{
|
|
|
|
IAMMediaStream_AddRef(iface);
|
|
|
|
*ret_iface = &This->IAudioMediaStream_iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ERR("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ret_iface);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_AddRef(IAMMediaStream *iface)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AudioMediaStreamImpl_IAMMediaStream_Release(IAMMediaStream *iface)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(): new ref = %u\n", iface, This, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IMediaStream methods ***/
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream(IAMMediaStream *iface,
|
|
|
|
IMultiMediaStream** multi_media_stream)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, multi_media_stream);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_GetInformation(IAMMediaStream *iface,
|
|
|
|
MSPID *purpose_id, STREAM_TYPE *type)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p,%p)\n", This, iface, purpose_id, type);
|
|
|
|
|
|
|
|
if (purpose_id)
|
|
|
|
*purpose_id = This->purpose_id;
|
|
|
|
if (type)
|
|
|
|
*type = This->stream_type;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetSameFormat(IAMMediaStream *iface,
|
|
|
|
IMediaStream *pStreamThatHasDesiredFormat, DWORD flags)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p,%x) stub!\n", This, iface, pStreamThatHasDesiredFormat, flags);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_AllocateSample(IAMMediaStream *iface,
|
|
|
|
DWORD flags, IStreamSample **sample)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%x,%p) stub!\n", This, iface, flags, sample);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_CreateSharedSample(IAMMediaStream *iface,
|
|
|
|
IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p,%x,%p) stub!\n", This, iface, existing_sample, flags, sample);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SendEndOfStream(IAMMediaStream *iface, DWORD flags)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%x) stub!\n", This, iface, flags);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IAMMediaStream methods ***/
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_Initialize(IAMMediaStream *iface, IUnknown *source_object, DWORD flags,
|
|
|
|
REFMSPID purpose_id, const STREAM_TYPE stream_type)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p,%x,%p,%u) stub!\n", This, iface, source_object, flags, purpose_id, stream_type);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface, IAMMultiMediaStream *am_multi_media_stream)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, am_multi_media_stream);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilter(IAMMediaStream *iface, IMediaStreamFilter *media_stream_filter)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, media_stream_filter);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph(IAMMediaStream *iface, IFilterGraph *filtergraph)
|
|
|
|
{
|
|
|
|
AudioMediaStreamImpl *This = impl_from_AudioMediaStream_IAMMediaStream(iface);
|
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, filtergraph);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IAMMediaStreamVtbl AudioMediaStreamImpl_IAMMediaStream_Vtbl =
|
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_QueryInterface,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_AddRef,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_Release,
|
|
|
|
/*** IMediaStream methods ***/
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_GetMultiMediaStream,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_GetInformation,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_SetSameFormat,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_AllocateSample,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_CreateSharedSample,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_SendEndOfStream,
|
|
|
|
/*** IAMMediaStream methods ***/
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_Initialize,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_SetState,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_JoinAMMultiMediaStream,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_JoinFilter,
|
|
|
|
AudioMediaStreamImpl_IAMMediaStream_JoinFilterGraph
|
|
|
|
};
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static inline AudioMediaStreamImpl *impl_from_IAudioMediaStream(IAudioMediaStream *iface)
|
2012-04-23 21:44:28 +02:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAudioMediaStream_iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_QueryInterface(IAudioMediaStream *iface,
|
2012-04-23 21:44:28 +02:00
|
|
|
REFIID riid, void **ret_iface)
|
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ret_iface);
|
2015-06-23 09:09:08 +02:00
|
|
|
return IAMMediaStream_QueryInterface(&This->IAMMediaStream_iface, riid, ret_iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_AddRef(IAudioMediaStream *iface)
|
2012-04-23 21:44:28 +02:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2015-06-23 09:09:08 +02:00
|
|
|
TRACE("(%p/%p)\n", iface, This);
|
|
|
|
return IAMMediaStream_AddRef(&This->IAMMediaStream_iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static ULONG WINAPI AudioMediaStreamImpl_IAudioMediaStream_Release(IAudioMediaStream *iface)
|
2012-04-23 21:44:28 +02:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2015-06-23 09:09:08 +02:00
|
|
|
TRACE("(%p/%p)\n", iface, This);
|
|
|
|
return IAMMediaStream_Release(&This->IAMMediaStream_iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IMediaStream methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetMultiMediaStream(IAudioMediaStream *iface,
|
2012-04-23 21:44:28 +02:00
|
|
|
IMultiMediaStream** multimedia_stream)
|
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", iface, This, multimedia_stream);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetInformation(IAudioMediaStream *iface,
|
2012-04-23 21:44:28 +02:00
|
|
|
MSPID *purpose_id, STREAM_TYPE *type)
|
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p,%p)\n", iface, This, purpose_id, type);
|
|
|
|
|
|
|
|
if (purpose_id)
|
|
|
|
*purpose_id = This->purpose_id;
|
|
|
|
if (type)
|
|
|
|
*type = This->stream_type;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SetSameFormat(IAudioMediaStream *iface,
|
2012-04-23 21:44:28 +02:00
|
|
|
IMediaStream *stream_format, DWORD flags)
|
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p,%x) stub!\n", iface, This, stream_format, flags);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_AllocateSample(IAudioMediaStream *iface,
|
2012-04-23 21:44:28 +02:00
|
|
|
DWORD flags, IStreamSample **sample)
|
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%x,%p) stub!\n", iface, This, flags, sample);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample(IAudioMediaStream *iface,
|
2012-04-23 21:44:28 +02:00
|
|
|
IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
|
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p,%x,%p) stub!\n", iface, This, existing_sample, flags, sample);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream(IAudioMediaStream *iface,
|
2012-04-23 21:44:28 +02:00
|
|
|
DWORD flags)
|
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%x) stub!\n", iface, This, flags);
|
|
|
|
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IAudioMediaStream methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_GetFormat(IAudioMediaStream *iface, WAVEFORMATEX *wave_format_current)
|
2012-04-23 21:44:28 +02:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format_current);
|
|
|
|
|
2012-05-01 10:21:20 +02:00
|
|
|
if (!wave_format_current)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
return MS_E_NOSTREAM;
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_SetFormat(IAudioMediaStream *iface, const WAVEFORMATEX *wave_format)
|
2012-04-23 21:44:28 +02:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_CreateSample(IAudioMediaStream *iface, IAudioData *audio_data,
|
2012-04-23 21:44:28 +02:00
|
|
|
DWORD flags, IAudioStreamSample **sample)
|
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
2012-04-26 07:58:14 +02:00
|
|
|
TRACE("(%p/%p)->(%p,%u,%p)\n", iface, This, audio_data, flags, sample);
|
2012-04-23 21:44:28 +02:00
|
|
|
|
2012-04-26 07:58:14 +02:00
|
|
|
if (!audio_data)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
return audiostreamsample_create(iface, audio_data, sample);
|
2012-04-23 21:44:28 +02:00
|
|
|
}
|
|
|
|
|
2012-09-23 20:43:48 +02:00
|
|
|
static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream_Vtbl =
|
2012-04-23 21:44:28 +02:00
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_QueryInterface,
|
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_AddRef,
|
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_Release,
|
2012-04-23 21:44:28 +02:00
|
|
|
/*** IMediaStream methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_GetMultiMediaStream,
|
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_GetInformation,
|
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_SetSameFormat,
|
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_AllocateSample,
|
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_CreateSharedSample,
|
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_SendEndOfStream,
|
2012-04-23 21:44:28 +02:00
|
|
|
/*** IAudioMediaStream methods ***/
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_GetFormat,
|
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_SetFormat,
|
|
|
|
AudioMediaStreamImpl_IAudioMediaStream_CreateSample
|
2012-04-23 21:44:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
|
2015-06-20 22:34:58 +02:00
|
|
|
STREAM_TYPE stream_type, IAMMediaStream **media_stream)
|
2012-04-23 21:44:28 +02:00
|
|
|
{
|
2012-09-23 20:43:31 +02:00
|
|
|
AudioMediaStreamImpl *object;
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
|
|
|
|
|
2012-09-23 20:43:31 +02:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioMediaStreamImpl));
|
2012-04-23 21:44:28 +02:00
|
|
|
if (!object)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2012-09-23 20:43:48 +02:00
|
|
|
object->IAMMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAMMediaStream_Vtbl;
|
|
|
|
object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAudioMediaStream_Vtbl;
|
2012-04-23 21:44:28 +02:00
|
|
|
object->ref = 1;
|
|
|
|
|
|
|
|
object->parent = parent;
|
|
|
|
object->purpose_id = *purpose_id;
|
|
|
|
object->stream_type = stream_type;
|
|
|
|
|
2015-06-20 22:34:58 +02:00
|
|
|
*media_stream = &object->IAMMediaStream_iface;
|
2012-04-23 21:44:28 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2012-04-26 07:58:05 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
IDirectDrawStreamSample IDirectDrawStreamSample_iface;
|
|
|
|
LONG ref;
|
|
|
|
IMediaStream *parent;
|
2015-06-22 21:39:41 +02:00
|
|
|
IDirectDrawSurface *surface;
|
|
|
|
RECT rect;
|
2012-04-26 07:58:05 +02:00
|
|
|
} IDirectDrawStreamSampleImpl;
|
|
|
|
|
|
|
|
static inline IDirectDrawStreamSampleImpl *impl_from_IDirectDrawStreamSample(IDirectDrawStreamSample *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IDirectDrawStreamSampleImpl, IDirectDrawStreamSample_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
static HRESULT WINAPI IDirectDrawStreamSampleImpl_QueryInterface(IDirectDrawStreamSample *iface,
|
|
|
|
REFIID riid, void **ret_iface)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualGUID(riid, &IID_IStreamSample) ||
|
|
|
|
IsEqualGUID(riid, &IID_IDirectDrawStreamSample))
|
|
|
|
{
|
|
|
|
IDirectDrawStreamSample_AddRef(iface);
|
|
|
|
*ret_iface = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ret_iface = NULL;
|
|
|
|
|
|
|
|
ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IDirectDrawStreamSampleImpl_AddRef(IDirectDrawStreamSample *iface)
|
|
|
|
{
|
|
|
|
IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IDirectDrawStreamSampleImpl_Release(IDirectDrawStreamSample *iface)
|
|
|
|
{
|
|
|
|
IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
2015-06-22 21:39:41 +02:00
|
|
|
{
|
|
|
|
if (This->surface)
|
|
|
|
IDirectDrawSurface_Release(This->surface);
|
2015-06-22 21:56:10 +02:00
|
|
|
IMediaStream_Release(This->parent);
|
2012-04-26 07:58:05 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2015-06-22 21:39:41 +02:00
|
|
|
}
|
2012-04-26 07:58:05 +02:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IStreamSample methods ***/
|
|
|
|
static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetMediaStream(IDirectDrawStreamSample *iface, IMediaStream **media_stream)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p): stub\n", iface, media_stream);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSampleTimes(IDirectDrawStreamSample *iface, STREAM_TIME *start_time,
|
|
|
|
STREAM_TIME *end_time, STREAM_TIME *current_time)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time, current_time);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetSampleTimes(IDirectDrawStreamSample *iface, const STREAM_TIME *start_time,
|
|
|
|
const STREAM_TIME *end_time)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectDrawStreamSampleImpl_Update(IDirectDrawStreamSample *iface, DWORD flags, HANDLE event,
|
|
|
|
PAPCFUNC func_APC, DWORD APC_data)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectDrawStreamSampleImpl_CompletionStatus(IDirectDrawStreamSample *iface, DWORD flags, DWORD milliseconds)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IDirectDrawStreamSample methods ***/
|
|
|
|
static HRESULT WINAPI IDirectDrawStreamSampleImpl_GetSurface(IDirectDrawStreamSample *iface, IDirectDrawSurface **ddraw_surface,
|
|
|
|
RECT *rect)
|
|
|
|
{
|
2015-06-22 21:39:41 +02:00
|
|
|
IDirectDrawStreamSampleImpl *This = impl_from_IDirectDrawStreamSample(iface);
|
2012-04-26 07:58:05 +02:00
|
|
|
|
2015-06-22 21:39:41 +02:00
|
|
|
TRACE("(%p)->(%p,%p)\n", iface, ddraw_surface, rect);
|
|
|
|
|
|
|
|
if (ddraw_surface)
|
|
|
|
{
|
|
|
|
*ddraw_surface = This->surface;
|
|
|
|
if (*ddraw_surface)
|
|
|
|
IDirectDrawSurface_AddRef(*ddraw_surface);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rect)
|
|
|
|
*rect = This->rect;
|
|
|
|
|
|
|
|
return S_OK;
|
2012-04-26 07:58:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IDirectDrawStreamSampleImpl_SetRect(IDirectDrawStreamSample *iface, const RECT *rect)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p): stub\n", iface, rect);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IDirectDrawStreamSampleVtbl DirectDrawStreamSample_Vtbl =
|
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
IDirectDrawStreamSampleImpl_QueryInterface,
|
|
|
|
IDirectDrawStreamSampleImpl_AddRef,
|
|
|
|
IDirectDrawStreamSampleImpl_Release,
|
|
|
|
/*** IStreamSample methods ***/
|
|
|
|
IDirectDrawStreamSampleImpl_GetMediaStream,
|
|
|
|
IDirectDrawStreamSampleImpl_GetSampleTimes,
|
|
|
|
IDirectDrawStreamSampleImpl_SetSampleTimes,
|
|
|
|
IDirectDrawStreamSampleImpl_Update,
|
|
|
|
IDirectDrawStreamSampleImpl_CompletionStatus,
|
|
|
|
/*** IDirectDrawStreamSample methods ***/
|
|
|
|
IDirectDrawStreamSampleImpl_GetSurface,
|
|
|
|
IDirectDrawStreamSampleImpl_SetRect
|
|
|
|
};
|
|
|
|
|
2015-06-22 21:39:41 +02:00
|
|
|
static HRESULT ddrawstreamsample_create(IDirectDrawMediaStream *parent, IDirectDrawSurface *surface,
|
|
|
|
const RECT *rect, IDirectDrawStreamSample **ddraw_stream_sample)
|
2012-04-26 07:58:05 +02:00
|
|
|
{
|
|
|
|
IDirectDrawStreamSampleImpl *object;
|
2015-06-22 21:39:41 +02:00
|
|
|
HRESULT hr;
|
2012-04-26 07:58:05 +02:00
|
|
|
|
|
|
|
TRACE("(%p)\n", ddraw_stream_sample);
|
|
|
|
|
2015-06-22 21:39:41 +02:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
2012-04-26 07:58:05 +02:00
|
|
|
if (!object)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
object->IDirectDrawStreamSample_iface.lpVtbl = &DirectDrawStreamSample_Vtbl;
|
|
|
|
object->ref = 1;
|
|
|
|
object->parent = (IMediaStream*)parent;
|
2015-06-22 21:56:10 +02:00
|
|
|
IMediaStream_AddRef(object->parent);
|
|
|
|
|
2015-06-22 21:39:41 +02:00
|
|
|
if (surface)
|
|
|
|
{
|
|
|
|
object->surface = surface;
|
|
|
|
IDirectDrawSurface_AddRef(surface);
|
|
|
|
}
|
|
|
|
else
|
2015-06-23 22:24:46 +02:00
|
|
|
{
|
|
|
|
DDSURFACEDESC desc;
|
|
|
|
IDirectDraw *ddraw;
|
|
|
|
|
|
|
|
hr = IDirectDrawMediaStream_GetDirectDraw(parent, &ddraw);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
IDirectDrawStreamSample_Release(&object->IDirectDrawStreamSample_iface);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
desc.dwSize = sizeof(desc);
|
|
|
|
desc.dwFlags = DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT;
|
|
|
|
desc.dwHeight = 100;
|
|
|
|
desc.dwWidth = 100;
|
|
|
|
desc.ddpfPixelFormat.dwSize = sizeof(desc.ddpfPixelFormat);
|
|
|
|
desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
|
|
|
desc.ddpfPixelFormat.dwRGBBitCount = 32;
|
|
|
|
desc.ddpfPixelFormat.dwRBitMask = 0xff0000;
|
|
|
|
desc.ddpfPixelFormat.dwGBitMask = 0x00ff00;
|
|
|
|
desc.ddpfPixelFormat.dwBBitMask = 0x0000ff;
|
|
|
|
desc.ddpfPixelFormat.dwRGBAlphaBitMask = 0;
|
|
|
|
desc.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY|DDSCAPS_OFFSCREENPLAIN;
|
2015-09-28 18:16:57 +02:00
|
|
|
desc.lpSurface = NULL;
|
2015-06-23 22:24:46 +02:00
|
|
|
|
|
|
|
hr = IDirectDraw_CreateSurface(ddraw, &desc, &object->surface, NULL);
|
|
|
|
IDirectDraw_Release(ddraw);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
ERR("failed to create surface, 0x%08x\n", hr);
|
|
|
|
IDirectDrawStreamSample_Release(&object->IDirectDrawStreamSample_iface);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
}
|
2015-06-22 21:39:41 +02:00
|
|
|
|
|
|
|
if (rect)
|
|
|
|
object->rect = *rect;
|
|
|
|
else if (object->surface)
|
|
|
|
{
|
|
|
|
DDSURFACEDESC desc = { sizeof(desc) };
|
|
|
|
hr = IDirectDrawSurface_GetSurfaceDesc(object->surface, &desc);
|
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
|
|
|
object->rect.left = object->rect.top = 0;
|
|
|
|
object->rect.right = desc.dwWidth;
|
|
|
|
object->rect.bottom = desc.dwHeight;
|
|
|
|
}
|
|
|
|
}
|
2012-04-26 07:58:05 +02:00
|
|
|
|
2015-06-23 22:24:46 +02:00
|
|
|
*ddraw_stream_sample = &object->IDirectDrawStreamSample_iface;
|
2012-04-26 07:58:05 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
2012-04-26 07:58:14 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
IAudioStreamSample IAudioStreamSample_iface;
|
|
|
|
LONG ref;
|
|
|
|
IMediaStream *parent;
|
|
|
|
IAudioData *audio_data;
|
|
|
|
} IAudioStreamSampleImpl;
|
|
|
|
|
|
|
|
static inline IAudioStreamSampleImpl *impl_from_IAudioStreamSample(IAudioStreamSample *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IAudioStreamSampleImpl, IAudioStreamSample_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
static HRESULT WINAPI IAudioStreamSampleImpl_QueryInterface(IAudioStreamSample *iface,
|
|
|
|
REFIID riid, void **ret_iface)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->(%s,%p)\n", iface, debugstr_guid(riid), ret_iface);
|
|
|
|
|
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
|
|
|
IsEqualGUID(riid, &IID_IStreamSample) ||
|
|
|
|
IsEqualGUID(riid, &IID_IAudioStreamSample))
|
|
|
|
{
|
|
|
|
IAudioStreamSample_AddRef(iface);
|
|
|
|
*ret_iface = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ret_iface = NULL;
|
|
|
|
|
|
|
|
ERR("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ret_iface);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IAudioStreamSampleImpl_AddRef(IAudioStreamSample *iface)
|
|
|
|
{
|
|
|
|
IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
|
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IAudioStreamSampleImpl_Release(IAudioStreamSample *iface)
|
|
|
|
{
|
|
|
|
IAudioStreamSampleImpl *This = impl_from_IAudioStreamSample(iface);
|
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p)->(): new ref = %u\n", iface, ref);
|
|
|
|
|
|
|
|
if (!ref)
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IStreamSample methods ***/
|
|
|
|
static HRESULT WINAPI IAudioStreamSampleImpl_GetMediaStream(IAudioStreamSample *iface, IMediaStream **media_stream)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p): stub\n", iface, media_stream);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAudioStreamSampleImpl_GetSampleTimes(IAudioStreamSample *iface, STREAM_TIME *start_time,
|
|
|
|
STREAM_TIME *end_time, STREAM_TIME *current_time)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p,%p,%p): stub\n", iface, start_time, end_time, current_time);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAudioStreamSampleImpl_SetSampleTimes(IAudioStreamSample *iface, const STREAM_TIME *start_time,
|
|
|
|
const STREAM_TIME *end_time)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p,%p): stub\n", iface, start_time, end_time);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAudioStreamSampleImpl_Update(IAudioStreamSample *iface, DWORD flags, HANDLE event,
|
|
|
|
PAPCFUNC func_APC, DWORD APC_data)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%x,%p,%p,%u): stub\n", iface, flags, event, func_APC, APC_data);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAudioStreamSampleImpl_CompletionStatus(IAudioStreamSample *iface, DWORD flags, DWORD milliseconds)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%x,%u): stub\n", iface, flags, milliseconds);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IAudioStreamSample methods ***/
|
|
|
|
static HRESULT WINAPI IAudioStreamSampleImpl_GetAudioData(IAudioStreamSample *iface, IAudioData **audio_data)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p): stub\n", iface, audio_data);
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct IAudioStreamSampleVtbl AudioStreamSample_Vtbl =
|
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
IAudioStreamSampleImpl_QueryInterface,
|
|
|
|
IAudioStreamSampleImpl_AddRef,
|
|
|
|
IAudioStreamSampleImpl_Release,
|
|
|
|
/*** IStreamSample methods ***/
|
|
|
|
IAudioStreamSampleImpl_GetMediaStream,
|
|
|
|
IAudioStreamSampleImpl_GetSampleTimes,
|
|
|
|
IAudioStreamSampleImpl_SetSampleTimes,
|
|
|
|
IAudioStreamSampleImpl_Update,
|
|
|
|
IAudioStreamSampleImpl_CompletionStatus,
|
|
|
|
/*** IAudioStreamSample methods ***/
|
|
|
|
IAudioStreamSampleImpl_GetAudioData
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT audiostreamsample_create(IAudioMediaStream *parent, IAudioData *audio_data, IAudioStreamSample **audio_stream_sample)
|
|
|
|
{
|
|
|
|
IAudioStreamSampleImpl *object;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", audio_stream_sample);
|
|
|
|
|
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAudioStreamSampleImpl));
|
|
|
|
if (!object)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
object->IAudioStreamSample_iface.lpVtbl = &AudioStreamSample_Vtbl;
|
|
|
|
object->ref = 1;
|
|
|
|
object->parent = (IMediaStream*)parent;
|
|
|
|
object->audio_data = audio_data;
|
|
|
|
|
|
|
|
*audio_stream_sample = (IAudioStreamSample*)&object->IAudioStreamSample_iface;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|