1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1109, Support without ssl for HLS key.

This commit is contained in:
winlin 2018-08-25 21:15:26 +08:00
parent 522fba99aa
commit ee068cf120
6 changed files with 188 additions and 157 deletions

View file

@ -71,15 +71,11 @@ public:
unsigned char iv[16];
// The full key path.
std::string keypath;
public:
SrsHlsSegment(SrsTsContext* c, SrsAudioCodecId ac, SrsVideoCodecId vc, SrsFileWriter *srswriter);
SrsHlsSegment(SrsTsContext* c, SrsAudioCodecId ac, SrsVideoCodecId vc, SrsFileWriter* w);
virtual ~SrsHlsSegment();
public:
void SrsSetEncCfg(unsigned char* keyval,unsigned char * ivval);
void config_cipher(unsigned char* key,unsigned char* iv);
};
/**
@ -156,24 +152,20 @@ private:
// used to detect the dup or jmp or ts.
int64_t accept_floor_ts;
int64_t previous_floor_ts;
private:
//encrypted or not
// encrypted or not
bool hls_keys;
int hls_fragments_per_key;
//key file name
// key file name
std::string hls_key_file;
//key file path
// key file path
std::string hls_key_file_path;
//key file url
// key file url
std::string hls_key_url;
// key and iv.
unsigned char key[16];
unsigned char iv[16];
SrsFileWriter *writer;
private:
int _sequence_no;
int max_td;
@ -210,8 +202,8 @@ public:
virtual srs_error_t update_config(SrsRequest* r, std::string entry_prefix,
std::string path, std::string m3u8_file, std::string ts_file,
double fragment, double window, bool ts_floor, double aof_ratio,
bool cleanup, bool wait_keyframe , bool keys, int fragments_per_key,
std::string key_file , std::string key_file_path,std::string key_url);
bool cleanup, bool wait_keyframe, bool keys, int fragments_per_key,
std::string key_file, std::string key_file_path, std::string key_url);
/**
* open a new segment(a new ts file)
*/
@ -244,6 +236,7 @@ public:
*/
virtual srs_error_t segment_close();
private:
virtual srs_error_t write_hls_key();
virtual srs_error_t refresh_m3u8();
virtual srs_error_t _refresh_m3u8(std::string m3u8_file);
};