VTK
vtkVideoSource.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVideoSource.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
31 #ifndef vtkVideoSource_h
32 #define vtkVideoSource_h
33 
34 #include "vtkIOVideoModule.h" // For export macro
35 #include "vtkImageAlgorithm.h"
36 
37 class vtkTimerLog;
38 class vtkCriticalSection;
39 class vtkMultiThreader;
40 class vtkScalarsToColors;
41 
43 {
44 public:
45  static vtkVideoSource *New();
47  void PrintSelf(ostream& os, vtkIndent indent);
48 
51  virtual void Record();
52 
55  virtual void Play();
56 
58  virtual void Stop();
59 
64  virtual void Rewind();
65 
68  virtual void FastForward();
69 
72  virtual void Seek(int n);
73 
75  virtual void Grab();
76 
78 
80  vtkGetMacro(Recording,int);
82 
84 
86  vtkGetMacro(Playing,int);
88 
90 
95  virtual void SetFrameSize(int x, int y, int z);
96  virtual void SetFrameSize(int dim[3]) {
97  this->SetFrameSize(dim[0], dim[1], dim[2]); };
98  vtkGetVector3Macro(FrameSize,int);
100 
102 
103  virtual void SetFrameRate(float rate);
104  vtkGetMacro(FrameRate,float);
106 
108 
110  virtual void SetOutputFormat(int format);
111  void SetOutputFormatToLuminance() { this->SetOutputFormat(VTK_LUMINANCE); };
112  void SetOutputFormatToRGB() { this->SetOutputFormat(VTK_RGB); };
113  void SetOutputFormatToRGBA() { this->SetOutputFormat(VTK_RGBA); };
114  vtkGetMacro(OutputFormat,int);
116 
118 
120  virtual void SetFrameBufferSize(int FrameBufferSize);
121  vtkGetMacro(FrameBufferSize,int);
123 
125 
128  vtkSetMacro(NumberOfOutputFrames,int);
129  vtkGetMacro(NumberOfOutputFrames,int);
131 
133 
135  vtkBooleanMacro(AutoAdvance,int);
136  vtkSetMacro(AutoAdvance,int)
137  vtkGetMacro(AutoAdvance,int);
139 
141 
145  virtual void SetClipRegion(int r[6]) {
146  this->SetClipRegion(r[0],r[1],r[2],r[3],r[4],r[5]); };
147  virtual void SetClipRegion(int x0, int x1, int y0, int y1, int z0, int z1);
148  vtkGetVector6Macro(ClipRegion,int);
150 
152 
159  vtkSetVector6Macro(OutputWholeExtent,int);
160  vtkGetVector6Macro(OutputWholeExtent,int);
162 
164 
165  vtkSetVector3Macro(DataSpacing,double);
166  vtkGetVector3Macro(DataSpacing,double);
168 
170 
172  vtkSetVector3Macro(DataOrigin,double);
173  vtkGetVector3Macro(DataOrigin,double);
175 
177 
180  vtkSetMacro(Opacity,float);
181  vtkGetMacro(Opacity,float);
183 
185 
187  vtkGetMacro(FrameCount, int);
188  vtkSetMacro(FrameCount, int);
190 
192 
194  vtkGetMacro(FrameIndex, int);
196 
201  virtual double GetFrameTimeStamp(int frame);
202 
206  double GetFrameTimeStamp() { return this->FrameTimeStamp; };
207 
209 
211  virtual void Initialize();
212  virtual int GetInitialized() { return this->Initialized; };
214 
217  virtual void ReleaseSystemResources();
218 
222  virtual void InternalGrab();
223 
225 
227  void SetStartTimeStamp(double t) { this->StartTimeStamp = t; };
228  double GetStartTimeStamp() { return this->StartTimeStamp; };
230 
231 protected:
235 
237 
238  int FrameSize[3];
239  int ClipRegion[6];
240  int OutputWholeExtent[6];
241  double DataSpacing[3];
242  double DataOrigin[3];
244  // set according to the OutputFormat
246  // The FrameOutputExtent is the WholeExtent for a single output frame.
247  // It is initialized in ExecuteInformation.
248  int FrameOutputExtent[6];
249 
250  // save this information from the output so that we can see if the
251  // output scalars have changed
253  int LastOutputExtent[6];
254 
256  int Playing;
257  float FrameRate;
262 
265 
266  float Opacity;
267 
268  // true if Execute() must apply a vertical flip to each frame
270 
271  // set if output needs to be cleared to be cleared before being written
273 
274  // An example of asynchrony
277 
278  // A mutex for the frame buffer: must be applied when any of the
279  // below data is modified.
281 
282  // set according to the needs of the hardware:
283  // number of bits per framebuffer pixel
285  // byte alignment of each row in the framebuffer
287  // FrameBufferExtent is the extent of frame after it has been clipped
288  // with ClipRegion. It is initialized in CheckBuffer().
289  int FrameBufferExtent[6];
290 
293  void **FrameBuffer;
295 
297 
298  virtual void UpdateFrameBuffer();
299  virtual void AdvanceFrameBuffer(int n);
301  // if some component conversion is required, it is done here:
302  virtual void UnpackRasterLine(char *outPtr, char *rowPtr,
303  int start, int count);
305 
306 private:
307  vtkVideoSource(const vtkVideoSource&); // Not implemented.
308  void operator=(const vtkVideoSource&); // Not implemented.
309 };
310 
311 #endif
312 
313 
314 
315 
316 
vtkVideoSource::StartTimeStamp
double StartTimeStamp
Definition: vtkVideoSource.h:260
vtkVideoSource::Play
virtual void Play()
vtkVideoSource::AutoAdvance
int AutoAdvance
Definition: vtkVideoSource.h:263
vtkgl::z
GLdouble GLdouble z
Definition: vtkgl.h:11754
vtkGetVector6Macro
#define vtkGetVector6Macro(name, type)
Definition: vtkSetGet.h:380
vtkVideoSource::Opacity
float Opacity
Definition: vtkVideoSource.h:266
vtkVideoSource::FrameCount
int FrameCount
Definition: vtkVideoSource.h:258
vtkVideoSource::FrameTimeStamp
double FrameTimeStamp
Definition: vtkVideoSource.h:261
vtkgl::count
GLuint GLuint GLsizei count
Definition: vtkgl.h:11315
vtkVideoSource::PlayerThreader
vtkMultiThreader * PlayerThreader
Definition: vtkVideoSource.h:275
vtkSetVector3Macro
#define vtkSetVector3Macro(name, type)
Definition: vtkSetGet.h:287
vtkVideoSource::SetStartTimeStamp
void SetStartTimeStamp(double t)
Definition: vtkVideoSource.h:227
vtkVideoSource::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
VTKIOVIDEO_EXPORT
#define VTKIOVIDEO_EXPORT
Definition: vtkIOVideoModule.h:15
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkVideoSource::Rewind
virtual void Rewind()
vtkVideoSource::InternalGrab
virtual void InternalGrab()
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkgl::n
GLclampd n
Definition: vtkgl.h:14370
vtkVideoSource::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkImageAlgorithm.h
vtkVideoSource::GetStartTimeStamp
double GetStartTimeStamp()
Definition: vtkVideoSource.h:228
vtkVideoSource::FrameIndex
int FrameIndex
Definition: vtkVideoSource.h:259
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:40
vtkVideoSource::UnpackRasterLine
virtual void UnpackRasterLine(char *outPtr, char *rowPtr, int start, int count)
vtkVideoSource::Stop
virtual void Stop()
VTK_LUMINANCE
#define VTK_LUMINANCE
Definition: vtkSystemIncludes.h:93
vtkVideoSource::FrameBufferIndex
int FrameBufferIndex
Definition: vtkVideoSource.h:292
vtkMultiThreader
A class for performing multithreaded execution.
Definition: vtkMultiThreader.h:94
vtkVideoSource::Initialized
int Initialized
Definition: vtkVideoSource.h:236
vtkVideoSource::SetFrameBufferSize
virtual void SetFrameBufferSize(int FrameBufferSize)
vtkVideoSource::FrameBufferSize
int FrameBufferSize
Definition: vtkVideoSource.h:291
vtkVideoSource::PlayerThreadId
int PlayerThreadId
Definition: vtkVideoSource.h:276
vtkGetVector3Macro
#define vtkGetVector3Macro(name, type)
Definition: vtkSetGet.h:304
vtkVideoSource::FrameBuffer
void ** FrameBuffer
Definition: vtkVideoSource.h:293
VTK_RGB
#define VTK_RGB
Definition: vtkSystemIncludes.h:95
vtkVideoSource::ReleaseSystemResources
virtual void ReleaseSystemResources()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkgl::start
GLuint start
Definition: vtkgl.h:11315
vtkVideoSource::Playing
int Playing
Definition: vtkVideoSource.h:256
vtkVideoSource::New
static vtkVideoSource * New()
vtkVideoSource::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkVideoSource::SetOutputFormat
virtual void SetOutputFormat(int format)
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkVideoSource::NumberOfScalarComponents
int NumberOfScalarComponents
Definition: vtkVideoSource.h:245
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:63
vtkVideoSource::Grab
virtual void Grab()
vtkVideoSource::GetFrameTimeStamp
double GetFrameTimeStamp()
Definition: vtkVideoSource.h:206
vtkVideoSource::NumberOfOutputFrames
int NumberOfOutputFrames
Definition: vtkVideoSource.h:264
vtkVideoSource::FrameBufferBitsPerPixel
int FrameBufferBitsPerPixel
Definition: vtkVideoSource.h:284
vtkVideoSource::SetOutputFormatToLuminance
void SetOutputFormatToLuminance()
Definition: vtkVideoSource.h:111
vtkVideoSource::AdvanceFrameBuffer
virtual void AdvanceFrameBuffer(int n)
vtkVideoSource::SetOutputFormatToRGBA
void SetOutputFormatToRGBA()
Definition: vtkVideoSource.h:113
vtkVideoSource::OutputNeedsInitialization
int OutputNeedsInitialization
Definition: vtkVideoSource.h:272
vtkVideoSource::Seek
virtual void Seek(int n)
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
vtkVideoSource::SetClipRegion
virtual void SetClipRegion(int x0, int x1, int y0, int y1, int z0, int z1)
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkVideoSource::OutputFormat
int OutputFormat
Definition: vtkVideoSource.h:243
vtkTimerLog
Timer support and logging.
Definition: vtkTimerLog.h:82
vtkgl::t
GLdouble GLdouble t
Definition: vtkgl.h:11602
vtkVideoSource::FastForward
virtual void FastForward()
vtkgl::r
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
vtkVideoSource::~vtkVideoSource
~vtkVideoSource()
vtkVideoSource::FrameBufferMutex
vtkCriticalSection * FrameBufferMutex
Definition: vtkVideoSource.h:280
vtkVideoSource::SetFrameRate
virtual void SetFrameRate(float rate)
vtkVideoSource::vtkVideoSource
vtkVideoSource()
vtkgl::y
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
vtkVideoSource::SetFrameSize
virtual void SetFrameSize(int x, int y, int z)
vtkIOVideoModule.h
vtkVideoSource::Record
virtual void Record()
VTK_RGBA
#define VTK_RGBA
Definition: vtkSystemIncludes.h:96
vtkSetVector6Macro
#define vtkSetVector6Macro(name, type)
Definition: vtkSetGet.h:360
vtkCriticalSection
Critical section locking class.
Definition: vtkCriticalSection.h:43
vtkVideoSource::GetInitialized
virtual int GetInitialized()
Definition: vtkVideoSource.h:212
vtkVideoSource::FrameBufferRowAlignment
int FrameBufferRowAlignment
Definition: vtkVideoSource.h:286
vtkVideoSource::FlipFrames
int FlipFrames
Definition: vtkVideoSource.h:269
vtkVideoSource::LastNumberOfScalarComponents
int LastNumberOfScalarComponents
Definition: vtkVideoSource.h:252
vtkVideoSource::FrameBufferTimeStamps
double * FrameBufferTimeStamps
Definition: vtkVideoSource.h:294
vtkVideoSource::SetFrameSize
virtual void SetFrameSize(int dim[3])
Definition: vtkVideoSource.h:96
vtkVideoSource::GetFrameTimeStamp
virtual double GetFrameTimeStamp(int frame)
vtkVideoSource::Recording
int Recording
Definition: vtkVideoSource.h:255
vtkgl::format
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: vtkgl.h:11316
vtkVideoSource::Initialize
virtual void Initialize()
vtkVideoSource::FrameRate
float FrameRate
Definition: vtkVideoSource.h:257
vtkVideoSource::UpdateFrameBuffer
virtual void UpdateFrameBuffer()
vtkVideoSource::SetOutputFormatToRGB
void SetOutputFormatToRGB()
Definition: vtkVideoSource.h:112
vtkVideoSource
Superclass of video input devices for VTK.
Definition: vtkVideoSource.h:43