00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #ifndef QVCAMERABLOCK_H
00026 #define QVCAMERABLOCK_H
00027
00028 #include <QVProcessingBlock>
00029 #include <QVImage>
00030
00086 class QVVideoReaderBlock: public QVProcessingBlock
00087 {
00088 Q_OBJECT
00089 public:
00090
00092 typedef enum { Closed, Running, RunningOneStep, Paused } TCameraStatus;
00093
00095 typedef enum { SeekCurrent = 0, SeekPercentage = 1, SeekAbsolute = 2 } TSeekType;
00096
00100 QVVideoReaderBlock(QString name = QString(""));
00101
00103 ~QVVideoReaderBlock();
00104
00115 bool linkProperty(QVPropertyContainer *dstCont, QString dstProp);
00116
00129 bool linkProperty(QVPropertyContainer *dstCont, QString dstProp1, QString dstProp2, QString dstProp3);
00130
00131 protected:
00132 bool realTime, noLoop;
00133
00146 virtual bool open(QString urlName, int &cols, int &rows, int &fps) = 0;
00147
00151 virtual void close() = 0;
00152
00162 virtual bool grab(QVImage<uChar,1> &imgY, QVImage<uChar,1> &imgU, QVImage<uChar,1> &imgV) = 0;
00163
00169 virtual double lengthOfVideo() = 0;
00170
00174 virtual double currentPos() = 0;
00175
00176 private slots:
00180 virtual void setCurrentPos(double time_pos) = 0;
00181
00186 void reopen();
00187
00191 void reset();
00192
00193 void grabFrame();
00194
00195 void nothing() { };
00196
00197 private:
00198 bool flush_pending_images;
00199 QString urlName;
00200 QVImage<uChar,1> imageY, imageU, imageV;
00201
00202 void tryOpeningCam();
00203 void iterate();
00204 void connectOrDisconnectLinkedBlocks(bool connect_disconnect);
00205
00206 signals:
00208 void opened();
00209
00211 void closed();
00212
00214 void grabbed();
00215
00216 };
00217
00218 #endif