From 2eb66373f5eb1b881cb8016ae8ec0ac58c1d5b81 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Tue, 10 Jun 2008 18:40:09 +0200 Subject: [PATCH] quartz: Implement IMediaSeeking in the video renderer. --- dlls/quartz/tests/videorenderer.c | 4 +- dlls/quartz/videorenderer.c | 62 +++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c index 3fa752294b..967abd4ff9 100644 --- a/dlls/quartz/tests/videorenderer.c +++ b/dlls/quartz/tests/videorenderer.c @@ -68,6 +68,8 @@ static void test_query_interface(void) RELEASE_EXPECT(pBaseFilter, 1); QI_SUCCEED(pVideoRenderer, IID_IBasicVideo, pBasicVideo); RELEASE_EXPECT(pBasicVideo, 1); + QI_SUCCEED(pVideoRenderer, IID_IMediaSeeking, pMediaSeeking); + RELEASE_EXPECT(pMediaSeeking, 1); todo_wine { QI_SUCCEED(pVideoRenderer, IID_IDirectDrawVideo, pDirectDrawVideo); RELEASE_EXPECT(pDirectDrawVideo, 1); @@ -75,8 +77,6 @@ static void test_query_interface(void) RELEASE_EXPECT(pKsPropertySet, 1); QI_SUCCEED(pVideoRenderer, IID_IMediaPosition, pMediaPosition); RELEASE_EXPECT(pMediaPosition, 1); - QI_SUCCEED(pVideoRenderer, IID_IMediaSeeking, pMediaSeeking); - RELEASE_EXPECT(pMediaSeeking, 1); QI_SUCCEED(pVideoRenderer, IID_IQualityControl, pQualityControl); RELEASE_EXPECT(pQualityControl, 1); QI_SUCCEED(pVideoRenderer, IID_IQualProp, pQualProp); diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 1decbfe08e..fa3905e12b 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -86,6 +86,7 @@ typedef struct VideoRendererImpl BOOL bUnkOuterValid; BOOL bAggregatable; REFERENCE_TIME rtLastStop; + MediaSeekingImpl mediaSeeking; } VideoRendererImpl; static LRESULT CALLBACK VideoWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -482,6 +483,62 @@ static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt return S_FALSE; } +static inline VideoRendererImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) +{ + return (VideoRendererImpl *)((char*)iface - FIELD_OFFSET(VideoRendererImpl, mediaSeeking.lpVtbl)); +} + +static HRESULT WINAPI VideoRendererImpl_Seeking_QueryInterface(IMediaSeeking * iface, REFIID riid, LPVOID * ppv) +{ + VideoRendererImpl *This = impl_from_IMediaSeeking(iface); + + return IUnknown_QueryInterface((IUnknown *)This, riid, ppv); +} + +static ULONG WINAPI VideoRendererImpl_Seeking_AddRef(IMediaSeeking * iface) +{ + VideoRendererImpl *This = impl_from_IMediaSeeking(iface); + + return IUnknown_AddRef((IUnknown *)This); +} + +static ULONG WINAPI VideoRendererImpl_Seeking_Release(IMediaSeeking * iface) +{ + VideoRendererImpl *This = impl_from_IMediaSeeking(iface); + + return IUnknown_Release((IUnknown *)This); +} + +static const IMediaSeekingVtbl VideoRendererImpl_Seeking_Vtbl = +{ + VideoRendererImpl_Seeking_QueryInterface, + VideoRendererImpl_Seeking_AddRef, + VideoRendererImpl_Seeking_Release, + MediaSeekingImpl_GetCapabilities, + MediaSeekingImpl_CheckCapabilities, + MediaSeekingImpl_IsFormatSupported, + MediaSeekingImpl_QueryPreferredFormat, + MediaSeekingImpl_GetTimeFormat, + MediaSeekingImpl_IsUsingTimeFormat, + MediaSeekingImpl_SetTimeFormat, + MediaSeekingImpl_GetDuration, + MediaSeekingImpl_GetStopPosition, + MediaSeekingImpl_GetCurrentPosition, + MediaSeekingImpl_ConvertTimeFormat, + MediaSeekingImpl_SetPositions, + MediaSeekingImpl_GetPositions, + MediaSeekingImpl_GetAvailable, + MediaSeekingImpl_SetRate, + MediaSeekingImpl_GetRate, + MediaSeekingImpl_GetPreroll +}; + +static HRESULT VideoRendererImpl_Change(IBaseFilter *iface) +{ + TRACE("(%p)\n", iface); + return S_OK; +} + HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) { HRESULT hr; @@ -525,6 +582,9 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) if (SUCCEEDED(hr)) { + MediaSeekingImpl_Init((IBaseFilter*)pVideoRenderer, VideoRendererImpl_Change, VideoRendererImpl_Change, VideoRendererImpl_Change, &pVideoRenderer->mediaSeeking, &pVideoRenderer->csFilter); + pVideoRenderer->mediaSeeking.lpVtbl = &VideoRendererImpl_Seeking_Vtbl; + *ppv = (LPVOID)pVideoRenderer; } else @@ -568,6 +628,8 @@ static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID *ppv = (LPVOID)&(This->IBasicVideo_vtbl); else if (IsEqualIID(riid, &IID_IVideoWindow)) *ppv = (LPVOID)&(This->IVideoWindow_vtbl); + else if (IsEqualIID(riid, &IID_IMediaSeeking)) + *ppv = &This->mediaSeeking; if (*ppv) {