mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add: hls configuration adds [duration] variable (#1083)
This commit is contained in:
parent
c20b819a29
commit
aaf2905a9d
3 changed files with 17 additions and 3 deletions
|
@ -28,6 +28,7 @@
|
|||
#include <srs_kernel_error.hpp>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
SrsFragment::SrsFragment()
|
||||
|
@ -126,11 +127,16 @@ srs_error_t SrsFragment::rename()
|
|||
|
||||
string full_path = fullpath();
|
||||
string tmp_file = tmppath();
|
||||
|
||||
int tempdur = (int)duration();
|
||||
if (true) {
|
||||
std::stringstream ss;
|
||||
ss << tempdur;
|
||||
full_path = srs_string_replace(full_path, "[duration]", ss.str());
|
||||
}
|
||||
if (::rename(tmp_file.c_str(), full_path.c_str()) < 0) {
|
||||
return srs_error_new(ERROR_SYSTEM_FRAGMENT_RENAME, "rename %s to %s", tmp_file.c_str(), full_path.c_str());
|
||||
}
|
||||
|
||||
filepath = full_path;
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue