VideoManager.h 2.64 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 59
    // Override from QGCTool
    void        setToolbox          (QGCToolbox *toolbox);

signals:
60 61 62
    void hasVideoChanged            ();
    void isGStreamerChanged         ();
    void videoSourceIDChanged       ();
63
    void fullScreenChanged          ();
64

65
private slots:
66 67 68
    void _videoSourceChanged        ();
    void _udpPortChanged            ();
    void _rtspUrlChanged            ();
69
    void _tcpUrlChanged             ();
70

71
private:
72 73
    void _updateSettings            ();
    void _restartVideo              ();
74

75 76
    VideoReceiver*  _videoReceiver;
    VideoSettings*  _videoSettings;
77
    QString         _videoSourceID;
78
    bool            _fullScreen;
79 80 81
};

#endif