Panda3D
 All Classes Functions Variables Enumerations
webcamVideoCursorV4L.h
1 // Filename: webcamVideoCursorV4L.h
2 // Created by: rdb (11Jun2010)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef WEBCAMVIDEOCURSORV4L_H
16 #define WEBCAMVIDEOCURSORV4L_H
17 
18 #include "pandabase.h"
19 
20 #ifdef HAVE_VIDEO4LINUX
21 
22 #include "webcamVideo.h"
23 #include "movieVideoCursor.h"
24 
25 #include <linux/videodev2.h>
26 
27 #ifdef HAVE_JPEG
28 extern "C" {
29  #include <jpeglib.h>
30 }
31 #endif
32 
33 class WebcamVideoV4L;
34 
35 ////////////////////////////////////////////////////////////////////
36 // Class : WebcamVideoCursorV4L
37 // Description : The Video4Linux implementation of webcams.
38 ////////////////////////////////////////////////////////////////////
39 class WebcamVideoCursorV4L : public MovieVideoCursor {
40 public:
41  WebcamVideoCursorV4L(WebcamVideoV4L *src);
42  virtual ~WebcamVideoCursorV4L();
43  virtual PT(Buffer) fetch_buffer();
44 
45 private:
46  int _fd;
47  void **_buffers;
48  size_t *_buflens;
49  size_t _bufcount;
50  struct v4l2_format _format;
51 #ifdef HAVE_JPEG
52  struct jpeg_decompress_struct _cinfo;
53 #endif
54 
55 public:
56  static TypeHandle get_class_type() {
57  return _type_handle;
58  }
59  static void init_type() {
60  MovieVideoCursor::init_type();
61  register_type(_type_handle, "WebcamVideoCursorV4L",
62  MovieVideoCursor::get_class_type());
63  }
64  virtual TypeHandle get_type() const {
65  return get_class_type();
66  }
67  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
68 
69 private:
70  static TypeHandle _type_handle;
71 };
72 
73 #endif // HAVE_VIDEO4LINUX
74 
75 #endif
Definition: buffer.h:26
A MovieVideo is actually any source that provides a sequence of video frames.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85