v4l1.h

00001 
00002 /***************************************************************************
00003  *  v4l1.h - This header defines a Video4Linux cam
00004  *
00005  *  Generated: Fri Mar 11 17:46:31 2005
00006  *  Copyright  2005  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __FIREVISION_CAMS_V4L1_H_
00025 #define __FIREVISION_CAMS_V4L1_H_
00026 
00027 #include <cams/camera.h>
00028 
00029 namespace firevision {
00030 #if 0 /* just to make Emacs auto-indent happy */
00031 }
00032 #endif
00033 
00034 class CameraArgumentParser;
00035 class V4L1CameraData;
00036 
00037 class V4L1Camera : public Camera
00038 {
00039   friend class V4LCamera;
00040 
00041  public:
00042   V4L1Camera(const char *device_name = "/dev/video0");
00043   V4L1Camera(const CameraArgumentParser *cap);
00044   virtual ~V4L1Camera();
00045 
00046   virtual void open();
00047   virtual void start();
00048   virtual void stop();
00049   virtual void close();
00050   virtual void flush();
00051   virtual void capture();
00052   virtual void print_info();
00053   virtual bool ready();
00054 
00055   virtual unsigned char* buffer();
00056   virtual unsigned int   buffer_size();
00057   virtual void           dispose_buffer();
00058 
00059   virtual unsigned int    pixel_width();
00060   virtual unsigned int    pixel_height();
00061   virtual colorspace_t    colorspace();
00062 
00063   virtual void           set_image_number(unsigned int n);
00064 
00065  protected:
00066   V4L1Camera(const char *device_name, int dev);
00067 
00068  private:
00069   virtual void post_open();
00070 
00071  private:
00072 
00073   static const int MMAP = 1;
00074   static const int READ = 2;
00075 
00076   V4L1CameraData *__data;
00077 
00078   bool opened;
00079   bool started;
00080 
00081   int capture_method;
00082 
00083   int dev;
00084   unsigned char *frame_buffer;
00085 
00086 
00087 };
00088 
00089 } // end namespace firevision
00090 
00091 #endif