pcsx2/3rdparty/baseclasses/seekpt.cpp
Jonathan Li ab9bdb009b baseclasses: Move from unfree to 3rdparty
Update it to the version found at
https://github.com/Microsoft/Windows-classic-samples , which is in an
MIT licensed repo, and add the LICENSE file (edited to remove the SIL
Open Font LICENSE part since that doesn't apply).

Some modifications have been made to reduce the diff/stop git
complaining (not including any file that wasn't in the previous version
and removing the related header includes in streams.h, and fixing some
but not all of the whitespace issues).
2018-04-29 02:19:17 +01:00

83 lines
2.4 KiB
C++

//------------------------------------------------------------------------------
// File: SeekPT.cpp
//
// Desc: DirectShow base classes.
//
// Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include <streams.h>
#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.
//==================================================================
CUnknown * CSeekingPassThru::CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
{
return new CSeekingPassThru(NAME("Seeking PassThru"),pUnk, phr);
}
STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv)
{
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);
}
}
}
CSeekingPassThru::CSeekingPassThru( __in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr )
: 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;
}