From 88c21b872799a1ae9dd7dd7d20f3811d749d9418 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期五, 26 七月 2019 14:04:22 +0800 Subject: [PATCH] add rec --- csrc/buz/recorder.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/csrc/buz/recorder.cpp b/csrc/buz/recorder.cpp index 4bfd370..2267bf3 100644 --- a/csrc/buz/recorder.cpp +++ b/csrc/buz/recorder.cpp @@ -17,7 +17,7 @@ namespace cffmpeg_wrap{ namespace buz{ - Recorder::Recorder(FormatIn *in) + Recorder::Recorder(FormatIn *in, const std::string &id) :in_(in) ,out_(NULL) ,maxduration(30 * 25) @@ -26,6 +26,7 @@ ,cur_frame(-1) ,thread_(nullptr) ,stop_recorder_(false) + ,id_(id) ,id_frame_(0) ,file_frame_index_(-1) ,file_path_("") @@ -59,6 +60,7 @@ void Recorder::start_writer(){ if (cur_frame == 0) { + srandom(time(NULL)); file_path_ = dir_ + "/" + std::to_string(random()) + ".mp4"; out_->JustWriter(in_->getStream(), file_path_.c_str()); logIt("start record %s", file_path_.c_str()); @@ -95,7 +97,7 @@ } //callback to frame index and path if(func_rec_info_){ - func_rec_info_(file_frame_index_, file_path_); + func_rec_info_(id_,file_frame_index_, file_path_); // logIt("recoder index %d, file name %s\n", file_frame_index_, file_path_.c_str()); }else{ // logIt("recorder has no func_rec_info"); -- Gitblit v1.8.0