| | |
| | | |
| | | namespace cffmpeg_wrap{ |
| | | namespace buz{ |
| | | Recorder::Recorder(FormatIn *in) |
| | | Recorder::Recorder(FormatIn *in, const std::string &id) |
| | | :in_(in) |
| | | ,out_(NULL) |
| | | ,maxduration(30 * 25) |
| | |
| | | ,cur_frame(-1) |
| | | ,thread_(nullptr) |
| | | ,stop_recorder_(false) |
| | | ,id_(id) |
| | | ,id_frame_(0) |
| | | ,file_frame_index_(-1) |
| | | ,file_path_("") |
| | |
| | | |
| | | 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()); |
| | |
| | | } |
| | | //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"); |