Signed-off-by: Derek Lesho dlesho@codeweavers.com --- dlls/winegstreamer/media_source.c | 111 ++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+)
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index 62cee6880fd..ffc36de115b 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -91,6 +91,8 @@ struct source_async_command struct media_source { IMFMediaSource IMFMediaSource_iface; + IMFGetService IMFGetService_iface; + IMFSeekInfo IMFSeekInfo_iface; IMFAsyncCallback async_commands_callback; LONG ref; DWORD async_commands_queue; @@ -123,6 +125,16 @@ static inline struct media_source *impl_from_IMFMediaSource(IMFMediaSource *ifac return CONTAINING_RECORD(iface, struct media_source, IMFMediaSource_iface); }
+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_IMFSeekInfo(IMFSeekInfo *iface) +{ + return CONTAINING_RECORD(iface, struct media_source, IMFSeekInfo_iface); +} + static inline struct media_source *impl_from_async_commands_callback_IMFAsyncCallback(IMFAsyncCallback *iface) { return CONTAINING_RECORD(iface, struct media_source, async_commands_callback); @@ -956,6 +968,10 @@ static HRESULT WINAPI media_source_QueryInterface(IMFMediaSource *iface, REFIID { *out = &source->IMFMediaSource_iface; } + else if(IsEqualIID(riid, &IID_IMFGetService)) + { + *out = &source->IMFGetService_iface; + } else { FIXME("(%s, %p)\n", debugstr_guid(riid), out); @@ -1185,6 +1201,99 @@ static const IMFMediaSourceVtbl IMFMediaSource_vtbl = media_source_Shutdown, };
+static HRESULT WINAPI source_get_service_QueryInterface(IMFGetService *iface, REFIID riid, void **obj) +{ + struct media_source *source = impl_from_IMFGetService(iface); + return IMFMediaSource_QueryInterface(&source->IMFMediaSource_iface, riid, obj); +} + +static ULONG WINAPI source_get_service_AddRef(IMFGetService *iface) +{ + struct media_source *source = impl_from_IMFGetService(iface); + return IMFMediaSource_AddRef(&source->IMFMediaSource_iface); +} + +static ULONG WINAPI source_get_service_Release(IMFGetService *iface) +{ + struct media_source *source = impl_from_IMFGetService(iface); + return IMFMediaSource_Release(&source->IMFMediaSource_iface); +} + +static HRESULT WINAPI source_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) +{ + struct media_source *source = impl_from_IMFGetService(iface); + + TRACE("(%p)->(%s, %s, %p)\n", source, debugstr_guid(service), debugstr_guid(riid), obj); + + if (source->state == SOURCE_SHUTDOWN) + return MF_E_SHUTDOWN; + + *obj = NULL; + + if (IsEqualIID(service, &MF_SCRUBBING_SERVICE)) + { + if (IsEqualIID(riid, &IID_IMFSeekInfo)) + { + *obj = &source->IMFSeekInfo_iface; + } + } + + if (*obj) + IUnknown_AddRef((IUnknown*) *obj); + + return *obj ? S_OK : E_NOINTERFACE; +} + +static const IMFGetServiceVtbl IMFGetService_vtbl = +{ + source_get_service_QueryInterface, + source_get_service_AddRef, + source_get_service_Release, + source_get_service_GetService, +}; + +static HRESULT WINAPI source_seek_info_QueryInterface(IMFSeekInfo *iface, REFIID riid, void **obj) +{ + struct media_source *source = impl_from_IMFSeekInfo(iface); + return IMFMediaSource_QueryInterface(&source->IMFMediaSource_iface, riid, obj); +} + +static ULONG WINAPI source_seek_info_AddRef(IMFSeekInfo *iface) +{ + struct media_source *source = impl_from_IMFSeekInfo(iface); + return IMFMediaSource_AddRef(&source->IMFMediaSource_iface); +} + +static ULONG WINAPI source_seek_info_Release(IMFSeekInfo *iface) +{ + struct media_source *source = impl_from_IMFSeekInfo(iface); + return IMFMediaSource_Release(&source->IMFMediaSource_iface); +} + +static HRESULT WINAPI source_seek_info_GetNearestKeyFrames(IMFSeekInfo *iface, const GUID *format, + const PROPVARIANT *position, PROPVARIANT *prev_frame, PROPVARIANT *next_frame) +{ + struct media_source *source = impl_from_IMFSeekInfo(iface); + + FIXME("(%p)->(%s, %p, %p, %p) - semi-stub\n", source, debugstr_guid(format), position, prev_frame, next_frame); + + if (source->state == SOURCE_SHUTDOWN) + return MF_E_SHUTDOWN; + + PropVariantCopy(prev_frame, position); + PropVariantCopy(next_frame, position); + + return S_OK; +} + +static const IMFSeekInfoVtbl IMFSeekInfo_vtbl = +{ + source_seek_info_QueryInterface, + source_seek_info_AddRef, + source_seek_info_Release, + source_seek_info_GetNearestKeyFrames, +}; + static void stream_added(GstElement *element, GstPad *pad, gpointer user) { struct media_source *source = user; @@ -1247,6 +1356,8 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_ return E_OUTOFMEMORY;
object->IMFMediaSource_iface.lpVtbl = &IMFMediaSource_vtbl; + object->IMFGetService_iface.lpVtbl = &IMFGetService_vtbl; + object->IMFSeekInfo_iface.lpVtbl = &IMFSeekInfo_vtbl; object->async_commands_callback.lpVtbl = &source_async_commands_callback_vtbl; object->ref = 1; object->byte_stream = bytestream;