Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cVidCapDirect.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cVidCapDirect_H
7 #define _INC_cVidCapDirect_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cDirectShow.h"
13 
14 #if defined(USE_DX_SHOW)
15 #include "../Image/cSurface.h"
17 
18 MIDL_INTERFACE("56a86895-0ad4-11ce-b03a-0020af0ba770") IBaseFilter;
19 MIDL_INTERFACE("56a868b4-0ad4-11ce-b03a-0020af0ba770") IVideoWindow;
20 MIDL_INTERFACE("93E5A4E0-2D50-11d2-ABFA-00A0C9C6E38D") ICaptureGraphBuilder2;
21 MIDL_INTERFACE("36b73882-c2c8-11cf-8b46-00805f6cef60") IFilterGraph2; // derived from IGraphBuilder
22 MIDL_INTERFACE("56a86891-0ad4-11ce-b03a-0020af0ba770") IPin;
23 MIDL_INTERFACE("6B652FFF-11FE-4fce-92AD-0266B5D7C78F") ISampleGrabber;
24 enum _PinDirection;
25 
26 namespace GrayLib
27 {
28  class GRAYLIB_LINK cDirectSampleGrabberCB;
29 
30  class GRAYLIB_LINK cVidCapDirect : public cDirectShowObj
31  {
39 
40  friend class cDirectSampleGrabberCB;
41  typedef cDirectShowObj SUPER_t;
42 
43  protected:
44  cIUnkPtr<IBaseFilter> m_pSource;
45  cIUnkPtr<ISampleGrabber> m_pGrabber;
46  cIUnkPtr<IUnknown> m_pGrabberCB;
47  cIUnkPtr<ICaptureGraphBuilder2> m_pCapture;
48 
49  REFTIME m_dblSampleTime;
50  cSurface m_Surf;
51  mutable cThreadLockCount m_LockSurf;
52 
53  protected:
54  HRESULT FindPin(IBaseFilter* pFilter, enum _PinDirection dirrequired, int nPinNum, cIUnkPtr<IPin>& rpPin);
55  HRESULT FindPinIn(IBaseFilter* pFilter, int nPinNum, cIUnkPtr<IPin>& rpPin);
56  HRESULT FindPinOut(IBaseFilter* pFilter, int nPinNum, cIUnkPtr<IPin>& rpPin);
57 
58  public:
59  cVidCapDirect(IBaseFilter* pSource = nullptr);
60  virtual ~cVidCapDirect();
61 
62  REFTIME get_SampleTime() const
63  {
65  return m_dblSampleTime;
66  }
67 
68  void put_Source(IBaseFilter* pSource);
69  const cSurface& get_Surf() const
70  {
72  return m_Surf; // cSurfaceInfo and pixel data.
73  }
74 
75  // HRESULT AddCaptureMonikerToGraph(IMoniker *pMoniker);
76  HRESULT CreateVidCap(bool bOneShot);
77  void CleanUp();
78  virtual HRESULT GrabSample(cSurfaceBase& SurfCopy, bool bConvert = false);
79 
80  UNITTEST_FRIEND(cVidCapDirect);
81  };
82 }
83 #endif
84 #endif // _WIN32
MIDL_INTERFACE("7ED943DD-52E8-40b5-A8D8-76685C406330") ID3DXBaseMesh
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
Definition: cMesh.h:22
cThreadLockStub cThreadLockCount
Definition: cThreadLock.h:514
template class __DECL_IMPORT cIUnkPtr< IUnknown >
Definition: cIUnkPtr.h:315