#ifndef _QCamV4L_hpp_ #define _QCamV4L_hpp_ #include #include #include #include #include #include #include #include "QCam.hpp" class QCamSlider; class QCamV4L : public QCam { Q_OBJECT public: static QCam * openBestDevice(const char * devpath = "/dev/video0"); QCamV4L(const char * devpath="/dev/video0", bool NONBLOCK=false, int preferedPalette=0 /* auto palette*/); const uchar * yuvFrame() const { return yuvBuffer_;}; const QSize & size() const; void resize(const QSize & s); ~QCamV4L(); int getBightness() const; int getContrast() const; protected: int device_; struct video_capability capability_; struct video_window window_; struct video_picture picture_; void updatePictureSettings(); bool dropFrame(); /** should be overloaded. set x an y to allowed value. */ virtual void checkSize(unsigned int & x, unsigned int & y) const; private: bool setSize(unsigned int x, unsigned int y); void init(int preferedPalette); void initRemoteControl(QWidget * remoteCTRL); void allocBuffers(); uchar * yuvBuffer_; uchar * tmpBuffer_; QTimer timer_; QSize size_; /* for remote controle */ QCamSlider * remoteCTRLbrightness_; QCamSlider * remoteCTRLcontrast_; public slots: void setContrast(int value); void setBrightness(int value); protected slots: virtual bool updateFrame(); signals: void contrastChange(int); void brightnessChange(int); }; #endif