mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 11:50:17 +00:00
amstream: Add IAudioMediaStream stub implementation.
This commit is contained in:
parent
badb5d555d
commit
d5bbdabf28
|
@ -371,8 +371,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream
|
|||
if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo))
|
||||
hr = ddrawmediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
|
||||
else
|
||||
/* FIXME: should call audiomediastream_create instead */
|
||||
hr = ddrawmediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
|
||||
hr = audiomediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IMediaStream*));
|
||||
|
|
|
@ -37,5 +37,7 @@ HRESULT AMAudioData_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
|||
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
|
||||
HRESULT ddrawmediastream_create(IMultiMediaStream *Parent, const MSPID *pPurposeId,
|
||||
STREAM_TYPE StreamType, IMediaStream **ppMediaStream) DECLSPEC_HIDDEN;
|
||||
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
|
||||
STREAM_TYPE stream_type, IMediaStream **media_stream) DECLSPEC_HIDDEN;
|
||||
|
||||
#endif /* __AMSTREAM_PRIVATE_INCLUDED__ */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Implementation of IMediaStream Interface
|
||||
* Implementation of IMediaStream Interfaces
|
||||
*
|
||||
* Copyright 2005, 2008 Christian Costa
|
||||
* Copyright 2005, 2008, 2012 Christian Costa
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -254,3 +254,203 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *Parent, const MSPID *pPurpose
|
|||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
IAudioMediaStream IAudioMediaStream_iface;
|
||||
LONG ref;
|
||||
IMultiMediaStream* parent;
|
||||
MSPID purpose_id;
|
||||
STREAM_TYPE stream_type;
|
||||
} IAudioMediaStreamImpl;
|
||||
|
||||
static inline IAudioMediaStreamImpl *impl_from_IAudioMediaStream(IAudioMediaStream *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, IAudioMediaStreamImpl, IAudioMediaStream_iface);
|
||||
}
|
||||
|
||||
/*** IUnknown methods ***/
|
||||
static HRESULT WINAPI IAudioMediaStreamImpl_QueryInterface(IAudioMediaStream *iface,
|
||||
REFIID riid, void **ret_iface)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(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_IAudioMediaStream))
|
||||
{
|
||||
IAudioMediaStream_AddRef(iface);
|
||||
*ret_iface = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
*ret_iface = NULL;
|
||||
|
||||
ERR("(%p/%p)->(%s,%p),not found\n", iface, This, debugstr_guid(riid), ret_iface);
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IAudioMediaStreamImpl_AddRef(IAudioMediaStream *iface)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p): new ref = %u\n", iface, This, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IAudioMediaStreamImpl_Release(IAudioMediaStream *iface)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(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 IAudioMediaStreamImpl_GetMultiMediaStream(IAudioMediaStream *iface,
|
||||
IMultiMediaStream** multimedia_stream)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%p) stub!\n", iface, This, multimedia_stream);
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAudioMediaStreamImpl_GetInformation(IAudioMediaStream *iface,
|
||||
MSPID *purpose_id, STREAM_TYPE *type)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAudioMediaStreamImpl_SetSameFormat(IAudioMediaStream *iface,
|
||||
IMediaStream *stream_format, DWORD flags)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%p,%x) stub!\n", iface, This, stream_format, flags);
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAudioMediaStreamImpl_AllocateSample(IAudioMediaStream *iface,
|
||||
DWORD flags, IStreamSample **sample)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%x,%p) stub!\n", iface, This, flags, sample);
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAudioMediaStreamImpl_CreateSharedSample(IAudioMediaStream *iface,
|
||||
IStreamSample *existing_sample, DWORD flags, IStreamSample **sample)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%p,%x,%p) stub!\n", iface, This, existing_sample, flags, sample);
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAudioMediaStreamImpl_SendEndOfStream(IAudioMediaStream *iface,
|
||||
DWORD flags)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%x) stub!\n", iface, This, flags);
|
||||
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
/*** IAudioMediaStream methods ***/
|
||||
static HRESULT WINAPI IAudioMediaStreamImpl_GetFormat(IAudioMediaStream *iface, WAVEFORMATEX *wave_format_current)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format_current);
|
||||
|
||||
return E_NOTIMPL;
|
||||
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAudioMediaStreamImpl_SetFormat(IAudioMediaStream *iface, const WAVEFORMATEX *wave_format)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%p) stub!\n", iface, This, wave_format);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IAudioMediaStreamImpl_CreateSample(IAudioMediaStream *iface, IAudioData *audio_data,
|
||||
DWORD flags, IAudioStreamSample **sample)
|
||||
{
|
||||
IAudioMediaStreamImpl *This = impl_from_IAudioMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%p,%u,%p) stub!\n", iface, This, audio_data, flags, sample);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const struct IAudioMediaStreamVtbl AudioMediaStream_Vtbl =
|
||||
{
|
||||
/*** IUnknown methods ***/
|
||||
IAudioMediaStreamImpl_QueryInterface,
|
||||
IAudioMediaStreamImpl_AddRef,
|
||||
IAudioMediaStreamImpl_Release,
|
||||
/*** IMediaStream methods ***/
|
||||
IAudioMediaStreamImpl_GetMultiMediaStream,
|
||||
IAudioMediaStreamImpl_GetInformation,
|
||||
IAudioMediaStreamImpl_SetSameFormat,
|
||||
IAudioMediaStreamImpl_AllocateSample,
|
||||
IAudioMediaStreamImpl_CreateSharedSample,
|
||||
IAudioMediaStreamImpl_SendEndOfStream,
|
||||
/*** IAudioMediaStream methods ***/
|
||||
IAudioMediaStreamImpl_GetFormat,
|
||||
IAudioMediaStreamImpl_SetFormat,
|
||||
IAudioMediaStreamImpl_CreateSample
|
||||
};
|
||||
|
||||
HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_id,
|
||||
STREAM_TYPE stream_type, IMediaStream **media_stream)
|
||||
{
|
||||
IAudioMediaStreamImpl *object;
|
||||
|
||||
TRACE("(%p,%s,%p)\n", parent, debugstr_guid(purpose_id), media_stream);
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAudioMediaStreamImpl));
|
||||
if (!object)
|
||||
{
|
||||
ERR("Out of memory\n");
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStream_Vtbl;
|
||||
object->ref = 1;
|
||||
|
||||
object->parent = parent;
|
||||
object->purpose_id = *purpose_id;
|
||||
object->stream_type = stream_type;
|
||||
|
||||
*media_stream = (IMediaStream*)&object->IAudioMediaStream_iface;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -325,10 +325,10 @@ static void test_media_streams(void)
|
|||
IAMMediaStream_Release(am_media_stream);
|
||||
|
||||
hr = IMediaStream_QueryInterface(audio_stream, &IID_IDirectDrawMediaStream, (LPVOID*)&ddraw_stream);
|
||||
todo_wine ok(hr == E_NOINTERFACE, "IMediaStream_QueryInterface returned: %x\n", hr);
|
||||
ok(hr == E_NOINTERFACE, "IMediaStream_QueryInterface returned: %x\n", hr);
|
||||
|
||||
hr = IMediaStream_QueryInterface(audio_stream, &IID_IAudioMediaStream, (LPVOID*)&audio_media_stream);
|
||||
todo_wine ok(hr == S_OK, "IMediaStream_QueryInterface returned: %x\n", hr);
|
||||
ok(hr == S_OK, "IMediaStream_QueryInterface returned: %x\n", hr);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue