2009-02-09 21:15:56 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// File: SeekPT.cpp
|
|
|
|
//
|
|
|
|
// Desc: DirectShow base classes.
|
|
|
|
//
|
2018-04-28 16:52:15 +00:00
|
|
|
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
|
2009-02-09 21:15:56 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2018-04-28 16:52:15 +00:00
|
|
|
#include <streams.h>
|
2009-02-09 21:15:56 +00:00
|
|
|
#include "seekpt.h"
|
|
|
|
|
|
|
|
//==================================================================
|
|
|
|
// CreateInstance
|
|
|
|
// This goes in the factory template table to create new instances
|
|
|
|
// If there is already a mapper instance - return that, else make one
|
|
|
|
// and save it in a static variable so that forever after we can return that.
|
|
|
|
//==================================================================
|
|
|
|
|
2018-04-28 16:52:15 +00:00
|
|
|
CUnknown * CSeekingPassThru::CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
return new CSeekingPassThru(NAME("Seeking PassThru"),pUnk, phr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-28 16:52:15 +00:00
|
|
|
STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv)
|
2009-02-09 21:15:56 +00:00
|
|
|
{
|
|
|
|
if (riid == IID_ISeekingPassThru) {
|
|
|
|
return GetInterface((ISeekingPassThru *) this, ppv);
|
|
|
|
} else {
|
|
|
|
if (m_pPosPassThru &&
|
|
|
|
(riid == IID_IMediaSeeking ||
|
|
|
|
riid == IID_IMediaPosition)) {
|
|
|
|
return m_pPosPassThru->NonDelegatingQueryInterface(riid,ppv);
|
|
|
|
} else {
|
|
|
|
return CUnknown::NonDelegatingQueryInterface(riid, ppv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-04-28 16:52:15 +00:00
|
|
|
CSeekingPassThru::CSeekingPassThru( __in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr )
|
2009-02-09 21:15:56 +00:00
|
|
|
: CUnknown(pName, pUnk, phr),
|
|
|
|
m_pPosPassThru(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CSeekingPassThru::~CSeekingPassThru()
|
|
|
|
{
|
|
|
|
delete m_pPosPassThru;
|
|
|
|
}
|
|
|
|
|
|
|
|
STDMETHODIMP CSeekingPassThru::Init(BOOL bRendererSeeking, IPin *pPin)
|
|
|
|
{
|
|
|
|
HRESULT hr = NOERROR;
|
|
|
|
if (m_pPosPassThru) {
|
|
|
|
hr = E_FAIL;
|
|
|
|
} else {
|
|
|
|
m_pPosPassThru =
|
|
|
|
bRendererSeeking ?
|
|
|
|
new CRendererPosPassThru(
|
|
|
|
NAME("Render Seeking COM object"),
|
|
|
|
(IUnknown *)this,
|
|
|
|
&hr,
|
|
|
|
pPin) :
|
|
|
|
new CPosPassThru(
|
|
|
|
NAME("Render Seeking COM object"),
|
|
|
|
(IUnknown *)this,
|
|
|
|
&hr,
|
|
|
|
pPin);
|
|
|
|
if (!m_pPosPassThru) {
|
|
|
|
hr = E_OUTOFMEMORY;
|
|
|
|
} else {
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
delete m_pPosPassThru;
|
|
|
|
m_pPosPassThru = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|