| | |
| | | ,scale_w_(0) |
| | | ,scale_h_(0) |
| | | ,scale_f_(SWS_POINT) |
| | | ,audio_(false) |
| | | ,gb_(0) |
| | | ,cpu_(0) |
| | | ,thread_(nullptr) |
| | |
| | | } |
| | | } |
| | | |
| | | void Wrapper::ScalePicture(const int w, const int h, const int flags){ |
| | | scale_w_ = w; |
| | | scale_f_ = flags; |
| | | scale_h_ = h; |
| | | } |
| | | |
| | | void Wrapper::GB28181(){ |
| | | gb_ = 1; |
| | | } |
| | | |
| | | void Wrapper::CPUDec(){ |
| | | cpu_ = 1; |
| | | } |
| | | |
| | | std::unique_ptr<ffwrapper::FormatIn> Wrapper::init_reader(const char* input){ |
| | | |
| | | VideoProp prop; |
| | |
| | | } |
| | | if(flag == 0){ |
| | | if(!in->findStreamInfo(NULL)){ |
| | | logIt("yolo can't find video stream\n"); |
| | | logIt("can't find video stream\n"); |
| | | return nullptr; |
| | | } |
| | | |
| | |
| | | return 0; |
| | | } |
| | | |
| | | void Wrapper::AudioSwitch(const bool a){ |
| | | audio_ = a; |
| | | if (stream_){ |
| | | stream_->AudioSwitch(a); |
| | | } |
| | | } |
| | | |
| | | void Wrapper::init_worker(ffwrapper::FormatIn *in){ |
| | | if (rec_->Loaded() && stream_ && decoder_) return; |
| | | stream_ = new stream(3 * 25); |
| | | stream_ = new stream(in, 3 * 25); |
| | | stream_->AudioSwitch(audio_); |
| | | |
| | | decoder_ = new decoder(in, scale_w_, scale_h_, scale_f_); |
| | | |
| | | rec_->Load(in); |
| | | if(fn_rec_lazy_) fn_rec_lazy_(in); |
| | | } |
| | | |
| | | void Wrapper::run_worker(std::shared_ptr<ffwrapper::CodedData> data, int64_t &id){ |
| | | void Wrapper::run_worker(ffwrapper::FormatIn *in, std::shared_ptr<ffwrapper::CodedData> data, int64_t &id){ |
| | | |
| | | if (stream_) stream_->SetPacket(data); |
| | | if (decoder_) decoder_->SetFrame(data, id); |
| | | if (rec_->Loaded()) rec_->SetPacket(data, id); |
| | |
| | | break; |
| | | } |
| | | |
| | | run_worker(data, id); |
| | | run_worker(in.get(), data, id); |
| | | id++; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | void Wrapper::BuildRecorder(const char* id, const char *output, const int mindur, const int maxdur){ |
| | | void Wrapper::BuildRecorder(const char* id, const char *output, const int mindur, const int maxdur, const bool audio){ |
| | | |
| | | if (rec_->Loaded()){ |
| | | rec_->NewRec(id, output, mindur, maxdur); |
| | | rec_->NewRec(id, output, mindur, maxdur, audio); |
| | | }else{ |
| | | std::string rid(id), dir(output); |
| | | fn_rec_lazy_ = |
| | | [=](ffwrapper::FormatIn *in){rec_->NewRec(rid.c_str(), dir.c_str(), mindur, maxdur);}; |
| | | [=](ffwrapper::FormatIn *in){rec_->NewRec(rid.c_str(), dir.c_str(), mindur, maxdur, audio);}; |
| | | } |
| | | } |
| | | |