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

amstream: Add IAMMediaStream interface to AudioMediaStream object.

parent 6b73c61c
......@@ -455,6 +455,7 @@ HRESULT ddrawmediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
}
typedef struct {
IAMMediaStream IAMMediaStream_iface;
IAudioMediaStream IAudioMediaStream_iface;
LONG ref;
IMultiMediaStream* parent;
......@@ -462,6 +463,194 @@ typedef struct {
STREAM_TYPE stream_type;
} AudioMediaStreamImpl;
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
};
static inline AudioMediaStreamImpl *impl_from_IAudioMediaStream(IAudioMediaStream *iface)
{
return CONTAINING_RECORD(iface, AudioMediaStreamImpl, IAudioMediaStream_iface);
......@@ -483,6 +672,13 @@ static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_QueryInterface(IAud
*ret_iface = iface;
return S_OK;
}
else if (IsEqualGUID(riid, &IID_IAMMediaStream))
{
IAudioMediaStream_AddRef(iface);
*ret_iface = &This->IAMMediaStream_iface;
return S_OK;
}
*ret_iface = NULL;
......@@ -615,7 +811,7 @@ static HRESULT WINAPI AudioMediaStreamImpl_IAudioMediaStream_CreateSample(IAudio
return audiostreamsample_create(iface, audio_data, sample);
}
static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_AudioMediaStream_Vtbl =
static const struct IAudioMediaStreamVtbl AudioMediaStreamImpl_IAudioMediaStream_Vtbl =
{
/*** IUnknown methods ***/
AudioMediaStreamImpl_IAudioMediaStream_QueryInterface,
......@@ -648,14 +844,15 @@ HRESULT audiomediastream_create(IMultiMediaStream *parent, const MSPID *purpose_
return E_OUTOFMEMORY;
}
object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_AudioMediaStream_Vtbl;
object->IAMMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAMMediaStream_Vtbl;
object->IAudioMediaStream_iface.lpVtbl = &AudioMediaStreamImpl_IAudioMediaStream_Vtbl;
object->ref = 1;
object->parent = parent;
object->purpose_id = *purpose_id;
object->stream_type = stream_type;
*media_stream = (IMediaStream*)&object->IAudioMediaStream_iface;
*media_stream = (IMediaStream*)&object->IAMMediaStream_iface;
return S_OK;
}
......
......@@ -326,8 +326,8 @@ static void test_media_streams(void)
IAudioStreamSample *audio_sample = NULL;
hr = IMediaStream_QueryInterface(audio_stream, &IID_IAMMediaStream, (LPVOID*)&am_media_stream);
todo_wine ok(hr == S_OK, "IMediaStream_QueryInterface returned: %x\n", hr);
todo_wine ok((void*)am_media_stream == (void*)audio_stream, "Not same interface, got %p expected %p\n", am_media_stream, video_stream);
ok(hr == S_OK, "IMediaStream_QueryInterface returned: %x\n", hr);
ok((void*)am_media_stream == (void*)audio_stream, "Not same interface, got %p expected %p\n", am_media_stream, audio_stream);
if (hr == S_OK)
IAMMediaStream_Release(am_media_stream);
......
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