RecordControlApplication/Channel.h

96 lines
2.4 KiB
C++
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CHANNEL_H
#define CHANNEL_H
#include "Json.h"
#include "Link.h"
#include <QObject>
#include <QTimer>
class Channel : public QObject {
Q_OBJECT
public:
enum PlaybackState {
Stop,
Playback,
Pause,
Error,
Finish
};
explicit Channel(QObject* parent = nullptr);
~Channel();
void init();
// 录制
void startRecord();
void stopRecord();
// 回放
bool startPlayback(QString path);
void forward();
void back();
void togglePause();
void startPlayLive();
void showFinishPromot();
// 音量
static QVariantMap getVolume();
static void volumeUp();
static void volumeDown();
public:
QString channelName;
LinkObject* videoInput;
LinkObject* videoEncoder;
QVariantMap videoEncoderParams;
LinkObject* videoOutput;
static LinkObject* lineIn; // 外部音频输入
static LinkObject* resample; // 重采样
static LinkObject* lineOut; // 外部音频输出
static LinkObject* gain; // 音量增益
static LinkObject* volume; // 音量
static int maxGian; // 最大增益
static int minGain; // 最小增益
static int curGain; // 当前增益
LinkObject* audioInput; // 通道音频输入
LinkObject* audioOutput; // 通道音频输入
LinkObject* audioEncoder; // 音频编码器
QVariantMap audioEncoderParams; // 编码参数
LinkObject* record;
int duration = 1 * 60 * 1000; // 单个视频时长
bool isRecord = false;
QString startTime; // 本次录制文件的开始时间
QString currentTime; // 当前录制文件的开始时间
int segmentId = 0;
LinkObject* overlay; // 水印,提示是否在录制视频
QVariantMap recordOverlay; // 录制状态下的水印参数
QVariantMap norecordOverlay; // 非录制状态下的水印参数
int playbackDuration = 0; // 当前播放视频的时长单位ms
LinkObject* inputFile;
LinkObject* videoDecoder;
LinkObject* audioDecoder;
LinkObject* image;
PlaybackState state = Stop;
static LinkObject* rtspServer;
LinkObject* rtsp;
QString pushCode;
private slots:
void onNewEvent(QString msg, QVariant data);
signals:
void playEnd();
void showRecordState(bool state);
void appendOneVideo(QString channelName);
private:
void loadOverlayConfig();
};
#endif // CHANNEL_H