|
|
/* * * Copyright (C) 2002 George Staikos* * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef _V4LDEV_H #define _V4LDEV_H #include #include #include #include "linux/videodev.h" #include struct video_channel; struct video_mmap; /** * Abstract interface to Video4Linux devices. * * @version $Id: v4ldev.h,v 1.2 2002/03/17 19:38:48 rich Exp $ */ class V4LDev { public: virtual ~V4LDev(); static V4LDev* getDevice(const QString &dev); virtual bool isCamera() const { return false; } virtual bool isTuner() const { return _isTuner; } // h = -1 => use aspect ratio virtual int startCapture(int x, int y, int w, int h = -1); virtual int grab(QPixmap& buffer, bool mirror = false, bool scale = true); virtual int setFreq(unsigned long) { return -1; } virtual int signal() const { return -1; } // this finds the largest video that is within the size specified. // -1 on error, and uses aspect ratio if h = -1 virtual int setImageSize(int w, int h = -1); virtual QString name() const { return _name; } virtual int setBrightness(int x); virtual int brightness() const; virtual int setColour(int x); virtual int colour() const; virtual int setHue(int x); virtual int hue() const; virtual int setContrast(int x); virtual int contrast() const; virtual int setWhiteness(int x); virtual int whiteness() const; virtual int setSource(const QString &source); virtual const QString source() const; virtual QStringList sources() const { return _sources; } virtual float aspectRatio() const { return _aspectRatio; } virtual bool canOverlay() const; virtual bool hasAudio() const { return _hasAudio; } virtual int enableAudio(); virtual int disableAudio(); virtual unsigned long minFreq() const { return _minFreq; } virtual unsigned long maxFreq() const { return _maxFreq; } virtual int setTunerMode(int) { return -1; } virtual int tunerMode() const { return -1; } protected: V4LDev(int fd, const QString &name, int channels, int type, int minw, int minh, int maxw, int maxh); int _fd; bool _valid; QString _name; struct video_channel *_channels; int _minWidth, _minHeight, _maxWidth, _maxHeight; int _type; float _aspectRatio; int format; QStringList _sources; int _source; int _capW, _capH; bool _hasAudio, _isTuner; unsigned long _minFreq, _maxFreq; }; /** * Interface for Video4Linux cameras. * * @version $Id: v4ldev.h,v 1.2 2002/03/17 19:38:48 rich Exp $ */ class V4LCamera : public V4LDev { friend class V4LDev; public: ~V4LCamera(); virtual bool isCamera() const { return true; } protected: V4LCamera(int fd, const QString &name, int channels, int type, int minw, int minh, int maxw, int maxh); }; /** * Interface for Video4Linux tuners. * * @version $Id: v4ldev.h,v 1.2 2002/03/17 19:38:48 rich Exp $ */ class V4LTuner : public V4LDev { friend class V4LDev; public: ~V4LTuner(); virtual int grab(QPixmap& buffer, bool mirror = false, bool scale = true); virtual int setFreq(unsigned long freq); virtual int signal() const; virtual int setSource(const QString &source); virtual int setTunerMode(int x); virtual int tunerMode() const; protected: V4LTuner(int fd, const QString &name, int channels, int type, int minw, int minh, int maxw, int maxh); private: struct video_mmap *_vmbuf; struct video_mbuf _vmp; struct video_tuner _vt; int _frame; uchar *_mbuf; }; #endif
Generated by: rich on pegasus on Wed Mar 20 03:16:53 2002, using kdoc 2.0a53. |