Panda3D
Loading...
Searching...
No Matches
webcamVideo.cxx
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.cxx
10 * @author jyelon
11 * @date 2007-11-01
12 */
13
14#include "webcamVideo.h"
15#include "pandabase.h"
16#include "movieVideoCursor.h"
17
18pvector<PT(WebcamVideo)> WebcamVideo::_all_webcams;
19TypeHandle WebcamVideo::_type_handle;
20
21
22/**
23 *
24 */
25WebcamVideo::
26~WebcamVideo() {
27}
28
29/**
30 * Scans the hardware for webcams, and pushes them onto the global list of all
31 * webcams.
32 *
33 * There are several implementations of WebcamVideo, including one based on
34 * DirectShow, one based on Video4Linux, and so forth. These implementations
35 * are contained in one C++ file each, and they export nothing at all except a
36 * single "find_all" function. Otherwise, they can only be accessed through
37 * the virtual methods of the WebcamVideo objects they create.
38 */
41 static bool initialized = false;
42 if (initialized) return;
43 initialized = true;
44
45#ifdef HAVE_DIRECTCAM
46 extern void find_all_webcams_ds();
47 find_all_webcams_ds();
48#endif
49
50#ifdef HAVE_VIDEO4LINUX
51 extern void find_all_webcams_v4l();
52 find_all_webcams_v4l();
53#endif
54
55#if defined(HAVE_OPENCV) && !defined(HAVE_DIRECTCAM) && !defined(HAVE_VIDEO4LINUX)
56 extern void find_all_webcams_opencv();
57 find_all_webcams_opencv();
58#endif
59}
60
61/**
62 * Returns the number of webcam options. An "option" consists of a device
63 * plus a set of configuration parameters. For example, "Creative Webcam Live
64 * at 640x480, 30 fps" is an option.
65 */
69 return _all_webcams.size();
70}
71
72/**
73 * Returns the nth webcam option.
74 */
75PT(WebcamVideo) WebcamVideo::
76get_option(int n) {
78 nassertr((n >= 0) && (n < (int)_all_webcams.size()), nullptr);
79 return _all_webcams[n];
80}
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
Allows you to open a webcam or other video capture device as a video stream.
Definition webcamVideo.h:23
get_num_options
Returns the number of webcam options.
Definition webcamVideo.h:30
static void find_all_webcams()
Scans the hardware for webcams, and pushes them onto the global list of all webcams.
This is our own Panda specialization on the default STL vector.
Definition pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.