Panda3D
webcamVideo.h
1 // Filename: webcamVideo.h
2 // Created by: jyelon (01Nov2007)
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 WEBCAMVIDEO_H
16 #define WEBCAMVIDEO_H
17 
18 #include "movieVideo.h"
19 
20 ////////////////////////////////////////////////////////////////////
21 // Class : WebcamVideo
22 // Description : Allows you to open a webcam or other video capture
23 // device as a video stream.
24 ////////////////////////////////////////////////////////////////////
25 class EXPCL_VISION WebcamVideo : public MovieVideo {
26 
27 PUBLISHED:
28  virtual ~WebcamVideo();
29 
30  static int get_num_options();
31  static PT(WebcamVideo) get_option(int n);
32  MAKE_SEQ(get_options, get_num_options, get_option);
33 
34  INLINE int get_size_x() const;
35  INLINE int get_size_y() const;
36  INLINE double get_fps() const;
37  INLINE const string &get_pixel_format() const;
38 
39  virtual PT(MovieVideoCursor) open() = 0;
40 
41  INLINE void output(ostream &out) const;
42 
43 public:
44  static void find_all_webcams();
45 
46 protected:
47  int _size_x;
48  int _size_y;
49  double _fps;
50  string _pixel_format;
51 
52  static pvector<PT(WebcamVideo)> _all_webcams;
53 
54 public:
55  static TypeHandle get_class_type() {
56  return _type_handle;
57  }
58  static void init_type() {
59  MovieVideo::init_type();
60  register_type(_type_handle, "WebcamVideo",
61  MovieVideo::get_class_type());
62  }
63  virtual TypeHandle get_type() const {
64  return get_class_type();
65  }
66  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
67 
68 private:
69  static TypeHandle _type_handle;
70 };
71 
72 INLINE ostream &operator << (ostream &out, const WebcamVideo &n);
73 
74 #include "webcamVideo.I"
75 
76 #endif
void output(ostream &out) const
Outputs the Namable.
Definition: namable.I:97
Allows you to open a webcam or other video capture device as a video stream.
Definition: webcamVideo.h:25
A MovieVideo is actually any source that provides a sequence of video frames.
A MovieVideo is actually any source that provides a sequence of video frames.
Definition: movieVideo.h:42
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85