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