A Fast Bresenham Type Algorithm For Drawing Ellipses by John Kennedy
[xy_vsfilter.git] / src / filters / BaseClasses / seekpt.cpp
blobb1d9109d4cded34bc4c9f4a6a019d67f02d9e4ae
1 //------------------------------------------------------------------------------
2 // File: SeekPT.cpp
3 //
4 // Desc: DirectShow base classes.
5 //
6 // Copyright (c) 1992-2002 Microsoft Corporation. All rights reserved.
7 //------------------------------------------------------------------------------
10 #include <streams.h>
11 #include "seekpt.h"
13 //==================================================================
14 // CreateInstance
15 // This goes in the factory template table to create new instances
16 // If there is already a mapper instance - return that, else make one
17 // and save it in a static variable so that forever after we can return that.
18 //==================================================================
20 CUnknown * CSeekingPassThru::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr)
22 return new CSeekingPassThru(NAME("Seeking PassThru"),pUnk, phr);
26 STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, void ** ppv)
28 if (riid == IID_ISeekingPassThru) {
29 return GetInterface((ISeekingPassThru *) this, ppv);
30 } else {
31 if (m_pPosPassThru &&
32 (riid == IID_IMediaSeeking ||
33 riid == IID_IMediaPosition)) {
34 return m_pPosPassThru->NonDelegatingQueryInterface(riid,ppv);
35 } else {
36 return CUnknown::NonDelegatingQueryInterface(riid, ppv);
42 CSeekingPassThru::CSeekingPassThru( TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr )
43 : CUnknown(pName, pUnk, phr),
44 m_pPosPassThru(NULL)
49 CSeekingPassThru::~CSeekingPassThru()
51 delete m_pPosPassThru;
54 STDMETHODIMP CSeekingPassThru::Init(BOOL bRendererSeeking, IPin *pPin)
56 HRESULT hr = NOERROR;
57 if (m_pPosPassThru) {
58 hr = E_FAIL;
59 } else {
60 m_pPosPassThru =
61 bRendererSeeking ?
62 new CRendererPosPassThru(
63 NAME("Render Seeking COM object"),
64 (IUnknown *)this,
65 &hr,
66 pPin) :
67 new CPosPassThru(
68 NAME("Render Seeking COM object"),
69 (IUnknown *)this,
70 &hr,
71 pPin);
72 if (!m_pPosPassThru) {
73 hr = E_OUTOFMEMORY;
74 } else {
75 if (FAILED(hr)) {
76 delete m_pPosPassThru;
77 m_pPosPassThru = NULL;
81 return hr;