VideoManager.h 2.76 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/


#ifndef VideoManager_H
#define VideoManager_H

#include <QObject>
#include <QTimer>
16
#include <QUrl>
17 18 19 20 21 22 23

#include "QGCLoggingCategory.h"
#include "VideoReceiver.h"
#include "QGCToolbox.h"

Q_DECLARE_LOGGING_CATEGORY(VideoManagerLog)

24 25
class VideoSettings;

26 27 28 29 30
class VideoManager : public QGCTool
{
    Q_OBJECT

public:
31
    VideoManager    (QGCApplication* app, QGCToolbox* toolbox);
32 33
    ~VideoManager   ();

34 35 36 37
    Q_PROPERTY(bool             hasVideo            READ    hasVideo                                    NOTIFY hasVideoChanged)
    Q_PROPERTY(bool             isGStreamer         READ    isGStreamer                                 NOTIFY isGStreamerChanged)
    Q_PROPERTY(QString          videoSourceID       READ    videoSourceID                               NOTIFY videoSourceIDChanged)
    Q_PROPERTY(bool             uvcEnabled          READ    uvcEnabled                                  CONSTANT)
38
    Q_PROPERTY(bool             fullScreen          READ    fullScreen      WRITE   setfullScreen       NOTIFY fullScreenChanged)
39
    Q_PROPERTY(VideoReceiver*   videoReceiver       READ    videoReceiver                               CONSTANT)
40

41 42
    bool        hasVideo            ();
    bool        isGStreamer         ();
43
    bool        fullScreen          () { return _fullScreen; }
44
    QString     videoSourceID       () { return _videoSourceID; }
45

46 47
    VideoReceiver*  videoReceiver   () { return _videoReceiver; }

48 49 50 51 52 53
#if defined(QGC_DISABLE_UVC)
    bool        uvcEnabled          () { return false; }
#else
    bool        uvcEnabled          ();
#endif

54 55
    void        setfullScreen       (bool f) { _fullScreen = f; emit fullScreenChanged(); }

56 57 58
    // Override from QGCTool
    void        setToolbox          (QGCToolbox *toolbox);

Patrick José Pereira's avatar
Patrick José Pereira committed
59 60 61
    Q_INVOKABLE void startVideo() {_videoReceiver->stop();};
    Q_INVOKABLE void stopVideo() {_videoReceiver->stop();};

62
signals:
63 64 65
    void hasVideoChanged            ();
    void isGStreamerChanged         ();
    void videoSourceIDChanged       ();
66
    void fullScreenChanged          ();
67

68
private slots:
69 70 71
    void _videoSourceChanged        ();
    void _udpPortChanged            ();
    void _rtspUrlChanged            ();
72
    void _tcpUrlChanged             ();
73

74
private:
75 76
    void _updateSettings            ();
    void _restartVideo              ();
77

78 79
    VideoReceiver*  _videoReceiver;
    VideoSettings*  _videoSettings;
80
    QString         _videoSourceID;
81
    bool            _fullScreen;
82 83 84
};

#endif