Commit e079edf8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfplat: Add IMFGetService stub for file-based bytestream.

parent 12812772
...@@ -1795,6 +1795,7 @@ typedef struct bytestream ...@@ -1795,6 +1795,7 @@ typedef struct bytestream
{ {
struct attributes attributes; struct attributes attributes;
IMFByteStream IMFByteStream_iface; IMFByteStream IMFByteStream_iface;
IMFGetService IMFGetService_iface;
IMFAsyncCallback read_callback; IMFAsyncCallback read_callback;
IMFAsyncCallback write_callback; IMFAsyncCallback write_callback;
IStream *stream; IStream *stream;
...@@ -1809,6 +1810,11 @@ static inline mfbytestream *impl_from_IMFByteStream(IMFByteStream *iface) ...@@ -1809,6 +1810,11 @@ static inline mfbytestream *impl_from_IMFByteStream(IMFByteStream *iface)
return CONTAINING_RECORD(iface, mfbytestream, IMFByteStream_iface); return CONTAINING_RECORD(iface, mfbytestream, IMFByteStream_iface);
} }
static struct bytestream *impl_bytestream_from_IMFGetService(IMFGetService *iface)
{
return CONTAINING_RECORD(iface, struct bytestream, IMFGetService_iface);
}
static struct bytestream *impl_from_read_callback_IMFAsyncCallback(IMFAsyncCallback *iface) static struct bytestream *impl_from_read_callback_IMFAsyncCallback(IMFAsyncCallback *iface)
{ {
return CONTAINING_RECORD(iface, struct bytestream, read_callback); return CONTAINING_RECORD(iface, struct bytestream, read_callback);
...@@ -2013,9 +2019,13 @@ static HRESULT WINAPI bytestream_QueryInterface(IMFByteStream *iface, REFIID rii ...@@ -2013,9 +2019,13 @@ static HRESULT WINAPI bytestream_QueryInterface(IMFByteStream *iface, REFIID rii
{ {
*out = &stream->attributes.IMFAttributes_iface; *out = &stream->attributes.IMFAttributes_iface;
} }
else if (stream->IMFGetService_iface.lpVtbl && IsEqualIID(riid, &IID_IMFGetService))
{
*out = &stream->IMFGetService_iface;
}
else else
{ {
FIXME("(%s, %p)\n", debugstr_guid(riid), out); WARN("Unsupported %s.\n", debugstr_guid(riid));
*out = NULL; *out = NULL;
return E_NOINTERFACE; return E_NOINTERFACE;
} }
...@@ -2621,6 +2631,40 @@ static const IMFAsyncCallbackVtbl bytestream_file_write_callback_vtbl = ...@@ -2621,6 +2631,40 @@ static const IMFAsyncCallbackVtbl bytestream_file_write_callback_vtbl =
bytestream_file_write_callback_Invoke, bytestream_file_write_callback_Invoke,
}; };
static HRESULT WINAPI bytestream_file_getservice_QueryInterface(IMFGetService *iface, REFIID riid, void **obj)
{
struct bytestream *stream = impl_bytestream_from_IMFGetService(iface);
return IMFByteStream_QueryInterface(&stream->IMFByteStream_iface, riid, obj);
}
static ULONG WINAPI bytestream_file_getservice_AddRef(IMFGetService *iface)
{
struct bytestream *stream = impl_bytestream_from_IMFGetService(iface);
return IMFByteStream_AddRef(&stream->IMFByteStream_iface);
}
static ULONG WINAPI bytestream_file_getservice_Release(IMFGetService *iface)
{
struct bytestream *stream = impl_bytestream_from_IMFGetService(iface);
return IMFByteStream_Release(&stream->IMFByteStream_iface);
}
static HRESULT WINAPI bytestream_file_getservice_GetService(IMFGetService *iface, REFGUID service,
REFIID riid, void **obj)
{
FIXME("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
return E_NOTIMPL;
}
static const IMFGetServiceVtbl bytestream_file_getservice_vtbl =
{
bytestream_file_getservice_QueryInterface,
bytestream_file_getservice_AddRef,
bytestream_file_getservice_Release,
bytestream_file_getservice_GetService,
};
/*********************************************************************** /***********************************************************************
* MFCreateFile (mfplat.@) * MFCreateFile (mfplat.@)
*/ */
...@@ -2696,6 +2740,7 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open ...@@ -2696,6 +2740,7 @@ HRESULT WINAPI MFCreateFile(MF_FILE_ACCESSMODE accessmode, MF_FILE_OPENMODE open
} }
object->IMFByteStream_iface.lpVtbl = &mfbytestream_vtbl; object->IMFByteStream_iface.lpVtbl = &mfbytestream_vtbl;
object->attributes.IMFAttributes_iface.lpVtbl = &mfbytestream_attributes_vtbl; object->attributes.IMFAttributes_iface.lpVtbl = &mfbytestream_attributes_vtbl;
object->IMFGetService_iface.lpVtbl = &bytestream_file_getservice_vtbl;
object->read_callback.lpVtbl = &bytestream_file_read_callback_vtbl; object->read_callback.lpVtbl = &bytestream_file_read_callback_vtbl;
object->write_callback.lpVtbl = &bytestream_file_write_callback_vtbl; object->write_callback.lpVtbl = &bytestream_file_write_callback_vtbl;
InitializeCriticalSection(&object->cs); InitializeCriticalSection(&object->cs);
......
...@@ -1146,9 +1146,7 @@ static void test_file_stream(void) ...@@ -1146,9 +1146,7 @@ static void test_file_stream(void)
ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr);
hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFGetService, (void **)&unk); hr = IMFByteStream_QueryInterface(bytestream, &IID_IMFGetService, (void **)&unk);
todo_wine
ok(hr == S_OK, "Failed to get interface pointer, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get interface pointer, hr %#x.\n", hr);
if (SUCCEEDED(hr))
IUnknown_Release(unk); IUnknown_Release(unk);
hr = IMFByteStream_GetCapabilities(bytestream, &caps); hr = IMFByteStream_GetCapabilities(bytestream, &caps);
......
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