VideoReceiver.h 2.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
/****************************************************************************
 *
 * (c) 2009-2020 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.
 *
 ****************************************************************************/

/**
 * @file
 *   @brief QGC Video Receiver
 *   @author Gus Grubba <gus@auterion.com>
 */

#pragma once

#include <QObject>
#include <QSize>

class VideoReceiver : public QObject
{
    Q_OBJECT

public:
    explicit VideoReceiver(QObject* parent = nullptr)
        : QObject(parent)
    {}

    virtual ~VideoReceiver(void) {}

    typedef enum {
        FILE_FORMAT_MIN = 0,
        FILE_FORMAT_MKV = FILE_FORMAT_MIN,
        FILE_FORMAT_MOV,
        FILE_FORMAT_MP4,
        FILE_FORMAT_MAX
    } FILE_FORMAT;

40 41 42 43 44 45 46 47 48 49
    typedef enum {
        STATUS_OK = 0,
        STATUS_FAIL,
        STATUS_INVALID_STATE,
        STATUS_INVALID_URL,
        STATUS_NOT_IMPLEMENTED
    } STATUS;

    Q_ENUM(STATUS)

50 51
signals:
    void timeout(void);
52 53 54
    void streamingChanged(bool active);
    void decodingChanged(bool active);
    void recordingChanged(bool active);
55
    void recordingStarted(void);
56
    void videoSizeChanged(QSize size);
57 58 59 60 61 62 63 64

    void onStartComplete(STATUS status);
    void onStopComplete(STATUS status);
    void onStartDecodingComplete(STATUS status);
    void onStopDecodingComplete(STATUS status);
    void onStartRecordingComplete(STATUS status);
    void onStopRecordingComplete(STATUS status);
    void onTakeScreenshotComplete(STATUS status);
65

66
public slots:
67 68 69 70 71
    // buffer:
    //      -1 - disable buffer and video sync
    //      0 - default buffer length
    //      N - buffer length, ms
    virtual void start(const QString& uri, unsigned timeout, int buffer = 0) = 0;
72 73 74 75 76 77 78
    virtual void stop(void) = 0;
    virtual void startDecoding(void* sink) = 0;
    virtual void stopDecoding(void) = 0;
    virtual void startRecording(const QString& videoFile, FILE_FORMAT format) = 0;
    virtual void stopRecording(void) = 0;
    virtual void takeScreenshot(const QString& imageFile) = 0;
};