Panda3D
webcamVideo.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file webcamVideo.h
10  * @author jyelon
11  * @date 2007-11-01
12  */
13 
14 #ifndef WEBCAMVIDEO_H
15 #define WEBCAMVIDEO_H
16 
17 #include "movieVideo.h"
18 
19 /**
20  * Allows you to open a webcam or other video capture device as a video
21  * stream.
22  */
23 class EXPCL_VISION WebcamVideo : public MovieVideo {
24 
25 PUBLISHED:
26  virtual ~WebcamVideo();
27 
28  static int get_num_options();
29  static PT(WebcamVideo) get_option(int n);
30  MAKE_SEQ(get_options, get_num_options, get_option);
31  MAKE_SEQ_PROPERTY(options, get_num_options, get_option);
32 
33  INLINE int get_size_x() const;
34  INLINE int get_size_y() const;
35  INLINE double get_fps() const;
36  INLINE const std::string &get_pixel_format() const;
37 
38  virtual PT(MovieVideoCursor) open() = 0;
39 
40  INLINE void output(std::ostream &out) const;
41 
42 public:
43  static void find_all_webcams();
44 
45 protected:
46  int _size_x;
47  int _size_y;
48  double _fps;
49  std::string _pixel_format;
50 
51  static pvector<PT(WebcamVideo)> _all_webcams;
52 
53 public:
54  static TypeHandle get_class_type() {
55  return _type_handle;
56  }
57  static void init_type() {
58  MovieVideo::init_type();
59  register_type(_type_handle, "WebcamVideo",
60  MovieVideo::get_class_type());
61  }
62  virtual TypeHandle get_type() const {
63  return get_class_type();
64  }
65  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
66 
67 private:
68  static TypeHandle _type_handle;
69 };
70 
71 INLINE std::ostream &operator << (std::ostream &out, const WebcamVideo &n);
72 
73 #include "webcamVideo.I"
74 
75 #endif
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Allows you to open a webcam or other video capture device as a video stream.
Definition: webcamVideo.h:23
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
void output(std::ostream &out) const
Outputs the Namable.
Definition: namable.I:61
A MovieVideo is actually any source that provides a sequence of video frames.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A MovieVideo is actually any source that provides a sequence of video frames.
Definition: movieVideo.h:38
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81