mf: Add IMFMediaTypeHandler stub for grabber stream.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-05-20 15:22:29 +03:00 committed by Alexandre Julliard
parent dfd8457fd5
commit a2c8658bd2
2 changed files with 112 additions and 23 deletions

View File

@ -30,6 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
struct sample_grabber_stream struct sample_grabber_stream
{ {
IMFStreamSink IMFStreamSink_iface; IMFStreamSink IMFStreamSink_iface;
IMFMediaTypeHandler IMFMediaTypeHandler_iface;
LONG refcount; LONG refcount;
IMFMediaSink *sink; IMFMediaSink *sink;
}; };
@ -69,6 +70,11 @@ static struct sample_grabber_stream *impl_from_IMFStreamSink(IMFStreamSink *ifac
return CONTAINING_RECORD(iface, struct sample_grabber_stream, IMFStreamSink_iface); return CONTAINING_RECORD(iface, struct sample_grabber_stream, IMFStreamSink_iface);
} }
static struct sample_grabber_stream *impl_from_IMFMediaTypeHandler(IMFMediaTypeHandler *iface)
{
return CONTAINING_RECORD(iface, struct sample_grabber_stream, IMFMediaTypeHandler_iface);
}
static HRESULT WINAPI sample_grabber_stream_QueryInterface(IMFStreamSink *iface, REFIID riid, void **obj) static HRESULT WINAPI sample_grabber_stream_QueryInterface(IMFStreamSink *iface, REFIID riid, void **obj)
{ {
struct sample_grabber_stream *stream = impl_from_IMFStreamSink(iface); struct sample_grabber_stream *stream = impl_from_IMFStreamSink(iface);
@ -80,6 +86,10 @@ static HRESULT WINAPI sample_grabber_stream_QueryInterface(IMFStreamSink *iface,
{ {
*obj = &stream->IMFStreamSink_iface; *obj = &stream->IMFStreamSink_iface;
} }
else if (IsEqualIID(riid, &IID_IMFMediaTypeHandler))
{
*obj = &stream->IMFMediaTypeHandler_iface;
}
else else
{ {
WARN("Unsupported %s.\n", debugstr_guid(riid)); WARN("Unsupported %s.\n", debugstr_guid(riid));
@ -172,9 +182,14 @@ static HRESULT WINAPI sample_grabber_stream_GetIdentifier(IMFStreamSink *iface,
static HRESULT WINAPI sample_grabber_stream_GetMediaTypeHandler(IMFStreamSink *iface, IMFMediaTypeHandler **handler) static HRESULT WINAPI sample_grabber_stream_GetMediaTypeHandler(IMFStreamSink *iface, IMFMediaTypeHandler **handler)
{ {
FIXME("%p, %p.\n", iface, handler); struct sample_grabber_stream *stream = impl_from_IMFStreamSink(iface);
return E_NOTIMPL; TRACE("%p, %p.\n", iface, handler);
*handler = &stream->IMFMediaTypeHandler_iface;
IMFMediaTypeHandler_AddRef(*handler);
return S_OK;
} }
static HRESULT WINAPI sample_grabber_stream_ProcessSample(IMFStreamSink *iface, IMFSample *sample) static HRESULT WINAPI sample_grabber_stream_ProcessSample(IMFStreamSink *iface, IMFSample *sample)
@ -216,6 +231,84 @@ static const IMFStreamSinkVtbl sample_grabber_stream_vtbl =
sample_grabber_stream_Flush, sample_grabber_stream_Flush,
}; };
static HRESULT WINAPI sample_grabber_stream_type_handler_QueryInterface(IMFMediaTypeHandler *iface, REFIID riid,
void **obj)
{
struct sample_grabber_stream *stream = impl_from_IMFMediaTypeHandler(iface);
return IMFStreamSink_QueryInterface(&stream->IMFStreamSink_iface, riid, obj);
}
static ULONG WINAPI sample_grabber_stream_type_handler_AddRef(IMFMediaTypeHandler *iface)
{
struct sample_grabber_stream *stream = impl_from_IMFMediaTypeHandler(iface);
return IMFStreamSink_AddRef(&stream->IMFStreamSink_iface);
}
static ULONG WINAPI sample_grabber_stream_type_handler_Release(IMFMediaTypeHandler *iface)
{
struct sample_grabber_stream *stream = impl_from_IMFMediaTypeHandler(iface);
return IMFStreamSink_Release(&stream->IMFStreamSink_iface);
}
static HRESULT WINAPI sample_grabber_stream_type_handler_IsMediaTypeSupported(IMFMediaTypeHandler *iface,
IMFMediaType *in_type, IMFMediaType **out_type)
{
FIXME("%p, %p, %p.\n", iface, in_type, out_type);
return E_NOTIMPL;
}
static HRESULT WINAPI sample_grabber_stream_type_handler_GetMediaTypeCount(IMFMediaTypeHandler *iface, DWORD *count)
{
FIXME("%p, %p.\n", iface, count);
return E_NOTIMPL;
}
static HRESULT WINAPI sample_grabber_stream_type_handler_GetMediaTypeByIndex(IMFMediaTypeHandler *iface, DWORD index,
IMFMediaType **type)
{
FIXME("%p, %u, %p.\n", iface, index, type);
return E_NOTIMPL;
}
static HRESULT WINAPI sample_grabber_stream_type_handler_SetCurrentMediaType(IMFMediaTypeHandler *iface,
IMFMediaType *type)
{
FIXME("%p, %p.\n", iface, type);
return E_NOTIMPL;
}
static HRESULT WINAPI sample_grabber_stream_type_handler_GetCurrentMediaType(IMFMediaTypeHandler *iface,
IMFMediaType **type)
{
FIXME("%p, %p.\n", iface, type);
return E_NOTIMPL;
}
static HRESULT WINAPI sample_grabber_stream_type_handler_GetMajorType(IMFMediaTypeHandler *iface, GUID *type)
{
FIXME("%p, %p.\n", iface, type);
return E_NOTIMPL;
}
static const IMFMediaTypeHandlerVtbl sample_grabber_stream_type_handler_vtbl =
{
sample_grabber_stream_type_handler_QueryInterface,
sample_grabber_stream_type_handler_AddRef,
sample_grabber_stream_type_handler_Release,
sample_grabber_stream_type_handler_IsMediaTypeSupported,
sample_grabber_stream_type_handler_GetMediaTypeCount,
sample_grabber_stream_type_handler_GetMediaTypeByIndex,
sample_grabber_stream_type_handler_SetCurrentMediaType,
sample_grabber_stream_type_handler_GetCurrentMediaType,
sample_grabber_stream_type_handler_GetMajorType,
};
static HRESULT WINAPI sample_grabber_sink_QueryInterface(IMFMediaSink *iface, REFIID riid, void **obj) static HRESULT WINAPI sample_grabber_sink_QueryInterface(IMFMediaSink *iface, REFIID riid, void **obj)
{ {
struct sample_grabber *grabber = impl_from_IMFMediaSink(iface); struct sample_grabber *grabber = impl_from_IMFMediaSink(iface);
@ -424,6 +517,7 @@ static HRESULT sample_grabber_create_stream(IMFMediaSink *sink, IMFStreamSink **
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFStreamSink_iface.lpVtbl = &sample_grabber_stream_vtbl; object->IMFStreamSink_iface.lpVtbl = &sample_grabber_stream_vtbl;
object->IMFMediaTypeHandler_iface.lpVtbl = &sample_grabber_stream_type_handler_vtbl;
object->refcount = 1; object->refcount = 1;
object->sink = sink; object->sink = sink;
IMFMediaSink_AddRef(object->sink); IMFMediaSink_AddRef(object->sink);

View File

@ -1724,22 +1724,19 @@ todo_wine
ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr);
hr = IMFStreamSink_QueryInterface(stream, &IID_IMFMediaTypeHandler, (void **)&handler2); hr = IMFStreamSink_QueryInterface(stream, &IID_IMFMediaTypeHandler, (void **)&handler2);
todo_wine
ok(hr == S_OK, "Failed to get handler interface, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get handler interface, hr %#x.\n", hr);
if (SUCCEEDED(hr)) hr = IMFStreamSink_GetMediaTypeHandler(stream, &handler);
{ ok(hr == S_OK, "Failed to get type handler, hr %#x.\n", hr);
hr = IMFStreamSink_GetMediaTypeHandler(stream, &handler); hr = IMFMediaTypeHandler_GetMediaTypeCount(handler, &count);
ok(hr == S_OK, "Failed to get type handler, hr %#x.\n", hr); todo_wine {
hr = IMFMediaTypeHandler_GetMediaTypeCount(handler, &count); ok(hr == S_OK, "Failed to get media type count, hr %#x.\n", hr);
ok(hr == S_OK, "Failed to get media type count, hr %#x.\n", hr); ok(count == 0, "Unexpected count %u.\n", count);
ok(count == 0, "Unexpected count %u.\n", count); }
ok(handler == handler2, "Unexpected handler.\n");
ok(handler == handler2, "Unexpected handler.\n"); IMFMediaTypeHandler_Release(handler);
IMFMediaTypeHandler_Release(handler2);
IMFMediaTypeHandler_Release(handler);
IMFMediaTypeHandler_Release(handler2);
}
hr = IMFActivate_ShutdownObject(activate); hr = IMFActivate_ShutdownObject(activate);
todo_wine todo_wine
@ -1773,16 +1770,14 @@ todo_wine
ok(id == 0, "Unexpected id %#x.\n", id); ok(id == 0, "Unexpected id %#x.\n", id);
hr = IMFStreamSink_GetMediaTypeHandler(stream, &handler); hr = IMFStreamSink_GetMediaTypeHandler(stream, &handler);
todo_wine
ok(hr == S_OK, "Failed to get type handler, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get type handler, hr %#x.\n", hr);
if (SUCCEEDED(hr))
{
hr = IMFMediaTypeHandler_GetMediaTypeCount(handler, &count);
ok(hr == S_OK, "Failed to get media type count, hr %#x.\n", hr);
ok(count == 0, "Unexpected count %u.\n", count);
IMFMediaTypeHandler_Release(handler); hr = IMFMediaTypeHandler_GetMediaTypeCount(handler, &count);
} todo_wine {
ok(hr == S_OK, "Failed to get media type count, hr %#x.\n", hr);
ok(count == 0, "Unexpected count %u.\n", count);
}
IMFMediaTypeHandler_Release(handler);
IMFMediaSink_Release(sink); IMFMediaSink_Release(sink);
IMFStreamSink_Release(stream); IMFStreamSink_Release(stream);