Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Hybrid/vtkVideoSource.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkVideoSource.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserved. 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 00015 =========================================================================*/ 00035 #ifndef __vtkVideoSource_h 00036 #define __vtkVideoSource_h 00037 00038 #include "vtkImageSource.h" 00039 00040 class vtkTimerLog; 00041 class vtkCriticalSection; 00042 class vtkMultiThreader; 00043 class vtkScalarsToColors; 00044 00045 class VTK_HYBRID_EXPORT vtkVideoSource : public vtkImageSource 00046 { 00047 public: 00048 static vtkVideoSource *New(); 00049 vtkTypeRevisionMacro(vtkVideoSource,vtkImageSource); 00050 void PrintSelf(ostream& os, vtkIndent indent); 00051 00054 virtual void Record(); 00055 00058 virtual void Play(); 00059 00061 virtual void Stop(); 00062 00067 virtual void Rewind(); 00068 00071 virtual void FastForward(); 00072 00075 virtual void Seek(int n); 00076 00078 virtual void Grab(); 00079 00081 00083 vtkGetMacro(Recording,int); 00085 00087 00089 vtkGetMacro(Playing,int); 00091 00093 00098 virtual void SetFrameSize(int x, int y, int z); 00099 virtual void SetFrameSize(int dim[3]) { 00100 this->SetFrameSize(dim[0], dim[1], dim[2]); }; 00101 vtkGetVector3Macro(FrameSize,int); 00103 00105 00106 virtual void SetFrameRate(float rate); 00107 vtkGetMacro(FrameRate,float); 00109 00111 00113 virtual void SetOutputFormat(int format); 00114 void SetOutputFormatToLuminance() { this->SetOutputFormat(VTK_LUMINANCE); }; 00115 void SetOutputFormatToRGB() { this->SetOutputFormat(VTK_RGB); }; 00116 void SetOutputFormatToRGBA() { this->SetOutputFormat(VTK_RGBA); }; 00117 vtkGetMacro(OutputFormat,int); 00119 00121 00123 virtual void SetFrameBufferSize(int FrameBufferSize); 00124 vtkGetMacro(FrameBufferSize,int); 00126 00128 00131 vtkSetMacro(NumberOfOutputFrames,int); 00132 vtkGetMacro(NumberOfOutputFrames,int); 00134 00136 00138 vtkBooleanMacro(AutoAdvance,int); 00139 vtkSetMacro(AutoAdvance,int) 00140 vtkGetMacro(AutoAdvance,int); 00142 00144 00148 virtual void SetClipRegion(int r[6]) { 00149 this->SetClipRegion(r[0],r[1],r[2],r[3],r[4],r[5]); }; 00150 virtual void SetClipRegion(int x0, int x1, int y0, int y1, int z0, int z1); 00151 vtkGetVector6Macro(ClipRegion,int); 00153 00155 00162 vtkSetVector6Macro(OutputWholeExtent,int); 00163 vtkGetVector6Macro(OutputWholeExtent,int); 00165 00167 00168 vtkSetVector3Macro(DataSpacing,float); 00169 vtkGetVector3Macro(DataSpacing,float); 00171 00173 00175 vtkSetVector3Macro(DataOrigin,float); 00176 vtkGetVector3Macro(DataOrigin,float); 00178 00180 00183 vtkSetMacro(Opacity,float); 00184 vtkGetMacro(Opacity,float); 00186 00188 00190 vtkGetMacro(FrameCount, int); 00191 vtkSetMacro(FrameCount, int); 00193 00195 00197 vtkGetMacro(FrameIndex, int); 00199 00204 virtual double GetFrameTimeStamp(int frame); 00205 00209 double GetFrameTimeStamp() { return this->FrameTimeStamp; }; 00210 00212 00214 virtual void Initialize(); 00215 virtual int GetInitialized() { return this->Initialized; }; 00217 00220 virtual void ReleaseSystemResources(); 00221 00225 virtual void InternalGrab(); 00226 00228 00230 void SetStartTimeStamp(double t) { this->StartTimeStamp = t; }; 00231 double GetStartTimeStamp() { return this->StartTimeStamp; }; 00233 00234 protected: 00235 vtkVideoSource(); 00236 ~vtkVideoSource(); 00237 void ExecuteInformation(); 00238 00239 int Initialized; 00240 00241 int FrameSize[3]; 00242 int ClipRegion[6]; 00243 int OutputWholeExtent[6]; 00244 float DataSpacing[3]; 00245 float DataOrigin[3]; 00246 int OutputFormat; 00247 // set according to the OutputFormat 00248 int NumberOfScalarComponents; 00249 // The FrameOutputExtent is the WholeExtent for a single output frame. 00250 // It is initialized in ExecuteInformation. 00251 int FrameOutputExtent[6]; 00252 00253 // save this information from the output so that we can see if the 00254 // output scalars have changed 00255 int LastNumberOfScalarComponents; 00256 int LastOutputExtent[6]; 00257 00258 int Recording; 00259 int Playing; 00260 float FrameRate; 00261 int FrameCount; 00262 int FrameIndex; 00263 double StartTimeStamp; 00264 double FrameTimeStamp; 00265 00266 int AutoAdvance; 00267 int NumberOfOutputFrames; 00268 00269 float Opacity; 00270 00271 // true if Execute() must apply a vertical flip to each frame 00272 int FlipFrames; 00273 00274 // set if output needs to be cleared to be cleared before being written 00275 int OutputNeedsInitialization; 00276 00277 // An example of asynchrony 00278 vtkMultiThreader *PlayerThreader; 00279 int PlayerThreadId; 00280 00281 // A mutex for the frame buffer: must be applied when any of the 00282 // below data is modified. 00283 vtkCriticalSection *FrameBufferMutex; 00284 00285 // set according to the needs of the hardware: 00286 // number of bits per framebuffer pixel 00287 int FrameBufferBitsPerPixel; 00288 // byte alignment of each row in the framebuffer 00289 int FrameBufferRowAlignment; 00290 // FrameBufferExtent is the extent of frame after it has been clipped 00291 // with ClipRegion. It is initialized in CheckBuffer(). 00292 int FrameBufferExtent[6]; 00293 00294 int FrameBufferSize; 00295 int FrameBufferIndex; 00296 void **FrameBuffer; 00297 double *FrameBufferTimeStamps; 00298 00300 00301 virtual void UpdateFrameBuffer(); 00302 virtual void AdvanceFrameBuffer(int n); 00303 virtual void ExecuteData(vtkDataObject *data); 00304 // if some component conversion is required, it is done here: 00305 virtual void UnpackRasterLine(char *outPtr, char *rowPtr, 00306 int start, int count); 00308 00309 private: 00310 vtkVideoSource(const vtkVideoSource&); // Not implemented. 00311 void operator=(const vtkVideoSource&); // Not implemented. 00312 }; 00313 00314 #endif 00315 00316 00317 00318 00319