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

@ -254,6 +254,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ERROR_HTTP_RESPONSE_EOF 4025
#define ERROR_HTTP_INVALID_CHUNK_HEADER 4026
#define ERROR_AVC_NALU_UEV 4027
#define ERROR_AAC_BYTES_INVALID 4028
///////////////////////////////////////////////////////
// user-define error.

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();

View file

@ -67,6 +67,8 @@ extern std::string srs_string_remove(std::string str, std::string remove_chars);
extern bool srs_string_ends_with(std::string str, std::string flag);
// whether string starts with
extern bool srs_string_starts_with(std::string str, std::string flag);
// whether string contains with
extern bool srs_string_contains(std::string str, std::string flag);
// create dir recursively
extern int srs_create_dir_recursively(std::string dir);
@ -75,6 +77,8 @@ extern int srs_create_dir_recursively(std::string dir);
extern bool srs_path_exists(std::string path);
// get the dirname of path
extern std::string srs_path_dirname(std::string path);
// get the basename of path
extern std::string srs_path_basename(std::string path);
/**
* whether stream starts with the avc NALU in "AnnexB"