1 // VideoInputHaiku.h: Video input processing using Haiku media kit
2 //
3 //   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
4 //
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.
9 //
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.
14 //
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
18 
19 #ifndef GNASH_VIDEOINPUTHAIKU_H
20 #define GNASH_VIDEOINPUTHAIKU_H
21 
22 #include <vector>
23 #include <cstdint> // for C99 int types
24 #include "VideoInput.h"
25 
26 namespace gnash {
27 namespace media {
28 namespace haiku {
29 
30 class VideoInputHaiku : public VideoInput
31 {
32 public:
33 
34     /// Constructor for the VideoInputHaiku class
35     //
36     /// TODO: most of these properties need not be stored, but should rather
37     /// be queried from the input device.
38     VideoInputHaiku();
39 
40     /// Destructor for the VideoInputGst class
41     virtual ~VideoInputHaiku();
42 
getNames(std::vector<std::string> &)43     static void getNames(std::vector<std::string>& /*names*/) {}
44 
45     /// Return the current activity level of the webcam
46     //
47     /// @return     A double specifying the amount of motion currently
48     ///             detected by the camera.
activityLevel()49     double activityLevel () const { return _activityLevel; }
50 
51     /// The maximum available bandwidth for outgoing connections
52     //
53     /// TODO: see if this should really be here.
bandwidth()54     size_t bandwidth() const { return _bandwidth; }
55 
setBandwidth(size_t bandwidth)56     void setBandwidth(size_t bandwidth) {
57         _bandwidth = bandwidth;
58     }
59 
60     /// The current frame rate of the webcam
61     //
62     /// @return     A double specifying the webcam's current FPS
currentFPS()63     double currentFPS() const { return _currentFPS; }
64 
65     /// The maximum FPS rate of the webcam
66     //
67     /// @return     A double specifying the webcam's maximum FPS
fps()68     double fps() const { return _fps; }
69 
70     /// Return the height of the webcam's frame
height()71     size_t height() const { return _height; }
72 
73     /// Return the width of the webcam's frame
width()74     size_t width() const { return _width; }
75 
76     /// The index of the camera
index()77     size_t index() const { return _index; }
78 
79     /// Request a native mode most closely matching the passed variables.
80     //
81     /// @param width            The required width
82     /// @param height           The required height
83     /// @param fps              The required frame rate
84     /// @param favorArea        How to match the requested mode.
85     void requestMode(size_t width, size_t height, double fps, bool favorArea);
86 
87     /// Set the amount of motion required before notifying the core
setMotionLevel(int m)88     void setMotionLevel(int m) { _motionLevel = m; }
89 
90     /// Return the current motionLevel setting
motionLevel()91     int motionLevel() const { return _motionLevel; }
92 
93     /// Set time without motion in milliseconds before core is notified
setMotionTimeout(int m)94     void setMotionTimeout(int m) { _motionTimeout = m; }
95 
96     /// Return the current motionTimeout setting.
motionTimeout()97     int motionTimeout() const { return _motionTimeout; }
98 
mute(bool m)99     void mute(bool m) { _muted = m; }
muted()100     bool muted() const { return _muted; }
101 
102     /// Return the name of this webcam
103     //
104     /// @return     a string specifying the name of the webcam.
name()105     const std::string& name() const { return _name; }
106 
107     /// Set the quality of the webcam
setQuality(int q)108     void setQuality(int q) { _quality = q; }
109 
110     /// Return the current quality of the webcam
quality()111     int quality() const { return _quality; }
112 
113     /// \brief Function starts up the pipeline designed earlier in code
114     ///      execution. This puts everything into motion.
115     ///
116     /// @return True if the pipeline was started correctly, false otherwise.
117     bool play();
118 
119     /// \brief Function stops the pipeline designed earlier in code execution.
120     ///
121     /// @return True if the pipeline was stopped correctly, false otherwise.
122     bool stop();
123 
124 private:
125 
126     /// TODO: see which of these need to be retrieved from the camera,
127     /// which of them should be stored like this, and which should
128     /// be stored in the Camera_as relay object.
129 
130     /// The currently detected activity level. This should be queried from
131     /// the camera.
132     double _activityLevel;
133 
134     /// The available bandwidth. This probably shouldn't be dealt with by
135     /// the camera class. But maybe it should.
136     size_t _bandwidth;
137 
138     /// The current FPS of the camera. This should be queried from the
139     /// camera.
140     double _currentFPS;
141 
142     /// The maximum FPS allowed.
143     double _fps;
144 
145     /// The height of the frame. This should probably be retrieved from
146     /// the camera
147     size_t _height;
148 
149     /// The width of the frame. This should probably be retrieved from
150     /// the camera
151     size_t _width;
152 
153     /// The index of this Webcam
154     size_t _index;
155 
156     /// The motion level required to trigger a notification to the core
157     int _motionLevel;
158 
159     /// The length of inactivity required to trigger a notification to the core.
160     int _motionTimeout;
161 
162     /// Whether access to the camera is allowed. This depends on the rcfile
163     /// setting
164     bool _muted;
165 
166     /// The name of this camera.
167     std::string _name;
168 
169     /// The current quality setting.
170     int _quality;
171 
172 };
173 
174 
175 } // gnash.media.haiku namespace
176 } // gnash.media namespace
177 } // gnash namespace
178 
179 #endif
180