增加长期保存hls切片的功能,segKeep=0为不长期保存,segKeep=1为长期保存。此功能部分等效于segNum=0的情况,不同的是这个保留不会在m3u8文件中体现。

This commit is contained in:
WuPeng
2022-05-10 17:32:50 +08:00
parent a9d7874467
commit 5bc313bafe
8 changed files with 34 additions and 7 deletions

View File

@@ -26,8 +26,9 @@ public:
/**
* @param seg_duration 切片文件长度
* @param seg_number 切片个数
* @param seg_keep 是否保留切片文件
*/
HlsMaker(float seg_duration = 5, uint32_t seg_number = 3);
HlsMaker(float seg_duration = 5, uint32_t seg_number = 3, bool seg_keep = false);
virtual ~HlsMaker();
/**
@@ -44,6 +45,11 @@ public:
*/
bool isLive();
/**
* 是否保留切片文件
*/
bool isKeep();
/**
* 清空记录
*/
@@ -108,6 +114,7 @@ private:
private:
float _seg_duration = 0;
uint32_t _seg_number = 0;
bool _seg_keep = false;
uint32_t _last_timestamp = 0;
uint32_t _last_seg_timestamp = 0;
uint64_t _file_index = 0;