Skip to content
Snippets Groups Projects
Select Git revision
  • f070afb3791b62eb0053f6f83f7d5093d628e5f6
  • master default protected
  • release/202005
  • release/202001
  • release/201912
  • release/201911
  • release/releaseWindowsTestOne
  • release/releaseTest
  • release/releaseWindowsTest
  • release/windowsReleaseTest
  • release/201910
  • release/qt/201910
  • release/windows-test/201910
  • release/201908
  • release/201906
  • release/201905
  • release/201904
  • release/201903
  • release/201902
  • release/201901
  • release/201812
  • 1.0.0
  • 0.3.0
  • 0.2.1
  • 0.2.0
  • 0.1.0
26 results

videodevice.h

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    videodevice.h 2.91 KiB
    /****************************************************************************
     *   Copyright (C) 2012-2013 by Savoir-Faire Linux                          *
     *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
     *                                                                          *
     *   This library is free software; you can redistribute it and/or          *
     *   modify it under the terms of the GNU Lesser General Public             *
     *   License as published by the Free Software Foundation; either           *
     *   version 2.1 of the License, or (at your option) any later version.     *
     *                                                                          *
     *   This library is distributed in the hope that it will be useful,        *
     *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
     *   Lesser General Public License for more details.                        *
     *                                                                          *
     *   You should have received a copy of the GNU General Public License      *
     *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
     ***************************************************************************/
    #ifndef VIDEO_DEVICE_H
    #define VIDEO_DEVICE_H
    
    #include "typedefs.h"
    
    //Qt
    #include <QStringList>
    #include <QtCore/QSize>
    
    ///@typedef VideoChannel A channel available in a Device
    typedef QString VideoChannel;
    
    ///@typedef VideoRate The rate for a device
    typedef QString VideoRate;
    
    ///@struct Resolution Equivalent of "640x480"
    class LIB_EXPORT Resolution : public QSize {
    public:
       //Constructor
       Resolution(uint _width, uint _height);
       Resolution(const QString& size);
       Resolution(const Resolution& res);
       Resolution(const QSize& size);
       //Getter
       const QString toString() const;
    
    };
    
    ///VideoDevice: V4L devices used to record video for video call
    class LIB_EXPORT VideoDevice {
       public:
          //Singleton
          static VideoDevice* getDevice(QString id);
    
          //Getter
          const QStringList         rateList(VideoChannel channel, Resolution resolution);
          const QList<Resolution>   resolutionList(VideoChannel channel);
          const QList<VideoChannel> channelList ();
          const Resolution          resolution  ();
          const VideoChannel        channel     ();
          const VideoRate           rate        ();
          const QString             deviceId    () const;
          
          //Static getter
          static const QList<VideoDevice*> deviceList();
    
          //Setter
          void setRate       ( VideoRate rate        );
          void setResolution ( Resolution resolution );
          void setChannel    ( VideoChannel channel  );
       private:
          //Constructor
          explicit VideoDevice(QString id);
    
          //Attributes
          QString m_DeviceId;
          static QHash<QString,VideoDevice*> m_slDevices;
          static bool m_sInit;
    };
    #endif