Commit 026037ab authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

strmbase: Move the MediaSeekingPassThru functions from quartz into strmbase.

parent 945c5bba
...@@ -7,7 +7,6 @@ C_SRCS = \ ...@@ -7,7 +7,6 @@ C_SRCS = \
acmwrapper.c \ acmwrapper.c \
avidec.c \ avidec.c \
avisplit.c \ avisplit.c \
control.c \
dsoundrender.c \ dsoundrender.c \
enumfilters.c \ enumfilters.c \
enummedia.c \ enummedia.c \
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
*/ */
#include "quartz_private.h" #include "quartz_private.h"
#include "control_private.h"
#include "pin.h" #include "pin.h"
#include "uuids.h" #include "uuids.h"
......
/*
* Filter Seeking and Control Interfaces
*
* Copyright 2003 Robert Shearman
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef QUARTZ_CONTROL_H
#define QUARTZ_CONTROL_H
void MediaSeekingPassThru_RegisterMediaTime(IUnknown *iface, REFERENCE_TIME start);
void MediaSeekingPassThru_ResetMediaTime(IUnknown *iface);
void MediaSeekingPassThru_EOS(IUnknown *iface);
#endif /*QUARTZ_CONTROL_H*/
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "config.h" #include "config.h"
#include "quartz_private.h" #include "quartz_private.h"
#include "control_private.h"
#include "pin.h" #include "pin.h"
#include "uuids.h" #include "uuids.h"
...@@ -538,19 +537,17 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -538,19 +537,17 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
ISeekingPassThru *passthru;
pDSoundRender->state_change = CreateEventW(NULL, TRUE, TRUE, NULL); pDSoundRender->state_change = CreateEventW(NULL, TRUE, TRUE, NULL);
pDSoundRender->blocked = CreateEventW(NULL, TRUE, TRUE, NULL); pDSoundRender->blocked = CreateEventW(NULL, TRUE, TRUE, NULL);
hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown*)pDSoundRender, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pDSoundRender->seekthru_unk);
hr = CreatePosPassThru((IUnknown*)pDSoundRender, TRUE, (IPin*)pDSoundRender->pInputPin, &pDSoundRender->seekthru_unk);
if (!pDSoundRender->state_change || !pDSoundRender->blocked || FAILED(hr)) if (!pDSoundRender->state_change || !pDSoundRender->blocked || FAILED(hr))
{ {
IUnknown_Release((IUnknown *)pDSoundRender); IUnknown_Release((IUnknown *)pDSoundRender);
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
} }
IUnknown_QueryInterface(pDSoundRender->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
ISeekingPassThru_Init(passthru, TRUE, (IPin*)pDSoundRender->pInputPin);
ISeekingPassThru_Release(passthru);
QualityControlImpl_init(&pDSoundRender->qcimpl, (IPin*)pDSoundRender->pInputPin, (IBaseFilter*)pDSoundRender); QualityControlImpl_init(&pDSoundRender->qcimpl, (IPin*)pDSoundRender->pInputPin, (IBaseFilter*)pDSoundRender);
pDSoundRender->qcimpl.lpVtbl = &DSoundRender_QualityControl_Vtbl; pDSoundRender->qcimpl.lpVtbl = &DSoundRender_QualityControl_Vtbl;
*ppv = pDSoundRender; *ppv = pDSoundRender;
......
...@@ -39,6 +39,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) ...@@ -39,6 +39,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
return QUARTZ_DllMain( hInstDLL, fdwReason, lpv ); return QUARTZ_DllMain( hInstDLL, fdwReason, lpv );
} }
HRESULT SeekingPassThru_create(IUnknown *pUnkOuter, LPVOID *ppObj)
{
return PosPassThru_Construct(pUnkOuter,ppObj); /* from strmbase */
}
/****************************************************************************** /******************************************************************************
* DirectShow ClassFactory * DirectShow ClassFactory
*/ */
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <math.h> #include <math.h>
#include "quartz_private.h" #include "quartz_private.h"
#include "control_private.h"
#include "pin.h" #include "pin.h"
#include "uuids.h" #include "uuids.h"
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#define NONAMELESSUNION #define NONAMELESSUNION
#include "quartz_private.h" #include "quartz_private.h"
#include "control_private.h"
#include "pin.h" #include "pin.h"
#include "uuids.h" #include "uuids.h"
...@@ -148,15 +147,11 @@ HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -148,15 +147,11 @@ HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
ISeekingPassThru *passthru; hr = CreatePosPassThru(pUnkOuter ? pUnkOuter : (IUnknown*)&pNullRenderer->IInner_vtbl, TRUE, (IPin*)pNullRenderer->pInputPin, &pNullRenderer->seekthru_unk);
hr = CoCreateInstance(&CLSID_SeekingPassThru, pUnkOuter ? pUnkOuter : (IUnknown*)&pNullRenderer->IInner_vtbl, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pNullRenderer->seekthru_unk);
if (FAILED(hr)) { if (FAILED(hr)) {
IUnknown_Release((IUnknown*)pNullRenderer); IUnknown_Release((IUnknown*)pNullRenderer);
return hr; return hr;
} }
IUnknown_QueryInterface(pNullRenderer->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
ISeekingPassThru_Init(passthru, TRUE, (IPin*)pNullRenderer->pInputPin);
ISeekingPassThru_Release(passthru);
*ppv = pNullRenderer; *ppv = pNullRenderer;
} }
else else
......
...@@ -56,7 +56,6 @@ HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC ...@@ -56,7 +56,6 @@ HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC
HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN; HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC_HIDDEN;
HRESULT SeekingPassThru_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum) DECLSPEC_HIDDEN; HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum) DECLSPEC_HIDDEN;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#define NONAMELESSUNION #define NONAMELESSUNION
#include "quartz_private.h" #include "quartz_private.h"
#include "control_private.h"
#include "pin.h" #include "pin.h"
#include "uuids.h" #include "uuids.h"
...@@ -545,7 +544,6 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -545,7 +544,6 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
HRESULT hr; HRESULT hr;
PIN_INFO piInput; PIN_INFO piInput;
VideoRendererImpl * pVideoRenderer; VideoRendererImpl * pVideoRenderer;
ISeekingPassThru *passthru;
TRACE("(%p, %p)\n", pUnkOuter, ppv); TRACE("(%p, %p)\n", pUnkOuter, ppv);
...@@ -580,14 +578,12 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -580,14 +578,12 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = CoCreateInstance(&CLSID_SeekingPassThru, pUnkOuter ? pUnkOuter : (IUnknown*)&pVideoRenderer->IInner_vtbl, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pVideoRenderer->seekthru_unk); hr = CreatePosPassThru(pUnkOuter ? pUnkOuter : (IUnknown*)&pVideoRenderer->IInner_vtbl, TRUE, (IPin*)pVideoRenderer->pInputPin, &pVideoRenderer->seekthru_unk);
if (FAILED(hr)) { if (FAILED(hr)) {
IPin_Release((IPin*)pVideoRenderer->pInputPin); IPin_Release((IPin*)pVideoRenderer->pInputPin);
goto fail; goto fail;
} }
IUnknown_QueryInterface(pVideoRenderer->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
ISeekingPassThru_Init(passthru, TRUE, (IPin*)pVideoRenderer->pInputPin);
ISeekingPassThru_Release(passthru);
pVideoRenderer->sample_held = NULL; pVideoRenderer->sample_held = NULL;
*ppv = pVideoRenderer; *ppv = pVideoRenderer;
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
*/ */
#include "quartz_private.h" #include "quartz_private.h"
#include "control_private.h"
#include "pin.h" #include "pin.h"
#include "uuids.h" #include "uuids.h"
......
...@@ -7,6 +7,7 @@ C_SRCS = \ ...@@ -7,6 +7,7 @@ C_SRCS = \
mediatype.c \ mediatype.c \
outputqueue.c \ outputqueue.c \
pin.c \ pin.c \
pospass.c \
qualitycontrol.c \ qualitycontrol.c \
seeking.c \ seeking.c \
transform.c transform.c
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* Filter Seeking and Control Interfaces * Filter Seeking and Control Interfaces
* *
* Copyright 2003 Robert Shearman * Copyright 2003 Robert Shearman
* Copyright 2012 Aric Stewart, CodeWeavers
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -19,15 +20,19 @@ ...@@ -19,15 +20,19 @@
*/ */
/* FIXME: critical sections */ /* FIXME: critical sections */
#include "quartz_private.h" #define COBJMACROS
#include "control_private.h"
#include "dshow.h"
#include "uuids.h" #include "uuids.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/strmbase.h"
#include <assert.h> #include <assert.h>
WINE_DEFAULT_DEBUG_CHANNEL(quartz); WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
static const IMediaSeekingVtbl IMediaSeekingPassThru_Vtbl; static const IMediaSeekingVtbl IMediaSeekingPassThru_Vtbl;
...@@ -200,13 +205,27 @@ static const ISeekingPassThruVtbl ISeekingPassThru_Vtbl = ...@@ -200,13 +205,27 @@ static const ISeekingPassThruVtbl ISeekingPassThru_Vtbl =
SeekingPassThru_Init SeekingPassThru_Init
}; };
HRESULT SeekingPassThru_create(IUnknown *pUnkOuter, LPVOID *ppObj) HRESULT WINAPI CreatePosPassThru(IUnknown* pUnkOuter, BOOL bRenderer, IPin *pPin, IUnknown **ppPassThru)
{
HRESULT hr;
ISeekingPassThru *passthru;
hr = CoCreateInstance(&CLSID_SeekingPassThru, pUnkOuter, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)ppPassThru);
IUnknown_QueryInterface(*ppPassThru, &IID_ISeekingPassThru, (void**)&passthru);
hr = ISeekingPassThru_Init(passthru, bRenderer, pPin);
ISeekingPassThru_Release(passthru);
return hr;
}
HRESULT WINAPI PosPassThru_Construct(IUnknown *pUnkOuter, LPVOID *ppPassThru)
{ {
PassThruImpl *fimpl; PassThruImpl *fimpl;
TRACE("(%p,%p)\n", pUnkOuter, ppObj); TRACE("(%p,%p)\n", pUnkOuter, ppPassThru);
*ppObj = fimpl = CoTaskMemAlloc(sizeof(*fimpl)); *ppPassThru = fimpl = CoTaskMemAlloc(sizeof(*fimpl));
if (!fimpl) if (!fimpl)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -302,7 +321,7 @@ static HRESULT WINAPI MediaSeekingPassThru_IsFormatSupported(IMediaSeeking * ifa ...@@ -302,7 +321,7 @@ static HRESULT WINAPI MediaSeekingPassThru_IsFormatSupported(IMediaSeeking * ifa
ICOM_THIS_MULTI(PassThruImpl, IMediaSeeking_vtbl, iface); ICOM_THIS_MULTI(PassThruImpl, IMediaSeeking_vtbl, iface);
IMediaSeeking *seek; IMediaSeeking *seek;
HRESULT hr; HRESULT hr;
TRACE("(%p/%p)->(%s)\n", iface, This, qzdebugstr_guid(pFormat)); TRACE("(%p/%p)->(%s)\n", iface, This, debugstr_guid(pFormat));
hr = get_connected(This, &seek); hr = get_connected(This, &seek);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
hr = IMediaSeeking_IsFormatSupported(seek, pFormat); hr = IMediaSeeking_IsFormatSupported(seek, pFormat);
...@@ -350,7 +369,7 @@ static HRESULT WINAPI MediaSeekingPassThru_IsUsingTimeFormat(IMediaSeeking * ifa ...@@ -350,7 +369,7 @@ static HRESULT WINAPI MediaSeekingPassThru_IsUsingTimeFormat(IMediaSeeking * ifa
ICOM_THIS_MULTI(PassThruImpl, IMediaSeeking_vtbl, iface); ICOM_THIS_MULTI(PassThruImpl, IMediaSeeking_vtbl, iface);
IMediaSeeking *seek; IMediaSeeking *seek;
HRESULT hr; HRESULT hr;
TRACE("(%p/%p)->(%s)\n", iface, This, qzdebugstr_guid(pFormat)); TRACE("(%p/%p)->(%s)\n", iface, This, debugstr_guid(pFormat));
hr = get_connected(This, &seek); hr = get_connected(This, &seek);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
hr = IMediaSeeking_IsUsingTimeFormat(seek, pFormat); hr = IMediaSeeking_IsUsingTimeFormat(seek, pFormat);
...@@ -366,7 +385,7 @@ static HRESULT WINAPI MediaSeekingPassThru_SetTimeFormat(IMediaSeeking * iface, ...@@ -366,7 +385,7 @@ static HRESULT WINAPI MediaSeekingPassThru_SetTimeFormat(IMediaSeeking * iface,
ICOM_THIS_MULTI(PassThruImpl, IMediaSeeking_vtbl, iface); ICOM_THIS_MULTI(PassThruImpl, IMediaSeeking_vtbl, iface);
IMediaSeeking *seek; IMediaSeeking *seek;
HRESULT hr; HRESULT hr;
TRACE("(%p/%p)->(%s)\n", iface, This, qzdebugstr_guid(pFormat)); TRACE("(%p/%p)->(%s)\n", iface, This, debugstr_guid(pFormat));
hr = get_connected(This, &seek); hr = get_connected(This, &seek);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
hr = IMediaSeeking_SetTimeFormat(seek, pFormat); hr = IMediaSeeking_SetTimeFormat(seek, pFormat);
...@@ -548,22 +567,27 @@ static HRESULT WINAPI MediaSeekingPassThru_GetPreroll(IMediaSeeking * iface, LON ...@@ -548,22 +567,27 @@ static HRESULT WINAPI MediaSeekingPassThru_GetPreroll(IMediaSeeking * iface, LON
return hr; return hr;
} }
void MediaSeekingPassThru_RegisterMediaTime(IUnknown *iface, REFERENCE_TIME start) { HRESULT WINAPI MediaSeekingPassThru_RegisterMediaTime(IUnknown *iface, REFERENCE_TIME start)
{
ICOM_THIS_MULTI(PassThruImpl, IInner_vtbl, iface); ICOM_THIS_MULTI(PassThruImpl, IInner_vtbl, iface);
EnterCriticalSection(&This->time_cs); EnterCriticalSection(&This->time_cs);
This->time_earliest = start; This->time_earliest = start;
This->timevalid = 1; This->timevalid = 1;
LeaveCriticalSection(&This->time_cs); LeaveCriticalSection(&This->time_cs);
return S_OK;
} }
void MediaSeekingPassThru_ResetMediaTime(IUnknown *iface) { HRESULT WINAPI MediaSeekingPassThru_ResetMediaTime(IUnknown *iface)
{
ICOM_THIS_MULTI(PassThruImpl, IInner_vtbl, iface); ICOM_THIS_MULTI(PassThruImpl, IInner_vtbl, iface);
EnterCriticalSection(&This->time_cs); EnterCriticalSection(&This->time_cs);
This->timevalid = 0; This->timevalid = 0;
LeaveCriticalSection(&This->time_cs); LeaveCriticalSection(&This->time_cs);
return S_OK;
} }
void MediaSeekingPassThru_EOS(IUnknown *iface) { HRESULT WINAPI MediaSeekingPassThru_EOS(IUnknown *iface)
{
ICOM_THIS_MULTI(PassThruImpl, IInner_vtbl, iface); ICOM_THIS_MULTI(PassThruImpl, IInner_vtbl, iface);
REFERENCE_TIME time; REFERENCE_TIME time;
HRESULT hr; HRESULT hr;
...@@ -575,6 +599,7 @@ void MediaSeekingPassThru_EOS(IUnknown *iface) { ...@@ -575,6 +599,7 @@ void MediaSeekingPassThru_EOS(IUnknown *iface) {
} else } else
This->timevalid = 0; This->timevalid = 0;
LeaveCriticalSection(&This->time_cs); LeaveCriticalSection(&This->time_cs);
return hr;
} }
static const IMediaSeekingVtbl IMediaSeekingPassThru_Vtbl = static const IMediaSeekingVtbl IMediaSeekingPassThru_Vtbl =
......
...@@ -320,6 +320,14 @@ HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate); ...@@ -320,6 +320,14 @@ HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate);
HRESULT WINAPI SourceSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate); HRESULT WINAPI SourceSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate);
HRESULT WINAPI SourceSeekingImpl_GetPreroll(IMediaSeeking * iface, LONGLONG * pPreroll); HRESULT WINAPI SourceSeekingImpl_GetPreroll(IMediaSeeking * iface, LONGLONG * pPreroll);
/* PosPassThru */
HRESULT WINAPI MediaSeekingPassThru_RegisterMediaTime(IUnknown *iface, REFERENCE_TIME start);
HRESULT WINAPI MediaSeekingPassThru_ResetMediaTime(IUnknown *iface);
HRESULT WINAPI MediaSeekingPassThru_EOS(IUnknown *iface);
HRESULT WINAPI CreatePosPassThru(IUnknown* pUnkOuter, BOOL bRenderer, IPin *pPin, IUnknown **ppPassThru);
HRESULT WINAPI PosPassThru_Construct(IUnknown* pUnkOuter, LPVOID *ppPassThru);
/* Filter Registration */ /* Filter Registration */
typedef REGPINTYPES AMOVIESETUP_MEDIATYPE; typedef REGPINTYPES AMOVIESETUP_MEDIATYPE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment