TLIB documentation
 

tlDigitizerV4L2.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  This file is part of the TLIB computer vision library.
00004 //  Copyright (C) 2003-2008 Sebastien Grange
00005 //  Copyright (C) 2003-2007 VRAI Group, EPFL
00006 //  All rights reserved.
00007 // 
00008 //  This library is free software; you can redistribute it and/or modify
00009 //  it under the terms of the GNU General Public License("GPL") version 2
00010 //  as published by the Free Software Foundation.
00011 // 
00012 //  <http://imtsg14.epfl.ch/tlib>
00013 //
00014 /////////////////////////////////////////////////////////////////////////////////
00015 
00016 
00017 #ifndef __TLDIGITIZERV4L2_H__
00018 #define __TLDIGITIZERV4L2_H__
00019 
00020 /* LINUX is defined in the makefile */
00021 #if    !LINUX
00022 #error THIS IS A LINUX VERSION 
00023 #endif
00024 
00025 #define TLDIGITIZER_V4L2_BASE_NAME "/dev/video"
00026 
00027 #include <sys/types.h>
00028 #include <asm/types.h>          /* for videodev2.h */
00029 #include <linux/videodev2.h>
00030 
00031 #include "tlVision.h"
00032 #include "tlDigitizer.h"
00033 
00034 
00035 // interface
00036 class tlDigitizerV4L2 : public tlDigitizer
00037 {
00038 private:
00039   struct buffer {
00040     void   *start;
00041     size_t length;
00042   };
00043   int                        ifd;
00044   struct buffer              *buffers;
00045   unsigned int               n_buffers;
00046   struct v4l2_buffer         mbuf;
00047   struct v4l2_requestbuffers vbuf;
00048   unsigned char              *rgbImage;
00049   struct v4l2_capability     vcap;
00050   int                        grabQueuedInit;
00051   int                        channel;
00052   int                        format;
00053   
00054   void init_mmap       (void);
00055   void uninit_mmap     (void);
00056   void start_capturing (void);
00057   void stop_capturing  (void);
00058   
00059 public:
00060   tlDigitizerV4L2        ();
00061   tlDigitizerV4L2        (int width, int height);
00062   tlDigitizerV4L2        (int width, int height, int channel, unsigned short input = TL_SOURCE_AUTO);
00063   ~tlDigitizerV4L2       ();
00064 
00065   virtual int open       (int index = 0);
00066   virtual int open       (int width, int height, int index = 0);
00067           int open       (int width, int height, int index, int channel, unsigned short input = TL_SOURCE_AUTO);
00068   virtual int close      ();
00069 
00070   virtual int setChannel (int channel, unsigned short input);
00071   virtual int setInput   (unsigned short input);
00072   virtual int setSize    (int width, int height);
00073 
00074   virtual int grab       (tlImage *image);
00075   virtual int grab       (tlImage *image, tlRect *rect);
00076   virtual int grabQueued (tlImage *image);
00077   virtual int grabQueued (tlImage *image, tlRect *rect);
00078 };
00079 
00080 
00081 #endif


TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.