Commit 8999dd2b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfreadwrite/reader: Implement GetServiceForStream() for stream objects.

parent c06e7ba7
...@@ -1906,36 +1906,60 @@ static HRESULT WINAPI src_reader_GetServiceForStream(IMFSourceReader *iface, DWO ...@@ -1906,36 +1906,60 @@ static HRESULT WINAPI src_reader_GetServiceForStream(IMFSourceReader *iface, DWO
{ {
struct source_reader *reader = impl_from_IMFSourceReader(iface); struct source_reader *reader = impl_from_IMFSourceReader(iface);
IUnknown *obj = NULL; IUnknown *obj = NULL;
HRESULT hr; HRESULT hr = S_OK;
TRACE("%p, %#x, %s, %s, %p\n", iface, index, debugstr_guid(service), debugstr_guid(riid), object); TRACE("%p, %#x, %s, %s, %p\n", iface, index, debugstr_guid(service), debugstr_guid(riid), object);
EnterCriticalSection(&reader->cs);
switch (index) switch (index)
{ {
case MF_SOURCE_READER_MEDIASOURCE: case MF_SOURCE_READER_MEDIASOURCE:
obj = (IUnknown *)reader->source; obj = (IUnknown *)reader->source;
break; break;
default: default:
FIXME("Unsupported index %#x.\n", index); if (index == MF_SOURCE_READER_FIRST_VIDEO_STREAM)
return E_NOTIMPL; index = reader->first_video_stream_index;
} else if (index == MF_SOURCE_READER_FIRST_AUDIO_STREAM)
index = reader->first_audio_stream_index;
if (IsEqualGUID(service, &GUID_NULL)) if (index >= reader->stream_count)
{ hr = MF_E_INVALIDSTREAMNUMBER;
hr = IUnknown_QueryInterface(obj, riid, object); else
{
obj = (IUnknown *)reader->streams[index].decoder;
if (!obj) hr = E_NOINTERFACE;
}
break;
} }
else
{
IMFGetService *gs;
hr = IUnknown_QueryInterface(obj, &IID_IMFGetService, (void **)&gs); if (obj)
if (SUCCEEDED(hr)) IUnknown_AddRef(obj);
LeaveCriticalSection(&reader->cs);
if (obj)
{
if (IsEqualGUID(service, &GUID_NULL))
{ {
hr = IMFGetService_GetService(gs, service, riid, object); hr = IUnknown_QueryInterface(obj, riid, object);
IMFGetService_Release(gs); }
else
{
IMFGetService *gs;
hr = IUnknown_QueryInterface(obj, &IID_IMFGetService, (void **)&gs);
if (SUCCEEDED(hr))
{
hr = IMFGetService_GetService(gs, service, riid, object);
IMFGetService_Release(gs);
}
} }
} }
if (obj)
IUnknown_Release(obj);
return hr; return hr;
} }
......
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