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 class CameraArgumentParser;
00030 class V4L1CameraData;
00031
00032 class V4L1Camera : public Camera
00033 {
00034   friend class V4LCamera;
00035
00036  public:
00037   V4L1Camera(const char *device_name = "/dev/video0");
00038   V4L1Camera(const CameraArgumentParser *cap);
00039   virtual ~V4L1Camera();
00040
00041   virtual void open();
00042   virtual void start();
00043   virtual void stop();
00044   virtual void close();
00045   virtual void flush();
00046   virtual void capture();
00047   virtual void print_info();
00048   virtual bool ready();
00049
00050   virtual unsigned char* buffer();
00051   virtual unsigned int   buffer_size();
00052   virtual void           dispose_buffer();
00053
00054   virtual unsigned int    pixel_width();
00055   virtual unsigned int    pixel_height();
00056   virtual colorspace_t    colorspace();
00057
00058   virtual void           set_image_number(unsigned int n);
00059
00060  protected:
00061   V4L1Camera(const char *device_name, int dev);
00062
00063  private:
00064   virtual void post_open();
00065
00066  private:
00067
00068   static const int MMAP = 1;
00069   static const int READ = 2;
00070
00071   V4L1CameraData *__data;
00072
00073   bool opened;
00074   bool started;
00075
00076   int capture_method;
00077
00078   int dev;
00079   unsigned char *frame_buffer;
00080
00081
00082 };
00083
00084 #endif