RecordControlApplication/Channel.h

126 lines
3.3 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
};
enum Resolution {
VO_OUTPUT_1080I60,
VO_OUTPUT_1600x1200_60,
VO_OUTPUT_1280x1024_60,
VO_OUTPUT_1280x720_60,
VO_OUTPUT_1024x768_60,
VO_OUTPUT_800x600_60
};
explicit Channel(const QString& name, const QVariantMap& params, QObject* parent = nullptr);
~Channel();
void init();
// 输出分辨率
void changeOutputResolution(Resolution resolution);
void changeInputResolution(int width, int height);
// 录制
void startRecord();
void stopRecord();
// 回放
bool startPlayback(QString path);
void seek(int pos);
void togglePause();
void startPlayLive();
void showFinishPromot();
// 音量
static QVariantMap getVolume();
static void volumeUp();
static void volumeDown();
public:
QString channelName;
// 视频输入输出
LinkObject* videoInput = nullptr;
LinkObject* videoOutput = nullptr;
QVariantMap videoOutputParams;
// 视频编码
LinkObject* videoEncoder = nullptr;
QVariantMap videoEncoderParams;
// 外接音频输入输出
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 = nullptr; // 通道音频输入
LinkObject* audioOutput = nullptr; // 通道音频输入
LinkObject* audioEncoder = nullptr; // 音频编码器
QVariantMap audioEncoderParams; // 编码参数
// 视频录制
LinkObject* record = nullptr;
LinkObject* calDuration = nullptr;
LinkObject* calAudioDecoder = nullptr;
LinkObject* calVideoDecoder = nullptr;
int duration = 10 * 60 * 1000; // 单个视频时长
bool isRecord = false;
QString startTime; // 本次录制文件的开始时间
QString curTime; // 当前录制文件的开始时间
int segmentId = 0; // 分片录制的id
// 水印
LinkObject* overlay = nullptr; // 水印,提示是否在录制视频
QVariantMap recordOverlay; // 录制状态下的水印参数
QVariantMap norecordOverlay; // 非录制状态下的水印参数
// 视频回放
int playbackDuration = 0; // 当前播放视频的时长单位ms
LinkObject* inputFile = nullptr;
LinkObject* videoDecoder = nullptr;
LinkObject* audioDecoder = nullptr;
LinkObject* image = nullptr;
PlaybackState state = Stop;
// 视频推流
static LinkObject* rtspServer;
LinkObject* rtsp = nullptr;
QString pushCode;
QMap<Resolution, QString> resolutionMap; // 分辨率列表
private slots:
void onNewEvent(QString msg, QVariant data);
void saveVideoInfo(QString curTime, int segmentId);
signals:
void playEnd();
void showRecordState(bool state);
void appendOneVideo();
private:
void loadOverlayConfig();
};
#endif // CHANNEL_H