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 
00044 class QVCamera : public QObject, public QVPropertyHolder
00045 {
00047         Q_OBJECT
00048 public:
00049         QVCamera(QString name = QString());
00050         ~QVCamera();
00051 
00052         // Camera status:
00053         typedef enum {Closed, Running, RunningOneStep, Paused /*, EndOfFile */} TCameraStatus;
00054 
00056         typedef enum { SeekCurrent = 0, SeekPercentage = 1, SeekAbsolute = 2 } TSeekType;
00057 
00058         virtual bool openCam() = 0;
00059 
00060         //virtual bool isEndOfFile() const { return status == EndOfFile; };
00061 
00062         // Getter functions:
00063         virtual unsigned int getRows() const = 0;
00064         virtual unsigned int getCols() const = 0;
00065         virtual double getFPS() const = 0;
00066         virtual double getSpeed() const = 0;
00067         virtual unsigned int getFramesGrabbed() const = 0;
00068         virtual unsigned int getFramesRead() const = 0;
00069         virtual const QString getUrlBase() const = 0;
00070         virtual double getTimeLength() const = 0;
00071         virtual double getTimePos() const = 0;
00072         virtual bool isLiveCamera() const = 0;
00073         virtual TCameraStatus getCameraStatus() const { return status; };
00074         virtual bool isClosed() const { return status == Closed; };
00075         virtual bool isRunning() const { return status == Running; };
00076         virtual bool isRunningOneStep() const { return status == RunningOneStep; };
00077         virtual bool isPaused() const { return status == Paused; };
00078 
00079 
00080 public slots:
00081         virtual bool grab() = 0;
00082         virtual void pauseCam() = 0;
00083         virtual void unpauseCam() = 0;
00084         virtual void nextFrameCam() = 0;
00085         virtual void setSpeedCam(double d) = 0;
00086         virtual void seekCam(TSeekType type, double pos) = 0;
00087         virtual void closeCam() = 0;
00088 
00089 signals:
00090         void newGrab();
00091         void newRead();
00092         void camClosed();
00093         void camOpened();
00094         void statusChange(QVCamera::TCameraStatus);
00095 
00096 protected:
00097         TCameraStatus status;
00098         void setStatus(TCameraStatus status) 
00099                 { this->status = status; emit statusChange(status); }
00100 
00101         void setImageBuffer(QVGenericImage * image)
00102                 {
00103                 if (this->image != NULL)
00104                 delete image;
00105                 this->image = image;
00106                 }
00107 
00108 private:
00109         QVGenericImage * image;
00110 
00112 };
00113 #endif
00114 

Generated on Wed Jan 16 18:41:28 2008 for QVision by  doxygen 1.5.3