1 // VideoInput.h: Video input base class.
3 // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef GNASH_VIDEOINPUT_H
20 #define GNASH_VIDEOINPUT_H
22 #include <boost/cstdint.hpp> // for C99 int types
25 #include "dsodefs.h" //DSOEXPORT
30 /// This is the interface for video input devices.
32 /// Each VideoInput should represent exactly one webcam (or similar device).
34 /// The interface for querying the camera is provisionally done, but needs
35 /// more testing of how it actually works. Most of the values are faked.
37 /// TODO: separate the process of finding cameras from this class.
38 /// It could be implemented as a static method. The available cameras
39 /// and all created VideoInput objects should be stored in a
40 /// MediaHandler, mapped by an index for retrieval by ActionScript.
42 /// TODO: design a useful interface for starting, stopping and attaching
43 /// the video data. VideoInputGst has some functionality here, but it
44 /// is not generic enough, relying on too many gst-specific
45 /// implementation details.
50 DSOEXPORT
VideoInput() {}
52 // virtual classes need a virtual destructor !
53 virtual ~VideoInput() {}
55 /// Return the current activity level of the webcam
57 /// @return A double specifying the amount of motion currently
58 /// detected by the camera.
59 virtual double activityLevel() const = 0;
61 /// The maximum available bandwidth for outgoing connections
63 /// TODO: see if this should really be here.
64 virtual size_t bandwidth() const = 0;
66 /// Set the bandwidth for outgoing connections.
67 virtual void setBandwidth(size_t bandwidth
) = 0;
69 /// The current frame rate of the webcam
71 /// @return A double specifying the webcam's current FPS
72 virtual double currentFPS() const = 0;
74 /// The maximum FPS rate of the webcam
76 /// @return A double specifying the webcam's maximum FPS
77 virtual double fps() const = 0;
79 /// Return the height of the webcam's frame
80 virtual size_t height() const = 0;
82 /// Return the width of the webcam's frame
83 virtual size_t width() const = 0;
85 /// The index of the camera
86 virtual size_t index() const = 0;
88 /// Request a native mode most closely matching the passed variables.
90 /// @param width The required width
91 /// @param height The required height
92 /// @param fps The required frame rate
93 /// @param favorArea How to match the requested mode.
94 virtual void requestMode(size_t width
, size_t height
, double fps
,
97 /// Set the amount of motion required before notifying the core
98 virtual void setMotionLevel(int m
) = 0;
100 /// Return the current motionLevel setting
101 virtual int motionLevel() const = 0;
103 /// Set time without motion in milliseconds before core is notified
104 virtual void setMotionTimeout(int m
) = 0;
106 /// Return the current motionTimeout setting.
107 virtual int motionTimeout() const = 0;
109 virtual void mute(bool m
) = 0;
110 virtual bool muted() const = 0;
112 /// Return the name of this webcam
114 /// @return a string specifying the name of the webcam.
115 virtual const std::string
& name() const = 0;
117 /// Set the quality of the webcam
118 virtual void setQuality(int q
) = 0;
120 /// Return the current quality of the webcam
121 virtual int quality() const = 0;