Gnash  0.8.11dev
VideoInputGst.h
Go to the documentation of this file.
1 // VideoInput.h: Video input processing using Gstreamer
2 //
3 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc.
5 //
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.
10 //
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.
15 //
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
19 
20 #ifndef GNASH_VIDEOINPUTGST_H
21 #define GNASH_VIDEOINPUTGST_H
22 
23 #include <vector>
24 #include <cstdint> // for C99 int types
25 #include "VideoInput.h"
26 #include "gst/gst.h"
27 
28 namespace gnash {
29 namespace media {
34 namespace gst {
35 
36 class GnashWebcam;
37 class GnashWebcamPrivate;
38 
45 {
46 public:
49  gint numerator;
53 
59  FramerateFraction(gint num, gint denom);
60 
63 };
64 
70 {
71 public:
76  gchar *mimetype;
77 
81  gint width;
82 
86  gint height;
87 
92 
99 
104 
106  WebcamVidFormat();
107 };
108 
109 
116 class VideoInputGst : public VideoInput
117 {
118 public:
119 
121  VideoInputGst();
122 
124  ~VideoInputGst();
125 
126  static void getNames(std::vector<std::string>& names);
127 
129  //
132  double activityLevel () const { return _activityLevel; }
133 
135  //
137  size_t bandwidth() const { return _bandwidth; }
138 
139  void setBandwidth(size_t bandwidth) {
140  _bandwidth = bandwidth;
141  }
142 
144  //
146  double currentFPS() const { return _currentFPS; }
147 
149  //
151  double fps() const { return _fps; }
152 
154  size_t height() const { return _height; }
155 
157  size_t width() const { return _width; }
158 
160  size_t index() const { return _index; }
161 
163  //
168  void requestMode(size_t width, size_t height, double fps, bool favorArea);
169 
171  void setMotionLevel(int m) { _motionLevel = m; }
172 
174  int motionLevel() const { return _motionLevel; }
175 
177  void setMotionTimeout(int m) { _motionTimeout = m; }
178 
180  int motionTimeout() const { return _motionTimeout; }
181 
182  void mute(bool m) { _muted = m; }
183  bool muted() const { return _muted; }
184 
186  //
188  const std::string& name() const { return _name; }
189 
191  void setQuality(int q) { _quality = q; }
192 
194  int quality() const { return _quality; }
195 
200  bool play();
201 
205  bool stop();
206 
207 
209  //
219  bool setWebcam(size_t index);
220 
222  //
224  //
227  bool init();
228 
237  int makeWebcamDeviceSelection();
238 
242 
250  gboolean webcamMakeVideoSaveLink();
251 
257  gboolean webcamBreakVideoSaveLink();
258 
269  gboolean webcamCreateSaveBin();
270 
279  gboolean webcamMakeVideoDisplayLink();
280 
288  gboolean webcamBreakVideoDisplayLink();
289 
290 private:
291 
292 
306  void getSelectedCaps(gint dev_select);
307 
318  void getSupportedFormats(GnashWebcam *cam, GstCaps *caps);
319 
329  void addSupportedFormat(GnashWebcam *cam, WebcamVidFormat *video_format,
330  GstStructure *format_structure);
331 
344  void getSupportedFramerates(WebcamVidFormat *video_format,
345  GstStructure *structure);
346 
353  gboolean checkForSupportedFramerate (GnashWebcamPrivate *webcam, int fps);
354 
363  void findHighestFramerate(WebcamVidFormat *format);
364 
375  gboolean webcamCreateSourceBin();
376 
382  gboolean webcamChangeSourceBin();
383 
394  gboolean webcamCreateMainBin();
395 
406  gboolean webcamCreateDisplayBin();
407 
408 
409 
413  GnashWebcamPrivate* getGlobalWebcam() {return _globalWebcam;}
414 
419  //
422  static void findVidDevs(std::vector<GnashWebcam*>& cams);
423 
426  std::vector<GnashWebcam*> _vidVect;
427 
431  int _devSelection;
432 
436  GnashWebcamPrivate *_globalWebcam;
437 
441 
444  double _activityLevel;
445 
448  size_t _bandwidth;
449 
452  double _currentFPS;
453 
455  double _fps;
456 
459  size_t _height;
460 
463  size_t _width;
464 
466  size_t _index;
467 
469  int _motionLevel;
470 
472  int _motionTimeout;
473 
476  bool _muted;
477 
479  std::string _name;
480 
482  int _quality;
483 
484 };
485 
486 
487 
488 
489 } //gst namespace
490 } // gnash.media namespace
491 } // gnash namespace
492 
493 #endif
int motionLevel() const
Return the current motionLevel setting.
Definition: VideoInputGst.h:174
int quality() const
Return the current quality of the webcam.
Definition: VideoInputGst.h:194
gint width
Contains a gint value describing the width of the selected format.
Definition: VideoInputGst.h:81
void setMotionLevel(int m)
Set the amount of motion required before notifying the core.
Definition: VideoInputGst.h:171
gint numFramerates
Contains a gint value representing the number of framerate values supported by the format described i...
Definition: VideoInputGst.h:91
FramerateFraction()
Create a new empty FramerateFraction class.
Definition: VideoInputGst.cpp:1586
void mute(bool m)
Definition: VideoInputGst.h:182
Definition: VideoInputGst.h:116
gint numerator
contains a gint value for the numerator portion of a fraction.
Definition: VideoInputGst.h:49
Definition: GnashKey.h:163
double activityLevel() const
Return the current activity level of the webcam.
Definition: VideoInputGst.h:132
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
char ** names[EV_MAX+1]
Definition: evtest.c:357
Definition: klash_part.cpp:329
gchar * mimetype
Contains a gchar* which describes the raw video input stream from the camera formated in a Gstreamer ...
Definition: VideoInputGst.h:76
size_t bandwidth() const
The maximum available bandwidth for outgoing connections.
Definition: VideoInputGst.h:137
FramerateFraction highestFramerate
Holds the highest_frame supported by the format described in the mimetype var.
Definition: VideoInputGst.h:103
Definition: klash_part.cpp:330
This is the interface for video input devices.
Definition: VideoInput.h:47
Definition: klash_part.cpp:329
bool muted() const
Definition: VideoInputGst.h:183
void setQuality(int q)
Set the quality of the webcam.
Definition: VideoInputGst.h:191
Definition: VideoInputGst.h:44
gint height
Contains a gint value describing the height of the selected format.
Definition: VideoInputGst.h:86
size_t index() const
The index of the camera.
Definition: VideoInputGst.h:160
size_t findVidDevs(std::vector< data *> &vidVect)
Definition: findwebcams.cpp:56
const std::string & name() const
Return the name of this webcam.
Definition: VideoInputGst.h:188
double currentFPS() const
The current frame rate of the webcam.
Definition: VideoInputGst.h:146
double fps() const
The maximum FPS rate of the webcam.
Definition: VideoInputGst.h:151
size_t height() const
Return the height of the webcam&#39;s frame.
Definition: VideoInputGst.h:154
FramerateFraction * framerates
Pointer to a FramerateFraction class which simply holds a temporary framerate variable while trying t...
Definition: VideoInputGst.h:98
Definition: klash_part.cpp:330
Definition: GnashKey.h:159
size_t width() const
Return the width of the webcam&#39;s frame.
Definition: VideoInputGst.h:157
int motionTimeout() const
Return the current motionTimeout setting.
Definition: VideoInputGst.h:180
void setBandwidth(size_t bandwidth)
Set the bandwidth for outgoing connections.
Definition: VideoInputGst.h:139
gint denominator
contains a gint value for the denominator portion of a fraction.
Definition: VideoInputGst.h:52
void setMotionTimeout(int m)
Set time without motion in milliseconds before core is notified.
Definition: VideoInputGst.h:177
Definition: VideoInputGst.h:69