2024-01-18 15:41:43 +08:00
|
|
|
#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;
|
2024-01-25 09:57:08 +08:00
|
|
|
bool autoRecord = false;
|
2024-01-18 15:41:43 +08:00
|
|
|
// 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();
|
2024-01-25 09:57:08 +08:00
|
|
|
int getDuration(QString fileName);
|
2024-01-18 15:41:43 +08:00
|
|
|
void startPlayLive();
|
2024-01-25 09:57:08 +08:00
|
|
|
|
2024-01-18 15:41:43 +08:00
|
|
|
signals:
|
2024-01-25 09:57:08 +08:00
|
|
|
void playEnd();
|
|
|
|
void signalInputed(QString name, int width, int height);
|
2024-01-18 15:41:43 +08:00
|
|
|
|
|
|
|
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
|