Main Page   Class Hierarchy   Compound List   File List   Compound Members  

v4ldev.h

00001 // -*- c++ -*-
00002 
00003 /*
00004  *
00005  * Copyright (C) 2002 George Staikos <staikos@kde.org>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library 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 GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public License
00018  * along with this library; see the file COPYING.LIB.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00024 
00025 
00026 #ifndef _V4LDEV_H
00027 #define _V4LDEV_H
00028 
00029 #include <qstring.h>
00030 #include <qstringlist.h>
00031 #ifdef __STRICT_ANSI__
00032 #define FOO__STRICT_ANSI__
00033 #undef __STRICT_ANSI__
00034 #endif
00035 #include <asm/types.h>
00036 #ifdef FOO__STRICT_ANSI__
00037 #define __STRICT_ANSI__
00038 #undef FOO__STRICT_ANSI__
00039 #endif
00040 #include <linux/videodev.h>
00041 #include <v4limage.h>
00042 
00043 #include <float.h>
00044 
00045 struct video_channel;
00046 struct video_mmap;
00047 
00048 #define MAX_CLIP_RECTS 128
00049 
00055 class V4LDev
00056 {
00057 public:
00058     virtual ~V4LDev();
00059 
00064     static V4LDev *getDevice( const QString &dev );
00065 
00069     virtual bool isCamera() const;
00070 
00074     virtual bool isTuner() const;
00075 
00079     virtual int startCapture(int x, int y);
00080     virtual int stopCapture();
00081     virtual bool overlayOn() const;
00082     virtual int grab(V4LImage *buff, bool scale = true);
00083     virtual int signal() const { return -1; }
00084     virtual int setCaptureGeometry(const QRect& geom);
00085 
00086     // this finds the largest video that is within the size specified.
00087     // -1 on error, and uses aspect ratio if h = -1
00088     virtual int setImageSize(int w, int h = -1);
00089 
00090     virtual QString name() const { return _name; }
00091 
00092     virtual int setBrightness(int x);
00093     virtual int brightness() const;
00094 
00095     virtual int setColour(int x);
00096     virtual int colour() const;
00097 
00098     virtual int setHue(int x);
00099     virtual int hue() const;
00100 
00101     virtual int setContrast(int x);
00102     virtual int contrast() const;
00103 
00104     virtual int setWhiteness(int x);
00105     virtual int whiteness() const;
00106 
00107     virtual int setColourKey(unsigned long x);
00108     virtual unsigned long colourKey() const;
00109 
00110     virtual int setSource(const QString &source);
00111     virtual const QString source() const;
00112     virtual QStringList sources() const { return _sources; }
00113 
00114     virtual float aspectRatio() const { return _aspectRatio; }
00115 
00116     virtual bool canOverlay() const;
00117     virtual bool canGrab() const;
00118 
00119     virtual bool hasAudio() const { return _hasAudio; }
00120     virtual int enableAudio();
00121     virtual int disableAudio();
00122     virtual bool audioEnabled() const;
00123 
00124     // Triggers a re-init of the driver to set the new format.  Returns
00125     // non-zero on error.
00126     virtual int setInputFormat(int fmt);
00127     virtual int inputFormat() const;
00128 
00129     virtual void addClip(const QRect& clip);
00130     virtual void clearClips();
00131     virtual void reClip();
00132 
00133 protected:
00134     V4LDev(int fd, const QString &name, int channels, int type, int minw, int minh, int maxw, int maxh);
00135 
00136     int initGrabbing();
00137 
00138     int _fd;
00139     bool _valid;
00140     QString _name;
00141     bool _overlaid;
00142     struct video_channel *_channels;
00143     int _minWidth, _minHeight, _maxWidth, _maxHeight; // min and max cap dims
00144     int _type;
00145     float _aspectRatio;
00146     int format;
00147     QStringList _sources;
00148     int _source;
00149     int _capW, _capH;          // the scaled capture dimensions
00150     bool _hasAudio, _isTuner;
00151     struct video_mmap *_mmapData;
00152     struct video_mbuf _mbuf;
00153     int _mmapCurrentFrame;
00154     uchar *_mmapBuf;
00155     bool _grabNeedsInit;
00156     uchar *_grabBuf;
00157     uchar *_readBuf;
00158     int _grabW, _grabH;        // the actual capture dimensions
00159     int _fmt;
00160     int _bpp;
00161     QValueList<QRect> _clips;
00162     struct video_clip _cliprecs[MAX_CLIP_RECTS];
00163 };
00164 
00165 #endif
00166 

Generated at Thu Jan 30 02:56:02 2003 for QtVision by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001