mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-19 23:02:21 +08:00
避免hls拉流时m3u8文件出现问题或直播结束后,无限重试 (#2357)
Co-authored-by: xiongziliang <771730766@qq.com>
This commit is contained in:
@@ -36,8 +36,9 @@ typedef struct{
|
||||
|
||||
class HlsParser {
|
||||
public:
|
||||
HlsParser(){}
|
||||
~HlsParser(){}
|
||||
HlsParser() = default;
|
||||
~HlsParser() = default;
|
||||
|
||||
bool parse(const std::string &http_url,const std::string &m3u8);
|
||||
|
||||
/**
|
||||
@@ -79,10 +80,16 @@ public:
|
||||
* 得到总时间
|
||||
*/
|
||||
float getTotalDuration() const;
|
||||
|
||||
|
||||
protected:
|
||||
//解析出ts文件地址回调
|
||||
virtual void onParsed(bool is_m3u8_inner,int64_t sequence,const std::map<int,ts_segment> &ts_list) {};
|
||||
/**
|
||||
* 解析m3u8文件回调
|
||||
* @param is_m3u8_inner 该m3u8文件中是否包含多个hls地址
|
||||
* @param sequence ts序号
|
||||
* @param ts_list ts地址列表
|
||||
* @return 是否解析成功,返回false时,将导致HlsParser::parse返回false
|
||||
*/
|
||||
virtual bool onParsed(bool is_m3u8_inner, int64_t sequence, const std::map<int, ts_segment> &ts_list) = 0;
|
||||
|
||||
private:
|
||||
bool _is_m3u8 = false;
|
||||
|
||||
Reference in New Issue
Block a user