| | |
| | | |
| | | #include <thread> |
| | | #include <unistd.h> |
| | | #include <sys/time.h> |
| | | |
| | | extern "C"{ |
| | | #include <libavformat/avformat.h> |
| | |
| | | init_worker(in.get()); |
| | | |
| | | int64_t id = gb_ ? 0 : -1; |
| | | |
| | | bool exist = access(input_url_.c_str(), 0) == 0 ? true : false; |
| | | |
| | | while(!stop_stream_.load()){ |
| | | auto data(std::make_shared<CodedData>()); |
| | |
| | | logIt("read packet error, id: %lld", id); |
| | | break; |
| | | } |
| | | |
| | | if (in->notVideoAudio(&data->getAVPacket())){ |
| | | continue; |
| | | } |
| | | |
| | | |
| | | if (!gb_ && id < 0){ |
| | | id++; |
| | | continue; |
| | | } |
| | | |
| | | // decode error |
| | | if (run_worker(in.get(), data, id) == -1){ |
| | | break; |
| | | } |
| | | // usleep(wTime); |
| | | |
| | | if (exist){ |
| | | usleep(wTime); |
| | | } |
| | | |
| | | id++; |
| | | } |
| | |
| | | void Wrapper::SetRecMinCacheTime(const int mind){ |
| | | rec_->SetRecMinCacheTime(mind); |
| | | } |
| | | |
| | | |
| | | void Wrapper::BuildRecorder(const char* id, const char *output, const int mindur, const int maxdur, const bool audio){ |
| | | bool a = audio; |
| | | if (gb_) a = false; |