Commit 7565a206 by xiongziliang

startRecord API with "customized_path" #279

parent 0eb97d54
...@@ -77,8 +77,8 @@ int MultiMuxerPrivate::totalReaderCount() const { ...@@ -77,8 +77,8 @@ int MultiMuxerPrivate::totalReaderCount() const {
return (_rtsp ? _rtsp->readerCount() : 0) + (_rtmp ? _rtmp->readerCount() : 0) + (hls_src ? hls_src->readerCount() : 0); return (_rtsp ? _rtsp->readerCount() : 0) + (_rtmp ? _rtmp->readerCount() : 0) + (hls_src ? hls_src->readerCount() : 0);
} }
static std::shared_ptr<MediaSinkInterface> makeRecorder(const vector<Track::Ptr> &tracks, Recorder::type type, MediaSource &sender){ static std::shared_ptr<MediaSinkInterface> makeRecorder(const vector<Track::Ptr> &tracks, Recorder::type type, const string &custom_path, MediaSource &sender){
auto recorder = Recorder::createRecorder(type, sender.getVhost(), sender.getApp(), sender.getId()); auto recorder = Recorder::createRecorder(type, sender.getVhost(), sender.getApp(), sender.getId(), custom_path);
for (auto &track : tracks) { for (auto &track : tracks) {
recorder->addTrack(track); recorder->addTrack(track);
} }
...@@ -91,7 +91,7 @@ bool MultiMuxerPrivate::setupRecord(MediaSource &sender, Recorder::type type, bo ...@@ -91,7 +91,7 @@ bool MultiMuxerPrivate::setupRecord(MediaSource &sender, Recorder::type type, bo
case Recorder::type_hls : { case Recorder::type_hls : {
if (start && !_hls) { if (start && !_hls) {
//开始录制 //开始录制
_hls = makeRecorder(getTracks(true), type, sender); _hls = makeRecorder(getTracks(true), type, custom_path, sender);
auto hls_src = getHlsMediaSource(); auto hls_src = getHlsMediaSource();
if (hls_src) { if (hls_src) {
//设置HlsMediaSource的事件监听器 //设置HlsMediaSource的事件监听器
...@@ -107,7 +107,7 @@ bool MultiMuxerPrivate::setupRecord(MediaSource &sender, Recorder::type type, bo ...@@ -107,7 +107,7 @@ bool MultiMuxerPrivate::setupRecord(MediaSource &sender, Recorder::type type, bo
case Recorder::type_mp4 : { case Recorder::type_mp4 : {
if (start && !_mp4) { if (start && !_mp4) {
//开始录制 //开始录制
_mp4 = makeRecorder(getTracks(true), type, sender);; _mp4 = makeRecorder(getTracks(true), type, custom_path, sender);
} else if (!start && _mp4) { } else if (!start && _mp4) {
//停止录制 //停止录制
_mp4 = nullptr; _mp4 = nullptr;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论