RecordControlApplication/Channel.h
2024-08-11 20:26:42 -07:00

94 lines
2.2 KiB
C++
Executable File
Raw Permalink 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);
void init();
// 录制
void startRecord();
void stopRecord();
// 回放
bool startPlayback(QString path);
void forward();
void back();
void togglePause();
void startPlayLive();
void showFinishPromot();
// 音量
QVariantMap getVolume();
void volumeUp();
void volumeDown();
public:
QString channelName;
LinkObject* videoInput;
LinkObject* videoEncoder;
QVariantMap videoEncoderParams;
LinkObject* videoOutput;
static LinkObject* lineIn; // 外部音频输入
static LinkObject* resample; // 重采样
static LinkObject* lineOut; // 外部音频输出
LinkObject* gain; // 音量增益
LinkObject* volume; // 音量
int maxGian = 30;
int minGain = -30;
int curGain = 0;
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);
private:
void loadOverlayConfig();
};
#endif // CHANNEL_H