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 = \
acmwrapper.c \
avidec.c \
avisplit.c \
control.c \
dsoundrender.c \
enumfilters.c \
enummedia.c \
......
......@@ -30,7 +30,6 @@
*/
#include "quartz_private.h"
#include "control_private.h"
#include "pin.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 @@
#include "config.h"
#include "quartz_private.h"
#include "control_private.h"
#include "pin.h"
#include "uuids.h"
......@@ -538,19 +537,17 @@ HRESULT DSoundRender_create(IUnknown * pUnkOuter, LPVOID * ppv)
if (SUCCEEDED(hr))
{
ISeekingPassThru *passthru;
pDSoundRender->state_change = 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))
{
IUnknown_Release((IUnknown *)pDSoundRender);
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);
pDSoundRender->qcimpl.lpVtbl = &DSoundRender_QualityControl_Vtbl;
*ppv = pDSoundRender;
......
......@@ -39,6 +39,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
return QUARTZ_DllMain( hInstDLL, fdwReason, lpv );
}
HRESULT SeekingPassThru_create(IUnknown *pUnkOuter, LPVOID *ppObj)
{
return PosPassThru_Construct(pUnkOuter,ppObj); /* from strmbase */
}
/******************************************************************************
* DirectShow ClassFactory
*/
......
......@@ -25,7 +25,6 @@
#include <math.h>
#include "quartz_private.h"
#include "control_private.h"
#include "pin.h"
#include "uuids.h"
......
......@@ -24,7 +24,6 @@
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include "quartz_private.h"
#include "control_private.h"
#include "pin.h"
#include "uuids.h"
......@@ -148,15 +147,11 @@ HRESULT NullRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
if (SUCCEEDED(hr))
{
ISeekingPassThru *passthru;
hr = CoCreateInstance(&CLSID_SeekingPassThru, pUnkOuter ? pUnkOuter : (IUnknown*)&pNullRenderer->IInner_vtbl, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pNullRenderer->seekthru_unk);
hr = CreatePosPassThru(pUnkOuter ? pUnkOuter : (IUnknown*)&pNullRenderer->IInner_vtbl, TRUE, (IPin*)pNullRenderer->pInputPin, &pNullRenderer->seekthru_unk);
if (FAILED(hr)) {
IUnknown_Release((IUnknown*)pNullRenderer);
return hr;
}
IUnknown_QueryInterface(pNullRenderer->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
ISeekingPassThru_Init(passthru, TRUE, (IPin*)pNullRenderer->pInputPin);
ISeekingPassThru_Release(passthru);
*ppv = pNullRenderer;
}
else
......
......@@ -56,7 +56,6 @@ HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) DECLSPEC
HRESULT QUARTZ_CreateSystemClock(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 SeekingPassThru_create(IUnknown *pUnkOuter, LPVOID *ppObj) DECLSPEC_HIDDEN;
HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum) DECLSPEC_HIDDEN;
......
......@@ -23,7 +23,6 @@
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include "quartz_private.h"
#include "control_private.h"
#include "pin.h"
#include "uuids.h"
......@@ -545,7 +544,6 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
HRESULT hr;
PIN_INFO piInput;
VideoRendererImpl * pVideoRenderer;
ISeekingPassThru *passthru;
TRACE("(%p, %p)\n", pUnkOuter, ppv);
......@@ -580,14 +578,12 @@ HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
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)) {
IPin_Release((IPin*)pVideoRenderer->pInputPin);
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;
*ppv = pVideoRenderer;
}
......
......@@ -19,7 +19,6 @@
*/
#include "quartz_private.h"
#include "control_private.h"
#include "pin.h"
#include "uuids.h"
......
......@@ -7,6 +7,7 @@ C_SRCS = \
mediatype.c \
outputqueue.c \
pin.c \
pospass.c \
qualitycontrol.c \
seeking.c \
transform.c
......
......@@ -2,6 +2,7 @@
* Filter Seeking and Control Interfaces
*
* Copyright 2003 Robert Shearman
* Copyright 2012 Aric Stewart, CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,15 +20,19 @@
*/
/* FIXME: critical sections */
#include "quartz_private.h"
#include "control_private.h"
#define COBJMACROS
#include "dshow.h"
#include "uuids.h"
#include "wine/debug.h"
#include "wine/strmbase.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;
......@@ -200,13 +205,27 @@ static const ISeekingPassThruVtbl ISeekingPassThru_Vtbl =
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;
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
TRACE("(%p,%p)\n", pUnkOuter, ppPassThru);
*ppObj = fimpl = CoTaskMemAlloc(sizeof(*fimpl));
*ppPassThru = fimpl = CoTaskMemAlloc(sizeof(*fimpl));
if (!fimpl)
return E_OUTOFMEMORY;
......@@ -302,7 +321,7 @@ static HRESULT WINAPI MediaSeekingPassThru_IsFormatSupported(IMediaSeeking * ifa
ICOM_THIS_MULTI(PassThruImpl, IMediaSeeking_vtbl, iface);
IMediaSeeking *seek;
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);
if (SUCCEEDED(hr)) {
hr = IMediaSeeking_IsFormatSupported(seek, pFormat);
......@@ -350,7 +369,7 @@ static HRESULT WINAPI MediaSeekingPassThru_IsUsingTimeFormat(IMediaSeeking * ifa
ICOM_THIS_MULTI(PassThruImpl, IMediaSeeking_vtbl, iface);
IMediaSeeking *seek;
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);
if (SUCCEEDED(hr)) {
hr = IMediaSeeking_IsUsingTimeFormat(seek, pFormat);
......@@ -366,7 +385,7 @@ static HRESULT WINAPI MediaSeekingPassThru_SetTimeFormat(IMediaSeeking * iface,
ICOM_THIS_MULTI(PassThruImpl, IMediaSeeking_vtbl, iface);
IMediaSeeking *seek;
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);
if (SUCCEEDED(hr)) {
hr = IMediaSeeking_SetTimeFormat(seek, pFormat);
......@@ -548,22 +567,27 @@ static HRESULT WINAPI MediaSeekingPassThru_GetPreroll(IMediaSeeking * iface, LON
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);
EnterCriticalSection(&This->time_cs);
This->time_earliest = start;
This->timevalid = 1;
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);
EnterCriticalSection(&This->time_cs);
This->timevalid = 0;
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);
REFERENCE_TIME time;
HRESULT hr;
......@@ -575,6 +599,7 @@ void MediaSeekingPassThru_EOS(IUnknown *iface) {
} else
This->timevalid = 0;
LeaveCriticalSection(&This->time_cs);
return hr;
}
static const IMediaSeekingVtbl IMediaSeekingPassThru_Vtbl =
......
......@@ -320,6 +320,14 @@ HRESULT WINAPI SourceSeekingImpl_SetRate(IMediaSeeking * iface, double dRate);
HRESULT WINAPI SourceSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate);
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 */
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