vtkWin32VideoSource.h 3.52 KB
Newer Older
1 2 3 4 5
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkWin32VideoSource.h

6
  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 8
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9

10 11
     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
     PURPOSE.  See the above copyright notice for more information.
13 14 15 16 17

=========================================================================*/
// .NAME vtkWin32VideoSource - Video-for-Windows video digitizer
// .SECTION Description
// vtkWin32VideoSource grabs frames or streaming video from a
18
// Video for Windows compatible device on the Win32 platform.
19
// .SECTION Caveats
20
// With some capture cards, if this class is leaked and ReleaseSystemResources
21 22 23 24
// is not called, you may have to reboot before you can capture again.
// vtkVideoSource used to keep a global list and delete the video sources
// if your program leaked, due to exit crashes that was removed.
//
25 26 27
// .SECTION See Also
// vtkVideoSource vtkMILVideoSource

28 29
#ifndef vtkWin32VideoSource_h
#define vtkWin32VideoSource_h
30

31
#include "vtkIOVideoModule.h" // For export macro
32
#include "vtkVideoSource.h"
33 34

class vtkWin32VideoSourceInternal;
35

36
class VTKIOVIDEO_EXPORT vtkWin32VideoSource : public vtkVideoSource
37 38 39
{
public:
  static vtkWin32VideoSource *New();
40
  vtkTypeMacro(vtkWin32VideoSource,vtkVideoSource);
41
  void PrintSelf(ostream& os, vtkIndent indent);
42 43

  // Description:
44 45
  // Standard VCR functionality: Record incoming video.
  void Record();
46

47 48
  // Description:
  // Standard VCR functionality: Play recorded video.
49
  void Play();
50 51 52

  // Description:
  // Standard VCR functionality: Stop recording or playing.
53 54
  void Stop();

55 56 57
  // Description:
  // Grab a single video frame.
  void Grab();
58

59 60
  // Description:
  // Request a particular frame size (set the third value to 1).
61
  void SetFrameSize(int x, int y, int z);
62
  virtual void SetFrameSize(int dim[3]) {
Ken Martin's avatar
Ken Martin committed
63
    this->SetFrameSize(dim[0], dim[1], dim[2]); };
64

65 66
  // Description:
  // Request a particular frame rate (default 30 frames per second).
67 68
  void SetFrameRate(float rate);

69 70
  // Description:
  // Request a particular output format (default: VTK_RGB).
71 72
  void SetOutputFormat(int format);

73
  // Description:
74
  // Turn on/off the preview (overlay) window.
75
  void SetPreview(int p);
76 77
  vtkBooleanMacro(Preview,int);
  vtkGetMacro(Preview,int);
78

79
  // Description:
80
  // Bring up a modal dialog box for video format selection.
81 82 83
  void VideoFormatDialog();

  // Description:
84
  // Bring up a modal dialog box for video input selection.
85 86
  void VideoSourceDialog();

87 88 89 90 91 92 93 94 95 96
  // Description:
  // Initialize the driver (this is called automatically when the
  // first grab is done).
  void Initialize();

  // Description:
  // Free the driver (this is called automatically inside the
  // destructor).
  void ReleaseSystemResources();

97 98
  // Description:
  // For internal use only
Ken Martin's avatar
Ken Martin committed
99
  void LocalInternalGrab(void*);
100
  void OnParentWndDestroy();
101 102 103 104 105 106 107

protected:
  vtkWin32VideoSource();
  ~vtkWin32VideoSource();

  char WndClassName[16];
  int BitMapSize;
108
  int Preview;
109

110 111
  vtkWin32VideoSourceInternal *Internal;

112
  void CheckBuffer();
113
  void UnpackRasterLine(char *outptr, char *inptr,
Brad King's avatar
Brad King committed
114
                        int start, int count);
115 116 117

  void DoVFWFormatSetup();
  void DoVFWFormatCheck();
118

119
private:
120
  vtkWin32VideoSource(const vtkWin32VideoSource&) VTK_DELETE_FUNCTION;
121
  void operator=(const vtkWin32VideoSource&) VTK_DELETE_FUNCTION;
122 123 124 125 126 127 128 129
};

#endif