2003-11-18 21:47:48 +01:00
|
|
|
/*
|
|
|
|
* Filter Seeking and Control Interfaces
|
|
|
|
*
|
|
|
|
* Copyright 2003 Robert Shearman
|
2012-03-14 20:45:34 +01:00
|
|
|
* Copyright 2012 Aric Stewart, CodeWeavers
|
2003-11-18 21:47:48 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-11-18 21:47:48 +01:00
|
|
|
*/
|
|
|
|
/* FIXME: critical sections */
|
|
|
|
|
2019-05-09 17:12:32 +02:00
|
|
|
#include "strmbase_private.h"
|
2003-11-18 21:47:48 +01:00
|
|
|
|
2021-07-11 02:22:22 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
2012-03-14 20:45:34 +01:00
|
|
|
|
2020-03-13 03:34:09 +01:00
|
|
|
static struct strmbase_passthrough *impl_from_ISeekingPassThru(ISeekingPassThru *iface)
|
2012-04-02 15:38:47 +02:00
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct strmbase_passthrough, ISeekingPassThru_iface);
|
2012-04-02 15:38:47 +02:00
|
|
|
}
|
|
|
|
|
2020-03-13 03:34:09 +01:00
|
|
|
static struct strmbase_passthrough *impl_from_IMediaSeeking(IMediaSeeking *iface)
|
2012-04-02 15:38:47 +02:00
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct strmbase_passthrough, IMediaSeeking_iface);
|
2012-04-02 15:38:47 +02:00
|
|
|
}
|
|
|
|
|
2020-03-13 03:34:09 +01:00
|
|
|
static struct strmbase_passthrough *impl_from_IMediaPosition(IMediaPosition *iface)
|
2012-04-03 21:29:51 +02:00
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
return CONTAINING_RECORD(iface, struct strmbase_passthrough, IMediaPosition_iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
}
|
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
static HRESULT WINAPI SeekingPassThru_QueryInterface(ISeekingPassThru *iface, REFIID iid, void **out)
|
2008-04-09 22:12:55 +02:00
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *passthrough = impl_from_ISeekingPassThru(iface);
|
2008-04-09 22:12:55 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
return IUnknown_QueryInterface(passthrough->outer_unk, iid, out);
|
2008-04-09 22:12:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI SeekingPassThru_AddRef(ISeekingPassThru *iface)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *passthrough = impl_from_ISeekingPassThru(iface);
|
2008-04-09 22:12:55 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
return IUnknown_AddRef(passthrough->outer_unk);
|
2008-04-09 22:12:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI SeekingPassThru_Release(ISeekingPassThru *iface)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *passthrough = impl_from_ISeekingPassThru(iface);
|
2008-04-09 22:12:55 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
return IUnknown_Release(passthrough->outer_unk);
|
2008-04-09 22:12:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI SeekingPassThru_Init(ISeekingPassThru *iface, BOOL renderer, IPin *pin)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_ISeekingPassThru(iface);
|
2008-04-09 22:12:55 +02:00
|
|
|
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%d, %p)\n", This, iface, renderer, pin);
|
|
|
|
|
|
|
|
if (This->pin)
|
|
|
|
FIXME("Re-initializing?\n");
|
|
|
|
|
|
|
|
This->renderer = renderer;
|
|
|
|
This->pin = pin;
|
2008-04-09 22:12:55 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const ISeekingPassThruVtbl ISeekingPassThru_Vtbl =
|
|
|
|
{
|
|
|
|
SeekingPassThru_QueryInterface,
|
|
|
|
SeekingPassThru_AddRef,
|
|
|
|
SeekingPassThru_Release,
|
|
|
|
SeekingPassThru_Init
|
|
|
|
};
|
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_QueryInterface(IMediaSeeking *iface, REFIID iid, void **out)
|
2008-04-10 01:34:23 +02:00
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *passthrough = impl_from_IMediaSeeking(iface);
|
2008-04-10 01:34:23 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
return IUnknown_QueryInterface(passthrough->outer_unk, iid, out);
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MediaSeekingPassThru_AddRef(IMediaSeeking *iface)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *passthrough = impl_from_IMediaSeeking(iface);
|
2008-04-10 01:34:23 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
return IUnknown_AddRef(passthrough->outer_unk);
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MediaSeekingPassThru_Release(IMediaSeeking *iface)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *passthrough = impl_from_IMediaSeeking(iface);
|
2008-04-10 01:34:23 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
return IUnknown_Release(passthrough->outer_unk);
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
2020-03-13 03:34:09 +01:00
|
|
|
static HRESULT get_connected(struct strmbase_passthrough *This, REFIID riid, void **ppvObj)
|
|
|
|
{
|
2010-05-22 14:04:38 +02:00
|
|
|
HRESULT hr;
|
|
|
|
IPin *pin;
|
2012-04-03 21:29:51 +02:00
|
|
|
*ppvObj = NULL;
|
2010-05-22 14:04:38 +02:00
|
|
|
hr = IPin_ConnectedTo(This->pin, &pin);
|
|
|
|
if (FAILED(hr))
|
2010-10-01 14:38:23 +02:00
|
|
|
return VFW_E_NOT_CONNECTED;
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = IPin_QueryInterface(pin, riid, ppvObj);
|
2010-05-22 14:04:38 +02:00
|
|
|
IPin_Release(pin);
|
|
|
|
if (FAILED(hr))
|
|
|
|
hr = E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2008-04-10 01:34:23 +02:00
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", iface, This, pCapabilities);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_GetCapabilities(seek, pCapabilities);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_CheckCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", iface, This, pCapabilities);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_CheckCapabilities(seek, pCapabilities);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_IsFormatSupported(IMediaSeeking * iface, const GUID * pFormat)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2012-03-14 20:45:34 +01:00
|
|
|
TRACE("(%p/%p)->(%s)\n", iface, This, debugstr_guid(pFormat));
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_IsFormatSupported(seek, pFormat);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_QueryPreferredFormat(IMediaSeeking * iface, GUID * pFormat)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", iface, This, pFormat);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_QueryPreferredFormat(seek, pFormat);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_GetTimeFormat(IMediaSeeking * iface, GUID * pFormat)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", iface, This, pFormat);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_GetTimeFormat(seek, pFormat);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_IsUsingTimeFormat(IMediaSeeking * iface, const GUID * pFormat)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2012-03-14 20:45:34 +01:00
|
|
|
TRACE("(%p/%p)->(%s)\n", iface, This, debugstr_guid(pFormat));
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_IsUsingTimeFormat(seek, pFormat);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_SetTimeFormat(IMediaSeeking * iface, const GUID * pFormat)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2012-03-14 20:45:34 +01:00
|
|
|
TRACE("(%p/%p)->(%s)\n", iface, This, debugstr_guid(pFormat));
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_SetTimeFormat(seek, pFormat);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_GetDuration(IMediaSeeking * iface, LONGLONG * pDuration)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
2008-06-10 16:59:30 +02:00
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", iface, This, pDuration);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_GetDuration(seek, pDuration);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2008-06-10 16:59:30 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_GetStopPosition(IMediaSeeking * iface, LONGLONG * pStop)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", iface, This, pStop);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_GetStopPosition(seek, pStop);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_GetCurrentPosition(IMediaSeeking * iface, LONGLONG * pCurrent)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
2010-05-22 15:19:38 +02:00
|
|
|
HRESULT hr = S_OK;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", iface, This, pCurrent);
|
2010-05-22 15:19:38 +02:00
|
|
|
if (!pCurrent)
|
|
|
|
return E_POINTER;
|
|
|
|
EnterCriticalSection(&This->time_cs);
|
|
|
|
if (This->timevalid)
|
|
|
|
*pCurrent = This->time_earliest;
|
|
|
|
else
|
|
|
|
hr = E_FAIL;
|
|
|
|
LeaveCriticalSection(&This->time_cs);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_ConvertTimeFormat(iface, pCurrent, NULL, *pCurrent, &TIME_FORMAT_MEDIA_TIME);
|
|
|
|
return hr;
|
|
|
|
}
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_GetCurrentPosition(seek, pCurrent);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_ConvertTimeFormat(IMediaSeeking * iface, LONGLONG * pTarget, const GUID * pTargetFormat, LONGLONG Source, const GUID * pSourceFormat)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p,%s,%x%08x,%s)\n", iface, This, pTarget, debugstr_guid(pTargetFormat), (DWORD)(Source>>32), (DWORD)Source, debugstr_guid(pSourceFormat));
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_ConvertTimeFormat(seek, pTarget, pTargetFormat, Source, pSourceFormat);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_SetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, DWORD dwCurrentFlags, LONGLONG * pStop, DWORD dwStopFlags)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
2008-06-10 16:59:30 +02:00
|
|
|
HRESULT hr;
|
2010-05-22 14:04:38 +02:00
|
|
|
TRACE("(%p/%p)->(%p,%x,%p,%x)\n", iface, This, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_SetPositions(seek, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
|
|
|
|
IMediaSeeking_Release(seek);
|
2010-10-01 14:38:23 +02:00
|
|
|
} else if (hr == VFW_E_NOT_CONNECTED)
|
|
|
|
hr = S_OK;
|
2008-06-10 16:59:30 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_GetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, LONGLONG * pStop)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p, %p)\n", iface, This, pCurrent, pStop);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_GetPositions(seek, pCurrent, pStop);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_GetAvailable(IMediaSeeking * iface, LONGLONG * pEarliest, LONGLONG * pLatest)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p,%p)\n", iface, This, pEarliest, pLatest);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_GetAvailable(seek, pEarliest, pLatest);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_SetRate(IMediaSeeking * iface, double dRate)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%e)\n", iface, This, dRate);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_SetRate(seek, dRate);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_GetRate(IMediaSeeking * iface, double * dRate)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p/%p)->(%p)\n", iface, This, dRate);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_GetRate(seek, dRate);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaSeekingPassThru_GetPreroll(IMediaSeeking * iface, LONGLONG * pPreroll)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaSeeking(iface);
|
2010-05-22 14:04:38 +02:00
|
|
|
IMediaSeeking *seek;
|
|
|
|
HRESULT hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
TRACE("(%p)\n", pPreroll);
|
2012-04-03 21:29:51 +02:00
|
|
|
hr = get_connected(This, &IID_IMediaSeeking, (LPVOID*)&seek);
|
2010-05-22 14:04:38 +02:00
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaSeeking_GetPreroll(seek, pPreroll);
|
|
|
|
IMediaSeeking_Release(seek);
|
|
|
|
}
|
2010-10-01 14:38:23 +02:00
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
2010-05-22 14:04:38 +02:00
|
|
|
return hr;
|
2008-04-10 01:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IMediaSeekingVtbl IMediaSeekingPassThru_Vtbl =
|
|
|
|
{
|
|
|
|
MediaSeekingPassThru_QueryInterface,
|
|
|
|
MediaSeekingPassThru_AddRef,
|
|
|
|
MediaSeekingPassThru_Release,
|
|
|
|
MediaSeekingPassThru_GetCapabilities,
|
|
|
|
MediaSeekingPassThru_CheckCapabilities,
|
|
|
|
MediaSeekingPassThru_IsFormatSupported,
|
|
|
|
MediaSeekingPassThru_QueryPreferredFormat,
|
|
|
|
MediaSeekingPassThru_GetTimeFormat,
|
|
|
|
MediaSeekingPassThru_IsUsingTimeFormat,
|
|
|
|
MediaSeekingPassThru_SetTimeFormat,
|
|
|
|
MediaSeekingPassThru_GetDuration,
|
|
|
|
MediaSeekingPassThru_GetStopPosition,
|
|
|
|
MediaSeekingPassThru_GetCurrentPosition,
|
|
|
|
MediaSeekingPassThru_ConvertTimeFormat,
|
|
|
|
MediaSeekingPassThru_SetPositions,
|
|
|
|
MediaSeekingPassThru_GetPositions,
|
|
|
|
MediaSeekingPassThru_GetAvailable,
|
|
|
|
MediaSeekingPassThru_SetRate,
|
|
|
|
MediaSeekingPassThru_GetRate,
|
|
|
|
MediaSeekingPassThru_GetPreroll
|
|
|
|
};
|
2012-04-03 21:29:51 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
static HRESULT WINAPI MediaPositionPassThru_QueryInterface(IMediaPosition *iface, REFIID iid, void **out)
|
2012-04-03 21:29:51 +02:00
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *passthrough = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
return IUnknown_QueryInterface(passthrough->outer_unk, iid, out);
|
2012-04-03 21:29:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MediaPositionPassThru_AddRef(IMediaPosition *iface)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *passthrough = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
return IUnknown_AddRef(passthrough->outer_unk);
|
2012-04-03 21:29:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI MediaPositionPassThru_Release(IMediaPosition *iface)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *passthrough = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
|
2020-03-13 03:34:07 +01:00
|
|
|
return IUnknown_Release(passthrough->outer_unk);
|
2012-04-03 21:29:51 +02:00
|
|
|
}
|
|
|
|
|
2019-06-07 01:49:23 +02:00
|
|
|
static HRESULT WINAPI MediaPositionPassThru_GetTypeInfoCount(IMediaPosition *iface, UINT *count)
|
2012-04-03 21:29:51 +02:00
|
|
|
{
|
2019-06-07 01:49:23 +02:00
|
|
|
TRACE("iface %p, count %p.\n", iface, count);
|
|
|
|
*count = 1;
|
|
|
|
return S_OK;
|
2012-04-03 21:29:51 +02:00
|
|
|
}
|
|
|
|
|
2019-06-07 01:49:23 +02:00
|
|
|
static HRESULT WINAPI MediaPositionPassThru_GetTypeInfo(IMediaPosition *iface, UINT index,
|
|
|
|
LCID lcid, ITypeInfo **typeinfo)
|
2012-04-03 21:29:51 +02:00
|
|
|
{
|
2019-06-07 01:49:23 +02:00
|
|
|
TRACE("iface %p, index %u, lcid %#x, typeinfo %p.\n", iface, index, lcid, typeinfo);
|
|
|
|
return strmbase_get_typeinfo(IMediaPosition_tid, typeinfo);
|
2012-04-03 21:29:51 +02:00
|
|
|
}
|
|
|
|
|
2019-06-07 01:49:23 +02:00
|
|
|
static HRESULT WINAPI MediaPositionPassThru_GetIDsOfNames(IMediaPosition *iface, REFIID iid,
|
|
|
|
LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
|
2012-04-03 21:29:51 +02:00
|
|
|
{
|
2019-06-07 01:49:23 +02:00
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("iface %p, iid %s, names %p, count %u, lcid %#x, ids %p.\n",
|
|
|
|
iface, debugstr_guid(iid), names, count, lcid, ids);
|
2012-04-03 21:29:51 +02:00
|
|
|
|
2019-06-07 01:49:23 +02:00
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaPosition_tid, &typeinfo)))
|
|
|
|
{
|
|
|
|
hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
return hr;
|
2012-04-03 21:29:51 +02:00
|
|
|
}
|
|
|
|
|
2019-06-07 01:49:23 +02:00
|
|
|
static HRESULT WINAPI MediaPositionPassThru_Invoke(IMediaPosition *iface, DISPID id, REFIID iid, LCID lcid,
|
|
|
|
WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
|
2012-04-03 21:29:51 +02:00
|
|
|
{
|
2019-06-07 01:49:23 +02:00
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
HRESULT hr;
|
2012-04-03 21:29:51 +02:00
|
|
|
|
2019-06-07 01:49:23 +02:00
|
|
|
TRACE("iface %p, id %d, iid %s, lcid %#x, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
|
|
|
|
iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaPosition_tid, &typeinfo)))
|
2012-04-20 14:26:53 +02:00
|
|
|
{
|
2019-06-07 01:49:23 +02:00
|
|
|
hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
2012-04-20 14:26:53 +02:00
|
|
|
}
|
|
|
|
return hr;
|
2012-04-03 21:29:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_get_Duration(IMediaPosition *iface, REFTIME *plength)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", plength);
|
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_get_Duration(pos, plength);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_put_CurrentPosition(IMediaPosition *iface, REFTIME llTime)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2019-10-06 02:18:49 +02:00
|
|
|
TRACE("iface %p, time %.16e.\n", iface, llTime);
|
2012-04-03 21:29:51 +02:00
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_put_CurrentPosition(pos, llTime);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_get_CurrentPosition(IMediaPosition *iface, REFTIME *pllTime)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", pllTime);
|
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_get_CurrentPosition(pos, pllTime);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_get_StopTime(IMediaPosition *iface, REFTIME *pllTime)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", pllTime);
|
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_get_StopTime(pos, pllTime);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_put_StopTime(IMediaPosition *iface, REFTIME llTime)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2019-10-06 02:18:49 +02:00
|
|
|
TRACE("iface %p, time %.16e.\n", iface, llTime);
|
2012-04-03 21:29:51 +02:00
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_put_StopTime(pos, llTime);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_get_PrerollTime(IMediaPosition *iface, REFTIME *pllTime)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", pllTime);
|
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_get_PrerollTime(pos, pllTime);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_put_PrerollTime(IMediaPosition *iface, REFTIME llTime)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2019-10-06 02:18:49 +02:00
|
|
|
TRACE("iface %p, time %.16e.\n", iface, llTime);
|
2012-04-03 21:29:51 +02:00
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_put_PrerollTime(pos, llTime);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_put_Rate(IMediaPosition *iface, double dRate)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%f)\n", dRate);
|
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_put_Rate(pos, dRate);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_get_Rate(IMediaPosition *iface, double *pdRate)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", pdRate);
|
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_get_Rate(pos, pdRate);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_CanSeekForward(IMediaPosition *iface, LONG *pCanSeekForward)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", pCanSeekForward);
|
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_CanSeekForward(pos, pCanSeekForward);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaPositionPassThru_CanSeekBackward(IMediaPosition *iface, LONG *pCanSeekBackward)
|
|
|
|
{
|
2020-03-13 03:34:09 +01:00
|
|
|
struct strmbase_passthrough *This = impl_from_IMediaPosition(iface);
|
2012-04-03 21:29:51 +02:00
|
|
|
IMediaPosition *pos;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", pCanSeekBackward);
|
|
|
|
|
|
|
|
hr = get_connected(This, &IID_IMediaPosition, (LPVOID*)&pos);
|
|
|
|
if (SUCCEEDED(hr)) {
|
|
|
|
hr = IMediaPosition_CanSeekBackward(pos, pCanSeekBackward);
|
|
|
|
IMediaPosition_Release(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_NOTIMPL;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IMediaPositionVtbl IMediaPositionPassThru_Vtbl =
|
|
|
|
{
|
|
|
|
MediaPositionPassThru_QueryInterface,
|
|
|
|
MediaPositionPassThru_AddRef,
|
|
|
|
MediaPositionPassThru_Release,
|
|
|
|
MediaPositionPassThru_GetTypeInfoCount,
|
|
|
|
MediaPositionPassThru_GetTypeInfo,
|
|
|
|
MediaPositionPassThru_GetIDsOfNames,
|
|
|
|
MediaPositionPassThru_Invoke,
|
|
|
|
MediaPositionPassThru_get_Duration,
|
|
|
|
MediaPositionPassThru_put_CurrentPosition,
|
|
|
|
MediaPositionPassThru_get_CurrentPosition,
|
|
|
|
MediaPositionPassThru_get_StopTime,
|
|
|
|
MediaPositionPassThru_put_StopTime,
|
|
|
|
MediaPositionPassThru_get_PrerollTime,
|
|
|
|
MediaPositionPassThru_put_PrerollTime,
|
|
|
|
MediaPositionPassThru_put_Rate,
|
|
|
|
MediaPositionPassThru_get_Rate,
|
|
|
|
MediaPositionPassThru_CanSeekForward,
|
|
|
|
MediaPositionPassThru_CanSeekBackward
|
|
|
|
};
|
2020-03-13 03:34:08 +01:00
|
|
|
|
2020-03-13 03:34:09 +01:00
|
|
|
void strmbase_passthrough_init(struct strmbase_passthrough *passthrough, IUnknown *outer)
|
2020-03-13 03:34:08 +01:00
|
|
|
{
|
|
|
|
memset(passthrough, 0, sizeof(*passthrough));
|
|
|
|
|
|
|
|
passthrough->outer_unk = outer;
|
|
|
|
passthrough->IMediaPosition_iface.lpVtbl = &IMediaPositionPassThru_Vtbl;
|
|
|
|
passthrough->IMediaSeeking_iface.lpVtbl = &IMediaSeekingPassThru_Vtbl;
|
|
|
|
passthrough->ISeekingPassThru_iface.lpVtbl = &ISeekingPassThru_Vtbl;
|
|
|
|
InitializeCriticalSection(&passthrough->time_cs);
|
2020-03-13 03:34:09 +01:00
|
|
|
passthrough->time_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": strmbase_passthrough.time_cs" );
|
2020-03-13 03:34:08 +01:00
|
|
|
}
|
|
|
|
|
2020-03-13 03:34:09 +01:00
|
|
|
void strmbase_passthrough_cleanup(struct strmbase_passthrough *passthrough)
|
2020-03-13 03:34:08 +01:00
|
|
|
{
|
|
|
|
passthrough->time_cs.DebugInfo->Spare[0] = 0;
|
|
|
|
DeleteCriticalSection(&passthrough->time_cs);
|
|
|
|
}
|
|
|
|
|
2020-03-13 03:34:10 +01:00
|
|
|
void strmbase_passthrough_update_time(struct strmbase_passthrough *passthrough, REFERENCE_TIME time)
|
|
|
|
{
|
|
|
|
EnterCriticalSection(&passthrough->time_cs);
|
|
|
|
passthrough->time_earliest = time;
|
|
|
|
passthrough->timevalid = TRUE;
|
|
|
|
LeaveCriticalSection(&passthrough->time_cs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void strmbase_passthrough_invalidate_time(struct strmbase_passthrough *passthrough)
|
|
|
|
{
|
|
|
|
EnterCriticalSection(&passthrough->time_cs);
|
|
|
|
passthrough->timevalid = FALSE;
|
|
|
|
LeaveCriticalSection(&passthrough->time_cs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void strmbase_passthrough_eos(struct strmbase_passthrough *passthrough)
|
|
|
|
{
|
|
|
|
REFERENCE_TIME time;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = IMediaSeeking_GetStopPosition(&passthrough->IMediaSeeking_iface, &time);
|
|
|
|
EnterCriticalSection(&passthrough->time_cs);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
passthrough->timevalid = TRUE;
|
|
|
|
passthrough->time_earliest = time;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
passthrough->timevalid = FALSE;
|
|
|
|
LeaveCriticalSection(&passthrough->time_cs);
|
|
|
|
}
|