AJA NTV2 SDK  18.0.0.2717
NTV2 SDK 18.0.0.2717
seekpt.cpp
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // File: SeekPT.cpp
3 //
4 // Desc: DirectShow base classes.
5 //
6 // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
7 //------------------------------------------------------------------------------
8 
9 
10 #include <streams.h>
11 #include "seekpt.h"
12 
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 //==================================================================
19 
20 CUnknown * CSeekingPassThru::CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
21 {
22  return new CSeekingPassThru(NAME("Seeking PassThru"),pUnk, phr);
23 }
24 
25 
26 STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, __deref_out void ** ppv)
27 {
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 {
37  }
38  }
39 }
40 
41 
42 CSeekingPassThru::CSeekingPassThru( __in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr )
43  : CUnknown(pName, pUnk, phr),
44  m_pPosPassThru(NULL)
45 {
46 }
47 
48 
50 {
51  delete m_pPosPassThru;
52 }
53 
54 STDMETHODIMP CSeekingPassThru::Init(BOOL bRendererSeeking, IPin *pPin)
55 {
56  HRESULT hr = NOERROR;
57  if (m_pPosPassThru) {
58  hr = E_FAIL;
59  } else {
60  m_pPosPassThru =
61  bRendererSeeking ?
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;
78  }
79  }
80  }
81  return hr;
82 }
83 
CSeekingPassThru::~CSeekingPassThru
~CSeekingPassThru()
Definition: seekpt.cpp:49
CSeekingPassThru::Init
STDMETHODIMP Init(BOOL bSupportRendering, IPin *pPin)
Definition: seekpt.cpp:54
streams.h
NULL
#define NULL
Definition: ntv2caption608types.h:19
seekpt.h
CUnknown::NonDelegatingQueryInterface
STDMETHODIMP NonDelegatingQueryInterface(REFIID, __deref_out void **)
Definition: combase.cpp:135
NAME
#define NAME(_x_)
Definition: wxdebug.h:179
CRendererPosPassThru
Definition: ctlutil.h:367
CSeekingPassThru::NonDelegatingQueryInterface
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
Definition: seekpt.cpp:26
CSeekingPassThru::CSeekingPassThru
CSeekingPassThru(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
Definition: seekpt.cpp:42
CSeekingPassThru::CreateInstance
static CUnknown * CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
Definition: seekpt.cpp:20
pName
CHAR * pName
Definition: amvideo.cpp:26
riid
__in REFIID riid
Definition: dllentry.cpp:192
CPosPassThru::NonDelegatingQueryInterface
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
Definition: ctlutil.cpp:499
CUnknown
Definition: combase.h:200
CPosPassThru
Definition: ctlutil.h:299
GetInterface
STDAPI GetInterface(LPUNKNOWN pUnk, __out void **ppv)
Definition: combase.cpp:213
hr
__out HRESULT & hr
Definition: pstream.cpp:145