• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

VideoInputGst.h

Go to the documentation of this file.
00001 // VideoInput.h: Video input processing using Gstreamer
00002 // 
00003 //   Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 #ifndef GNASH_VIDEOINPUTGST_H
00020 #define GNASH_VIDEOINPUTGST_H
00021 
00022 #include <vector>
00023 #include <boost/cstdint.hpp> // for C99 int types
00024 #include "VideoInput.h"
00025 #include "gst/gst.h"
00026 
00027 namespace gnash {
00028 namespace media {
00033 namespace gst {
00034 
00035 class GnashWebcam;
00036 class GnashWebcamPrivate;
00037 
00043 class FramerateFraction
00044 {
00045 public:
00048     gint numerator;
00051     gint denominator;
00052     
00058     FramerateFraction(gint num, gint denom);
00059     
00061     FramerateFraction();
00062 };
00063 
00068 class WebcamVidFormat
00069 {
00070 public:
00075     gchar *mimetype;
00076     
00080     gint   width;
00081     
00085     gint   height;
00086     
00090     gint   numFramerates;
00091     
00097     FramerateFraction *framerates;
00098     
00102     FramerateFraction highestFramerate;
00103     
00105     WebcamVidFormat();
00106 };
00107 
00108 
00115 class VideoInputGst : public VideoInput
00116 {
00117 public:
00118  
00120     VideoInputGst();
00121     
00123     ~VideoInputGst();
00124     
00125     static void getNames(std::vector<std::string>& names);
00126     
00128     //
00131     double activityLevel () const { return _activityLevel; }
00132     
00134     //
00136     size_t bandwidth() const { return _bandwidth; }
00137     
00138     void setBandwidth(size_t bandwidth) {
00139         _bandwidth = bandwidth;
00140     }
00141 
00143     //
00145     double currentFPS() const { return _currentFPS; }
00146     
00148     //
00150     double fps() const { return _fps; }
00151 
00153     size_t height() const { return _height; }
00154     
00156     size_t width() const { return _width; }
00157     
00159     size_t index() const { return _index; }
00160     
00162     //
00167     void requestMode(size_t width, size_t height, double fps, bool favorArea);
00168 
00170     void setMotionLevel(int m) { _motionLevel = m; }
00171 
00173     int motionLevel() const { return _motionLevel; }
00174     
00176     void setMotionTimeout(int m) { _motionTimeout = m; }
00177 
00179     int motionTimeout() const { return _motionTimeout; }
00180     
00181     void mute(bool m) { _muted = m; }
00182     bool muted() const { return _muted; }
00183     
00185     //
00187     const std::string& name() const { return _name; }
00188 
00190     void setQuality(int q) { _quality = q; }
00191 
00193     int quality() const { return _quality; }
00194     
00199     bool play();
00200     
00204     bool stop();
00205     
00206 
00208     //
00218     bool setWebcam(size_t index);
00219     
00221     //
00223     //
00226     bool init();
00227     
00236     int makeWebcamDeviceSelection();
00237     
00241     
00249     gboolean webcamMakeVideoSaveLink();
00250 
00256     gboolean webcamBreakVideoSaveLink();
00257 
00268     gboolean webcamCreateSaveBin();
00269     
00278     gboolean webcamMakeVideoDisplayLink();
00279     
00287     gboolean webcamBreakVideoDisplayLink();
00288 
00289 private:
00290 
00291     
00305     void getSelectedCaps(gint dev_select);
00306     
00317     void getSupportedFormats(GnashWebcam *cam, GstCaps *caps);
00318     
00328     void addSupportedFormat(GnashWebcam *cam, WebcamVidFormat *video_format,
00329         GstStructure *format_structure);
00330     
00343     void getSupportedFramerates(WebcamVidFormat *video_format,
00344             GstStructure *structure);
00345 
00352     gboolean checkForSupportedFramerate (GnashWebcamPrivate *webcam, int fps);
00353 
00362     void findHighestFramerate(WebcamVidFormat *format);
00363     
00374     gboolean webcamCreateSourceBin();
00375     
00381     gboolean webcamChangeSourceBin();
00382     
00393     gboolean webcamCreateMainBin();
00394     
00405     gboolean webcamCreateDisplayBin();
00406     
00407     
00408     
00412     GnashWebcamPrivate* getGlobalWebcam() {return _globalWebcam;}
00413     
00418     //
00421     static void findVidDevs(std::vector<GnashWebcam*>& cams);
00422     
00425     std::vector<GnashWebcam*> _vidVect;
00426     
00430     int _devSelection;
00431     
00435     gint _numdevs;
00436     
00440     GnashWebcamPrivate *_globalWebcam;
00441 
00445 
00448     double _activityLevel;
00449 
00452     size_t _bandwidth;
00453 
00456     double _currentFPS;
00457 
00459     double _fps;
00460 
00463     size_t _height;
00464 
00467     size_t _width;
00468 
00470     size_t _index;
00471 
00473     int _motionLevel;
00474 
00476     int _motionTimeout;
00477 
00480     bool _muted;
00481 
00483     std::string _name;
00484 
00486     int _quality;
00487 
00488 };
00489 
00490 
00491 
00492 
00493 } //gst namespace
00494 } // gnash.media namespace 
00495 } // gnash namespace
00496 
00497 #endif 

Generated on Thu Sep 30 2010 14:35:04 for Gnash by  doxygen 1.7.1