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:
|
2024-03-04 16:22:40 +08:00
|
|
|
enum PlaybackState {
|
|
|
|
Stop,
|
|
|
|
Playback,
|
|
|
|
Pause,
|
|
|
|
Error
|
|
|
|
};
|
2024-01-18 15:41:43 +08:00
|
|
|
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;
|
|
|
|
|
2024-03-04 16:22:40 +08:00
|
|
|
LinkObject* overlay;
|
|
|
|
|
2024-01-18 15:41:43 +08:00
|
|
|
LinkObject* record;
|
2024-03-04 16:22:40 +08:00
|
|
|
LinkObject* snap;
|
|
|
|
// 单个视频时长
|
2024-01-18 15:41:43 +08:00
|
|
|
int duration = 1 * 60 * 1000;
|
|
|
|
bool isRecord = false;
|
|
|
|
|
2024-03-04 16:22:40 +08:00
|
|
|
LinkObject* file;
|
|
|
|
LinkObject* image;
|
|
|
|
LinkObject* videoDecoder;
|
|
|
|
LinkObject* audioDecoder;
|
|
|
|
PlaybackState state = Stop;
|
2024-01-18 15:41:43 +08:00
|
|
|
|
|
|
|
static LinkObject* rtspServer;
|
|
|
|
LinkObject* rtsp;
|
|
|
|
QString pushCode;
|
|
|
|
|
|
|
|
void startRecord();
|
|
|
|
void stopRecord();
|
|
|
|
|
2024-03-04 16:22:40 +08:00
|
|
|
int playbackDuration = 0;
|
|
|
|
bool startPlayback(QString path);
|
2024-01-18 15:41:43 +08:00
|
|
|
void forward();
|
2024-03-04 16:22:40 +08:00
|
|
|
void back();
|
2024-01-18 15:41:43 +08:00
|
|
|
void togglePause();
|
2024-03-04 16:22:40 +08:00
|
|
|
|
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();
|
2024-03-04 16:22:40 +08:00
|
|
|
void showRecordState(bool state);
|
2024-01-18 15:41:43 +08:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onTimeout();
|
|
|
|
|
|
|
|
private:
|
2024-03-04 16:22:40 +08:00
|
|
|
// 用于分段录制的计时器
|
2024-01-18 15:41:43 +08:00
|
|
|
QTimer* timer;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool isMountDisk();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CHANNEL_H
|