Panda3D

webcamVideoCursorV4L.h

00001 // Filename: webcamVideoCursorV4L.h
00002 // Created by: rdb (11Jun2010)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef WEBCAMVIDEOCURSORV4L_H
00016 #define WEBCAMVIDEOCURSORV4L_H
00017 
00018 #include "pandabase.h"
00019 
00020 #ifdef HAVE_VIDEO4LINUX
00021 
00022 #include "webcamVideo.h"
00023 
00024 struct v4l2_format;
00025 
00026 #if defined(HAVE_JPEG)
00027 struct jpeg_decompress_struct;
00028 #endif
00029 
00030 class WebcamVideoV4L;
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //       Class : WebcamVideoCursorV4L
00034 // Description : The Video4Linux implementation of webcams.
00035 ////////////////////////////////////////////////////////////////////
00036 class WebcamVideoCursorV4L : public MovieVideoCursor {
00037 public:
00038   WebcamVideoCursorV4L(WebcamVideoV4L *src);
00039   virtual ~WebcamVideoCursorV4L();
00040   virtual PT(Buffer) fetch_buffer();
00041 
00042 private:
00043   int _fd;
00044   void **_buffers;
00045   size_t *_buflens;
00046   size_t _bufcount;
00047   struct v4l2_format *_format;
00048 #ifdef HAVE_JPEG
00049   struct jpeg_decompress_struct *_cinfo;
00050 #endif
00051 
00052 public:
00053   static TypeHandle get_class_type() {
00054     return _type_handle;
00055   }
00056   static void init_type() {
00057     MovieVideoCursor::init_type();
00058     register_type(_type_handle, "WebcamVideoCursorV4L",
00059                   MovieVideoCursor::get_class_type());
00060   }
00061   virtual TypeHandle get_type() const {
00062     return get_class_type();
00063   }
00064   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00065 
00066 private:
00067   static TypeHandle _type_handle;
00068 };
00069 
00070 #endif // HAVE_VIDEO4LINUX
00071 
00072 #endif
 All Classes Functions Variables Enumerations