src/qvcore/qvcamera.h

Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2007. PARP Research Group.
00003  *      <http://perception.inf.um.es>
00004  *      University of Murcia, Spain.
00005  *
00006  *      This file is part of the QVision library.
00007  *
00008  *      QVision is free software: you can redistribute it and/or modify
00009  *      it under the terms of the GNU Lesser General Public License as
00010  *      published by the Free Software Foundation, version 3 of the License.
00011  *
00012  *      QVision is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *      GNU Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with QVision. If not, see <http://www.gnu.org/licenses/>.
00019  */
00020 
00024 
00025 #ifndef QVCAMERA_H
00026 #define QVCAMERA_H
00027 
00028 #include <QObject>
00029 #include <QString>
00030 #include <QDebug>
00031 #include <qvcore/qvimage.h>
00032 #include <qvcore/qvpropertyholder.h>
00033 
00045 class QVCamera : public QObject, public QVPropertyHolder
00046 {
00048         Q_OBJECT
00049 public:
00050         QVCamera(QString name = QString());
00051         ~QVCamera();
00052 
00053         // Camera status:
00054         typedef enum {Closed, Running, RunningOneStep, Paused /*, EndOfFile */} TCameraStatus;
00055 
00057         typedef enum { SeekCurrent = 0, SeekPercentage = 1, SeekAbsolute = 2 } TSeekType;
00058 
00059         virtual bool openCam() = 0;
00060 
00061         //virtual bool isEndOfFile() const { return status == EndOfFile; };
00062 
00063         // Getter functions:
00064         virtual unsigned int getRows() const = 0;
00065         virtual unsigned int getCols() const = 0;
00066         virtual double getFPS() const = 0;
00067         virtual double getSpeed() const = 0;
00068         virtual unsigned int getFramesGrabbed() const = 0;
00069         virtual unsigned int getFramesRead() const = 0;
00070         virtual const QString getUrlBase() const = 0;
00071         virtual double getTimeLength() const = 0;
00072         virtual double getTimePos() const = 0;
00073         virtual bool isLiveCamera() const = 0;
00074         virtual TCameraStatus getCameraStatus() const { return status; };
00075         virtual bool isClosed() const { return status == Closed; };
00076         virtual bool isRunning() const { return status == Running; };
00077         virtual bool isRunningOneStep() const { return status == RunningOneStep; };
00078         virtual bool isPaused() const { return status == Paused; };
00079 
00080 
00081 public slots:
00082         virtual bool grab() = 0;
00083         virtual void pauseCam() = 0;
00084         virtual void unpauseCam() = 0;
00085         virtual void nextFrameCam() = 0;
00086         virtual void setSpeedCam(double d) = 0;
00087         virtual void seekCam(TSeekType type, double pos) = 0;
00088         virtual void closeCam() = 0;
00089 
00090 signals:
00091         void newGrab();
00092         void newRead();
00093         void camClosed();
00094         void camOpened();
00095         void statusChange(QVCamera::TCameraStatus);
00096 
00097 protected:
00098         TCameraStatus status;
00099         void setStatus(TCameraStatus status) 
00100                 { this->status = status; emit statusChange(status); }
00101 
00102         void setImageBuffer(QVGenericImage * image)
00103                 {
00104                 if (this->image != NULL)
00105                 delete image;
00106                 this->image = image;
00107                 }
00108 
00109 private:
00110         QVGenericImage * image;
00111 
00113 };
00114 #endif
00115 

Generated on Thu Dec 13 13:06:25 2007 for QVision by  doxygen 1.5.3