Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cVidCapVFW.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cVidCapVFW_H
7 #define _INC_cVidCapVFW_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
13 
14 #if defined(_WIN32) && ! defined(UNDER_CE) && defined(_MSC_VER)
15 #include "../AV/cWaveFormat.h"
16 #include "../Windows/cWindow.h"
17 #include "../Image/cSurfaceInfo.h"
20 
21 struct tagCapStatus;
22 struct tagCapDriverCaps;
23 struct tagCapInfoChunk;
24 struct tagCaptureParms;
25 struct videohdr_tag;
26 
27 namespace GrayLib
28 {
29  class GRAYLIB_LINK cVidCapVFW : public cWindow
30  {
36  public:
37  cVidCapVFW(void);
38  virtual ~cVidCapVFW(void);
39 
40  static bool GRAYCALL GetDescription(UINT nCaptureDriverIndex, cString& sDeviceName, cString& sDeviceVersion);
41 
42  void CloseCapture();
43  HRESULT CreateCapture(DWORD dwStyle = WS_OVERLAPPED, const cRectI* pRect = nullptr, HWND hWndParent = HWND_DESKTOP, DLGID_t nID = 0);
44 
45  BOOL Abort();
46  BOOL Connect(int nCaptureDriverIndex);
47  BOOL Disconnect();
48  BOOL CaptureSequence();
49  BOOL Stop();
50  BOOL GetStatus(OUT struct tagCapStatus& status) const;
51  BOOL GetCaps(OUT struct tagCapDriverCaps& caps) const;
52  BOOL GetName(OUT cString& sName) const;
53  BOOL GetVersion(OUT cString& sVersion) const;
54  BOOL SetOverlay(BOOL bOverlay);
55  BOOL SetPreview(BOOL bPreview);
56  BOOL HasOverlay() const;
57  BOOL IsOverlay() const;
58  BOOL IsPreview() const;
59  BOOL SetPreviewRate(WORD wPreviewRate);
60  BOOL SetScale(BOOL bScale);
61  BOOL SetScroll(const CPoint& point);
62  BOOL HasVideoOutputDlg() const;
63  BOOL ShowVideoOutputDlg();
64  BOOL HasVideoFormatDlg() const;
65  BOOL ShowVideoFormatDlg();
66  BOOL HasVideoSourceDlg() const;
67  BOOL ShowVideoSourceDlg();
68  BOOL ShowCompressionDlg();
69  BOOL GetAudioFormat(cWaveFormatEx*& pWaveFormat, DWORD& dwSize) const;
70  BOOL SetAudioFormat(cWaveFormatEx* pWaveFormat);
71  BOOL SetAudioFormat(PCMWAVEFORMAT* pWaveFormat);
72  BOOL GetVideoFormat(cSurfaceBitmapInfo*& pBitmapInfo) const;
73  BOOL SetVideoFormat(cSurfaceBitmapInfo* pBitmapInfo);
74  BOOL FileAllocate(DWORD dwSize);
75  BOOL GetCaptureFile(cStringF& sFilename) const;
76  BOOL SaveAs(const cStringF& sFilename);
77  BOOL SetCaptureFile(const cStringF& sFilename);
78  BOOL CaptureNoFile();
79  BOOL SetMCIDevice(const cStringF& sName);
80  BOOL CaptureSingleFrame();
81  BOOL CaptureSingleFrameOpen();
82  BOOL CaptureSingleFrameClose();
83  BOOL EditCopy();
84  BOOL SaveDib(const CString& sFilename);
85  BOOL GrabSample();
86  BOOL GrabFrameNoStop();
87  BOOL SetInfoChunk(const struct tagCapInfoChunk* pInfoChunk);
88  DWORD GetUserData() const;
89  BOOL SetUserData(DWORD dwData);
90  BOOL AutoCreatePalette(int nFrames, int nColors);
91  BOOL ManualCreatePalette(BOOL bGrab, int nColors);
92  BOOL OpenPalette(const CString& sFilename);
93  BOOL PastePalette();
94  BOOL SavePalette(const CString& sFilename);
95  BOOL GetSetup(struct tagCaptureParms& params) const;
96  BOOL SetSetup(struct tagCaptureParms& params);
97 
98 #if 0
99  BOOL EnableCapControlCallback();
100  BOOL RemoveCapControlCallback();
101  BOOL EnableErrorCallback();
102  BOOL RemoveErrorCallback();
103  BOOL EnableFrameCallback();
104  BOOL RemoveFrameCallback();
105  BOOL EnableStatusCallback();
106  BOOL RemoveStatusCallback();
107  BOOL EnableVideoStreamCallback();
108  BOOL RemoveVideoStreamCallback();
109  BOOL EnableWaveStreamCallback();
110  BOOL RemoveWaveStreamCallback();
111  BOOL EnableYieldCallback();
112  BOOL RemoveYieldCallback();
113 
114  protected:
115  virtual LRESULT OnVideoStream(struct videohdr_tag* /* lpVHdr*/); // LPVIDEOHDR
116  virtual LRESULT OnWaveStream(struct wavehdr_tag* /* lpWHdr*/); // LPWAVEHDR
117  virtual LRESULT OnYield();
118  virtual LRESULT OnControl(int nState);
119  virtual LRESULT OnError(int nID, LPCTSTR lpsz);
120  virtual LRESULT OnFrame(struct videohdr_tag* /* lpVHdr*/);
121  virtual LRESULT OnStatus(int nID, LPCTSTR lpsz);
122 
123  static LRESULT CALLBACK _Control(HWND hWnd, int nState);
124  static LRESULT CALLBACK _Error(HWND hWnd, int nID, LPCTSTR lpsz);
125  static LRESULT CALLBACK _Frame(HWND hWnd, struct videohdr_tag* lpVHdr); // LPVIDEOHDR
126  static LRESULT CALLBACK _Yield(HWND hWnd);
127  static LRESULT CALLBACK _WaveStream(HWND hWnd, struct wavehdr_tag* lpWHdr); // LPWAVEHDR
128  static LRESULT CALLBACK _VideoStream(HWND hWnd, struct videohdr_tag* lpVHdr); // LPVIDEOHDR
129  static LRESULT CALLBACK _Status(HWND hWnd, int nID, LPCTSTR lpsz);
130 #endif
131 
132  UNITTEST_FRIEND(cVidCapVFW);
133  };
134 }
135 #endif
136 #endif
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#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
UINT DLGID_t
old window format this was a WORD, EX format this is UINT32.
Definition: cResDialog.h:68
cPoint2i CPoint
Compatible with MFC 2d CPoint,CRect.
Definition: cPoint2.h:65
cStringT< FILECHAR_t > cStringF
A file name. checks USE_UNICODE_FN. related to cFilePath.
Definition: cFilePath.h:17
cString CString
Definition: cString.h:639
cStringT< GChar_t > cString
Definition: cString.h:636
Definition: cWaveFormat.h:44