00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef VRS_AVIMAKER_H
00021 #define VRS_AVIMAKER_H
00022
00023 #include <vrs/config.h>
00024
00025 #include <vrs/sg/behaviornode.h>
00026 #include <vector>
00027
00028 namespace VRS {
00029
00030 class GLCanvas;
00031 class Image;
00032 class VideoCompressor;
00033
00034 template<typename T>
00035 class NonPersistentArray;
00036
00038 class VRS_CORE_API AVIMaker : public BehaviorNode {
00039 public:
00040 AVIMaker(GLCanvas* masterCanvas);
00041 AVIMaker(GLCanvas* masterCanvas, const std::string& filename, int frameRate = 20, bool highQuality = false, VideoCompressor* compressor = NULL);
00042 virtual ~AVIMaker();
00063 virtual BehaviorNode::InvalidationHint handle(Event* event);
00065
00066 void open(const std::string& filename, int frameRate=15, bool highQuality = false, VideoCompressor* compressor = NULL);
00070 void close();
00072
00073 bool isOpen() const;
00075
00076 GLCanvas* canvas() const;
00078 const std::string& filename() const;
00080 int frameRate() const;
00082 int currentFrameNo() const;
00084
00085 static Iterator<std::string>* availableCompressors();
00087 static VideoCompressor* getCompressor(const std::string& compressor);
00091 VRS_TYPEINFO(AVIMaker, BehaviorNode);
00092
00093
00094 private:
00095 std::string filename_;
00096 int frameRate_;
00097 int frameNo_;
00098 bool open_;
00099 bool highQuality_;
00100
00101 double lastRecording_;
00102 double delta_;
00103 SO<GLCanvas> canvas_;
00104 SO<Image> tmpImage_;
00105 SO<Image> frameImage_;
00106
00107 struct Impl;
00108 Impl *const impl_;
00109 };
00110
00114 class VRS_CORE_API VideoCompressor : public SharedObj {
00115 public:
00116 ~VideoCompressor();
00117 #ifdef WIN32
00118 bool hasAboutBox();
00120 bool showAboutBox();
00122 bool hasConfigBox();
00124 bool showConfigBox();
00126 std::string getName();
00128 std::string getShortName();
00130 std::string getDriverName();
00132 int getDriverVersion();
00134 #endif
00135 bool supportsQuality();
00137 int getQuality();
00139 void setQuality(int quality);
00143 friend class AVIMaker;
00144 private:
00145 VideoCompressor();
00146 static Iterator<std::string>* availableCompressors();
00147 static VideoCompressor* getCompressor(const std::string& compressor);
00148
00149 struct CompressorImpl;
00150 CompressorImpl* const impl_;
00151 };
00152
00153 }
00154
00155 #endif // VRS_AVIMAKER_H