1 // VideoInput.h: Video input base class.
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc.
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef GNASH_VIDEOINPUT_H
21 #define GNASH_VIDEOINPUT_H
23 #include <cstdint> // for C99 int types
26 #include "dsodefs.h" //DSOEXPORT
31 /// This is the interface for video input devices.
33 /// Each VideoInput should represent exactly one webcam (or similar device).
35 /// The interface for querying the camera is provisionally done, but needs
36 /// more testing of how it actually works. Most of the values are faked.
38 /// TODO: separate the process of finding cameras from this class.
39 /// It could be implemented as a static method. The available cameras
40 /// and all created VideoInput objects should be stored in a
41 /// MediaHandler, mapped by an index for retrieval by ActionScript.
43 /// TODO: design a useful interface for starting, stopping and attaching
44 /// the video data. VideoInputGst has some functionality here, but it
45 /// is not generic enough, relying on too many gst-specific
46 /// implementation details.
51 DSOEXPORT
VideoInput() {}
53 // virtual classes need a virtual destructor !
54 virtual ~VideoInput() {}
56 /// Return the current activity level of the webcam
58 /// @return A double specifying the amount of motion currently
59 /// detected by the camera.
60 virtual double activityLevel() const = 0;
62 /// The maximum available bandwidth for outgoing connections
64 /// TODO: see if this should really be here.
65 virtual size_t bandwidth() const = 0;
67 /// Set the bandwidth for outgoing connections.
68 virtual void setBandwidth(size_t bandwidth
) = 0;
70 /// The current frame rate of the webcam
72 /// @return A double specifying the webcam's current FPS
73 virtual double currentFPS() const = 0;
75 /// The maximum FPS rate of the webcam
77 /// @return A double specifying the webcam's maximum FPS
78 virtual double fps() const = 0;
80 /// Return the height of the webcam's frame
81 virtual size_t height() const = 0;
83 /// Return the width of the webcam's frame
84 virtual size_t width() const = 0;
86 /// The index of the camera
87 virtual size_t index() const = 0;
89 /// Request a native mode most closely matching the passed variables.
91 /// @param width The required width
92 /// @param height The required height
93 /// @param fps The required frame rate
94 /// @param favorArea How to match the requested mode.
95 virtual void requestMode(size_t width
, size_t height
, double fps
,
98 /// Set the amount of motion required before notifying the core
99 virtual void setMotionLevel(int m
) = 0;
101 /// Return the current motionLevel setting
102 virtual int motionLevel() const = 0;
104 /// Set time without motion in milliseconds before core is notified
105 virtual void setMotionTimeout(int m
) = 0;
107 /// Return the current motionTimeout setting.
108 virtual int motionTimeout() const = 0;
110 virtual void mute(bool m
) = 0;
111 virtual bool muted() const = 0;
113 /// Return the name of this webcam
115 /// @return a string specifying the name of the webcam.
116 virtual const std::string
& name() const = 0;
118 /// Set the quality of the webcam
119 virtual void setQuality(int q
) = 0;
121 /// Return the current quality of the webcam
122 virtual int quality() const = 0;