| | |
| | | out_ = new FormatOut(in_->getFPS(), "mp4"); |
| | | |
| | | int pid = getpid(); |
| | | file_path_ = dir_ + "/" + sole::uuid4().base62() + "-" + std::to_string(pid) + ".mp4"; |
| | | std::string filename(sole::uuid4().base62() + "-" + std::to_string(pid) + ".mp4"); |
| | | file_path_ = dir_ + "/" + filename; |
| | | |
| | | auto v = in_->getStream(AVMEDIA_TYPE_VIDEO); |
| | | if (!v){ |
| | |
| | | if (!audio){ |
| | | a = NULL; |
| | | } |
| | | auto ret = out_->JustWriter(v, a, file_path_.c_str()); |
| | | bool ret = out_->JustWriter(v, a, file_path_.c_str()); |
| | | if (ret){ |
| | | logIt("start record file: %s", file_path_.c_str()); |
| | | logIt("start record file: %s", file_path_.c_str()); |
| | | return 0; |
| | | }else{ |
| | | file_path_ = "./" + filename; |
| | | ret = out_->JustWriter(v, a, file_path_.c_str()); |
| | | logIt("failed in dir %s, try file %s to start record file", dir_.c_str(), file_path_.c_str()); |
| | | if (ret){ |
| | | logIt("start record file: %s", file_path_.c_str()); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | logIt("failed to start record: %s", file_path_.c_str()); |
| | |
| | | } |
| | | |
| | | int pid = getpid(); |
| | | file_path_ = dir_ + "/" + sole::uuid4().base62() + "-" + std::to_string(pid) + ".hevc"; |
| | | std::string filename(sole::uuid4().base62() + "-" + std::to_string(pid) + ".mp4"); |
| | | file_path_ = dir_ + "/" + filename; |
| | | |
| | | fp_ = fopen(file_path_.c_str(), "wb"); |
| | | if (!fp_){ |
| | | logIt("write hevc open file error: %s", file_path_.c_str()); |
| | | return -1; |
| | | file_path_ = "./" + filename; |
| | | logIt("failed in dir %s, try file %s to start record hevc file", dir_.c_str(), file_path_.c_str()); |
| | | fp_ = fopen(file_path_.c_str(), "wb"); |
| | | if (!fp_){ |
| | | logIt("failed start record hevc file: %s", file_path_.c_str()); |
| | | return -1; |
| | | } |
| | | } |
| | | logIt("start record file: %s", file_path_.c_str()); |
| | | |