规范类命名

This commit is contained in:
xiongziliang
2019-08-22 16:25:19 +08:00
parent 61d8c526ab
commit c6e9f8365d
8 changed files with 51 additions and 51 deletions

View File

@@ -28,7 +28,7 @@
#include <ctime>
#include <sys/stat.h>
#include "Common/config.h"
#include "Mp4Maker.h"
#include "MP4Recorder.h"
#include "Util/util.h"
#include "Util/NoticeCenter.h"
#include "Thread/WorkThreadPool.h"
@@ -53,7 +53,7 @@ string timeStr(const char *fmt) {
return buffer;
}
Mp4Maker::Mp4Maker(const string& strPath,
MP4Recorder::MP4Recorder(const string& strPath,
const string &strVhost,
const string &strApp,
const string &strStreamId) {
@@ -64,11 +64,11 @@ Mp4Maker::Mp4Maker(const string& strPath,
_info.strVhost = strVhost;
_info.strFolder = strPath;
}
Mp4Maker::~Mp4Maker() {
MP4Recorder::~MP4Recorder() {
closeFile();
}
void Mp4Maker::createFile() {
void MP4Recorder::createFile() {
closeFile();
auto strDate = timeStr("%Y-%m-%d");
auto strTime = timeStr("%H-%M-%S");
@@ -100,7 +100,7 @@ void Mp4Maker::createFile() {
}
}
void Mp4Maker::asyncClose() {
void MP4Recorder::asyncClose() {
auto muxer = _muxer;
auto strFileTmp = _strFileTmp;
auto strFile = _strFile;
@@ -121,14 +121,14 @@ void Mp4Maker::asyncClose() {
});
}
void Mp4Maker::closeFile() {
void MP4Recorder::closeFile() {
if (_muxer) {
asyncClose();
_muxer = nullptr;
}
}
void Mp4Maker::onTrackFrame(const Frame::Ptr &frame) {
void MP4Recorder::onTrackFrame(const Frame::Ptr &frame) {
GET_CONFIG(uint32_t,recordSec,Record::kFileSecond);
if(!_muxer || ((_createFileTicker.elapsedTime() > recordSec * 1000) &&
(!_haveVideo || (_haveVideo && frame->keyFrame()))) ){
@@ -145,7 +145,7 @@ void Mp4Maker::onTrackFrame(const Frame::Ptr &frame) {
}
}
void Mp4Maker::onTrackReady(const Track::Ptr & track){
void MP4Recorder::onTrackReady(const Track::Ptr & track){
//保存所有的track为创建MP4MuxerFile做准备
_tracks.emplace_back(track);
if(track->getTrackType() == TrackVideo){

View File

@@ -55,14 +55,14 @@ public:
string strStreamId;//流ID
string strVhost;//vhost
};
class Mp4Maker : public MediaSink{
class MP4Recorder : public MediaSink{
public:
typedef std::shared_ptr<Mp4Maker> Ptr;
Mp4Maker(const string &strPath,
typedef std::shared_ptr<MP4Recorder> Ptr;
MP4Recorder(const string &strPath,
const string &strVhost ,
const string &strApp,
const string &strStreamId);
virtual ~Mp4Maker();
virtual ~MP4Recorder();
private:
/**
* Track输出frameonAllTrackReady触发后才会调用此方法

View File

@@ -58,10 +58,10 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
string m3u8FilePath;
if(enableVhost){
m3u8FilePath = hlsPath + "/" + strVhost + "/" + strApp + "/" + strId + "/hls.m3u8";
_hlsMaker.reset(new HlsRecorder(m3u8FilePath,string(VHOST_KEY) + "=" + strVhost ,hlsBufSize, hlsDuration, hlsNum));
_hlsRecorder.reset(new HlsRecorder(m3u8FilePath,string(VHOST_KEY) + "=" + strVhost ,hlsBufSize, hlsDuration, hlsNum));
}else{
m3u8FilePath = hlsPath + "/" + strApp + "/" + strId + "/hls.m3u8";
_hlsMaker.reset(new HlsRecorder(m3u8FilePath,"",hlsBufSize, hlsDuration, hlsNum));
_hlsRecorder.reset(new HlsRecorder(m3u8FilePath,"",hlsBufSize, hlsDuration, hlsNum));
}
}
#endif //defined(ENABLE_HLS)
@@ -77,7 +77,7 @@ MediaRecorder::MediaRecorder(const string &strVhost_tmp,
} else {
mp4FilePath = recordPath + "/" + recordAppName + "/" + strApp + "/" + strId + "/";
}
_mp4Maker.reset(new Mp4Maker(mp4FilePath,strVhost,strApp,strId));
_mp4Recorder.reset(new MP4Recorder(mp4FilePath,strVhost,strApp,strId));
}
#endif //defined(ENABLE_MP4V2)
}
@@ -87,28 +87,28 @@ MediaRecorder::~MediaRecorder() {
void MediaRecorder::inputFrame(const Frame::Ptr &frame) {
#if defined(ENABLE_HLS)
if (_hlsMaker) {
_hlsMaker->inputFrame(frame);
if (_hlsRecorder) {
_hlsRecorder->inputFrame(frame);
}
#endif //defined(ENABLE_HLS)
#if defined(ENABLE_MP4V2)
if (_mp4Maker) {
_mp4Maker->inputFrame(frame);
if (_mp4Recorder) {
_mp4Recorder->inputFrame(frame);
}
#endif //defined(ENABLE_MP4V2)
}
void MediaRecorder::addTrack(const Track::Ptr &track) {
#if defined(ENABLE_HLS)
if (_hlsMaker) {
_hlsMaker->addTrack(track);
if (_hlsRecorder) {
_hlsRecorder->addTrack(track);
}
#endif //defined(ENABLE_HLS)
#if defined(ENABLE_MP4RECORD)
if (_mp4Maker) {
_mp4Maker->addTrack(track);
if (_mp4Recorder) {
_mp4Recorder->addTrack(track);
}
#endif //defined(ENABLE_MP4RECORD)
}

View File

@@ -30,7 +30,7 @@
#include <memory>
#include "Player/PlayerBase.h"
#include "Common/MediaSink.h"
#include "Mp4Maker.h"
#include "MP4Recorder.h"
#include "HlsRecorder.h"
using namespace toolkit;
@@ -61,11 +61,11 @@ public:
void addTrack(const Track::Ptr & track) override;
private:
#if defined(ENABLE_HLS)
std::shared_ptr<HlsRecorder> _hlsMaker;
std::shared_ptr<HlsRecorder> _hlsRecorder;
#endif //defined(ENABLE_HLS)
#if defined(ENABLE_MP4RECORD)
std::shared_ptr<Mp4Maker> _mp4Maker;
std::shared_ptr<MP4Recorder> _mp4Recorder;
#endif //defined(ENABLE_MP4RECORD)
};