| | |
| | | ,minduration(10 * 25) |
| | | ,end_frame(minduration) |
| | | ,cur_frame(-1) |
| | | ,thread_(nullptr) |
| | | ,stop_recorder_(false) |
| | | ,id_(id) |
| | | ,id_frame_(0) |
| | |
| | | {} |
| | | |
| | | Recorder::~Recorder(){ |
| | | if(thread_){ |
| | | stop_recorder_.store(true); |
| | | cv_.notify_one(); |
| | | thread_->join(); |
| | | } |
| | | if(out_) |
| | | delete out_; |
| | | stop_recorder_.store(true); |
| | | cv_.notify_one(); |
| | | } |
| | | |
| | | int Recorder::init_writer(){ |
| | |
| | | } |
| | | } |
| | | } |
| | | if (out_){ |
| | | delete out_; |
| | | out_ = NULL; |
| | | } |
| | | } |
| | | |
| | | int Recorder::Run(const char* output, const int mind, const int maxd){ |
| | | if(thread_){ |
| | | logIt("recorder already run"); |
| | | return 0; |
| | | } |
| | | |
| | | dir_ = output; |
| | | int ret = init_writer(); |
| | |
| | | |
| | | logIt("min %d max %d endcount %d", minduration, maxduration, end_frame); |
| | | |
| | | thread_.reset(new std::thread([&]{ |
| | | std::thread([&]{ |
| | | run_thread(); |
| | | })); |
| | | }).detach(); |
| | | |
| | | return 0; |
| | | } |