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

support ingest hls with m3u8 in m3u8.

This commit is contained in:
winlin 2015-04-21 12:53:45 +08:00
parent ba6736839b
commit a28eec89b0
5 changed files with 311 additions and 83 deletions

View file

@ -278,6 +278,11 @@ bool srs_string_starts_with(string str, string flag)
return str.find(flag) == 0;
}
bool srs_string_contains(string str, string flag)
{
return str.find(flag) != string::npos;
}
int srs_do_create_dir_recursively(string dir)
{
int ret = ERROR_SUCCESS;
@ -356,6 +361,22 @@ string srs_path_dirname(string path)
return dirname;
}
string srs_path_basename(string path)
{
std::string dirname = path;
size_t pos = string::npos;
if ((pos = dirname.rfind("/")) != string::npos) {
// the basename("/") is "/"
if (dirname.length() == 1) {
return dirname;
}
dirname = dirname.substr(pos + 1);
}
return dirname;
}
bool srs_avc_startswith_annexb(SrsStream* stream, int* pnb_start_code)
{
char* bytes = stream->data() + stream->pos();