Panda3D
webcamVideo.I
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.I
10  * @author jyelon
11  * @date 2007-11-01
12  */
13 
14 /**
15  * Returns the camera's size_x.
16  */
17 INLINE int WebcamVideo::
18 get_size_x() const {
19  return _size_x;
20 }
21 
22 /**
23  * Returns the camera's size_y.
24  */
25 INLINE int WebcamVideo::
26 get_size_y() const {
27  return _size_y;
28 }
29 
30 /**
31  * Returns the camera's framerate. This is a maximum theoretical: the actual
32  * performance will depend on the speed of the hardware.
33  */
34 INLINE double WebcamVideo::
35 get_fps() const {
36  return _fps;
37 }
38 
39 /**
40  * Returns the camera's pixel format, as a FourCC code, if known.
41  */
42 INLINE const std::string &WebcamVideo::
44  return _pixel_format;
45 }
46 
47 /**
48  * Outputs the WebcamVideo. This function simply writes the name, size and
49  * FPS to the output stream.
50  */
51 INLINE void WebcamVideo::
52 output(std::ostream &out) const {
53  out << get_name() << ": " << get_size_x() << "x" << get_size_y();
54 
55  if (!_pixel_format.empty()) {
56  out << " " << _pixel_format;
57  }
58 
59  out << " @ " << get_fps() << "Hz";
60 }
61 
62 INLINE std::ostream &operator << (std::ostream &out, const WebcamVideo &n) {
63  n.output(out);
64  return out;
65 }
int get_size_x() const
Returns the camera's size_x.
Definition: webcamVideo.I:18
Allows you to open a webcam or other video capture device as a video stream.
Definition: webcamVideo.h:23
int get_size_y() const
Returns the camera's size_y.
Definition: webcamVideo.I:26
const std::string & get_pixel_format() const
Returns the camera's pixel format, as a FourCC code, if known.
Definition: webcamVideo.I:43
void output(std::ostream &out) const
Outputs the WebcamVideo.
Definition: webcamVideo.I:52
double get_fps() const
Returns the camera's framerate.
Definition: webcamVideo.I:35