Giovanni Mascellani : winegstreamer: Implement a stub IMFRateSupport for the media source.
Alexandre Julliard
julliard at winehq.org
Fri Mar 26 16:03:31 CDT 2021
Module: wine
Branch: master
Commit: 6e4c7d4dba3d83b2c62d8059c0531322370c4006
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6e4c7d4dba3d83b2c62d8059c0531322370c4006
Author: Giovanni Mascellani <gmascellani at codeweavers.com>
Date: Fri Mar 26 09:25:28 2021 +0100
winegstreamer: Implement a stub IMFRateSupport for the media source.
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfplat/tests/mfplat.c | 3 +-
dlls/winegstreamer/media_source.c | 102 +++++++++++++++++++++++++++++++++++++-
2 files changed, 101 insertions(+), 4 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 6084d5131aa..a38cecab827 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -758,10 +758,9 @@ static void test_source_resolver(void)
ok(obj_type == MF_OBJECT_MEDIASOURCE, "got %d\n", obj_type);
check_interface(mediasource, &IID_IMFGetService, TRUE);
-todo_wine {
check_service_interface(mediasource, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateSupport, TRUE);
+todo_wine
check_service_interface(mediasource, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateControl, TRUE);
-}
hr = IMFMediaSource_CreatePresentationDescriptor(mediasource, &descriptor);
ok(hr == S_OK, "Failed to get presentation descriptor, hr %#x.\n", hr);
ok(descriptor != NULL, "got %p\n", descriptor);
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index f795932e966..57c0b183ca8 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -79,6 +79,7 @@ struct media_source
{
IMFMediaSource IMFMediaSource_iface;
IMFGetService IMFGetService_iface;
+ IMFRateSupport IMFRateSupport_iface;
IMFAsyncCallback async_commands_callback;
LONG ref;
DWORD async_commands_queue;
@@ -119,6 +120,11 @@ static inline struct media_source *impl_from_IMFGetService(IMFGetService *iface)
return CONTAINING_RECORD(iface, struct media_source, IMFGetService_iface);
}
+static inline struct media_source *impl_from_IMFRateSupport(IMFRateSupport *iface)
+{
+ return CONTAINING_RECORD(iface, struct media_source, IMFRateSupport_iface);
+}
+
static inline struct media_source *impl_from_async_commands_callback_IMFAsyncCallback(IMFAsyncCallback *iface)
{
return CONTAINING_RECORD(iface, struct media_source, async_commands_callback);
@@ -849,9 +855,26 @@ static ULONG WINAPI media_source_get_service_Release(IMFGetService *iface)
static HRESULT WINAPI media_source_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj)
{
- FIXME("stub %p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
+ struct media_source *source = impl_from_IMFGetService(iface);
- return E_NOINTERFACE;
+ TRACE("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj);
+
+ *obj = NULL;
+
+ if (IsEqualGUID(service, &MF_RATE_CONTROL_SERVICE))
+ {
+ if (IsEqualIID(riid, &IID_IMFRateSupport))
+ {
+ *obj = &source->IMFRateSupport_iface;
+ }
+ }
+ else
+ FIXME("Unsupported service %s.\n", debugstr_guid(service));
+
+ if (*obj)
+ IUnknown_AddRef((IUnknown *)*obj);
+
+ return *obj ? S_OK : E_NOINTERFACE;
}
static const IMFGetServiceVtbl media_source_get_service_vtbl =
@@ -862,6 +885,80 @@ static const IMFGetServiceVtbl media_source_get_service_vtbl =
media_source_get_service_GetService,
};
+static HRESULT WINAPI media_source_rate_support_QueryInterface(IMFRateSupport *iface, REFIID riid, void **obj)
+{
+ struct media_source *source = impl_from_IMFRateSupport(iface);
+ return IMFMediaSource_QueryInterface(&source->IMFMediaSource_iface, riid, obj);
+}
+
+static ULONG WINAPI media_source_rate_support_AddRef(IMFRateSupport *iface)
+{
+ struct media_source *source = impl_from_IMFRateSupport(iface);
+ return IMFMediaSource_AddRef(&source->IMFMediaSource_iface);
+}
+
+static ULONG WINAPI media_source_rate_support_Release(IMFRateSupport *iface)
+{
+ struct media_source *source = impl_from_IMFRateSupport(iface);
+ return IMFMediaSource_Release(&source->IMFMediaSource_iface);
+}
+
+static HRESULT WINAPI media_source_rate_support_GetSlowestRate(IMFRateSupport *iface, MFRATE_DIRECTION direction, BOOL thin, float *rate)
+{
+ TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate);
+
+ if (direction == MFRATE_REVERSE)
+ return MF_E_REVERSE_UNSUPPORTED;
+
+ if (thin)
+ return MF_E_THINNING_UNSUPPORTED;
+
+ *rate = 1.0f;
+
+ return S_OK;
+}
+
+static HRESULT WINAPI media_source_rate_support_GetFastestRate(IMFRateSupport *iface, MFRATE_DIRECTION direction, BOOL thin, float *rate)
+{
+ TRACE("%p, %d, %d, %p.\n", iface, direction, thin, rate);
+
+ if (direction == MFRATE_REVERSE)
+ return MF_E_REVERSE_UNSUPPORTED;
+
+ if (thin)
+ return MF_E_THINNING_UNSUPPORTED;
+
+ *rate = 1.0f;
+
+ return S_OK;
+}
+
+static HRESULT WINAPI media_source_rate_support_IsRateSupported(IMFRateSupport *iface, BOOL thin, float rate, float *nearest_support_rate)
+{
+ TRACE("%p, %d, %f, %p.\n", iface, thin, rate, nearest_support_rate);
+
+ if (rate < 0.0f)
+ return MF_E_REVERSE_UNSUPPORTED;
+
+ if (thin)
+ return MF_E_THINNING_UNSUPPORTED;
+
+ if (nearest_support_rate)
+ *nearest_support_rate = 1.0f;
+
+ return rate == 1.0f ? S_OK : MF_E_UNSUPPORTED_RATE;
+}
+
+static const IMFRateSupportVtbl media_source_rate_support_vtbl =
+{
+ media_source_rate_support_QueryInterface,
+ media_source_rate_support_AddRef,
+ media_source_rate_support_Release,
+ media_source_rate_support_GetSlowestRate,
+ media_source_rate_support_GetFastestRate,
+ media_source_rate_support_IsRateSupported,
+};
+
static HRESULT WINAPI media_source_QueryInterface(IMFMediaSource *iface, REFIID riid, void **out)
{
struct media_source *source = impl_from_IMFMediaSource(iface);
@@ -1138,6 +1235,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl;
object->IMFGetService_iface.lpVtbl = &media_source_get_service_vtbl;
+ object->IMFRateSupport_iface.lpVtbl = &media_source_rate_support_vtbl;
object->async_commands_callback.lpVtbl = &source_async_commands_callback_vtbl;
object->ref = 1;
object->byte_stream = bytestream;
More information about the wine-cvs
mailing list