RecordControlApplication/Channel.h
2024-01-17 23:41:43 -08:00

90 lines
1.7 KiB
C++

#ifndef CHANNEL_H
#define CHANNEL_H
#include "Link.h"
#include <QObject>
#include <QTimer>
class Channel : public QObject {
Q_OBJECT
public:
explicit Channel(QObject* parent = nullptr);
void init();
QString channelName;
LinkObject* videoInput;
LinkObject* videoEncoder;
QVariantMap videoEncoderParams;
LinkObject* videoOutput;
static LinkObject* audioInput;
static LinkObject* audioOutput;
LinkObject* audioEncoder;
QVariantMap audioEncoderParams;
LinkObject* record;
// 1 hour each video
int duration = 1 * 60 * 1000;
bool isRecord = false;
LinkObject* snap;
LinkObject* overLay;
static LinkObject* file;
static LinkObject* videoDecoder;
static LinkObject* audioDecoder;
bool isPlayback = false;
bool isPause = false;
static LinkObject* rtspServer;
LinkObject* rtsp;
QString pushCode;
void startRecord();
void stopRecord();
void recordPause();
void startPlayback(QString fileName);
void back();
void forward();
void togglePause();
void startPlayLive();
signals:
private slots:
void onTimeout();
private:
// timer used to record segement
QTimer* timer;
private:
QString writeCom(const QString& com);
bool isMountDisk();
inline void setOverlay(QString str);
};
inline void Channel::setOverlay(QString str)
{
QVariantMap dataOver;
QVariantList lays;
QVariantMap lay;
lay["type"] = "text";
lay["enable"] = true;
lay["font"] = "/link/res/font.ttf";
lay["content"] = str;
lay["x"] = 0.1;
lay["y"] = 0.1;
lay["scale"] = 2;
lay["color"] = "#669900";
lay["alpha"] = 1;
lays << lay;
dataOver["lays"] = lays;
overLay->setData(dataOver);
}
#endif // CHANNEL_H