Skip to content

Commit

Permalink
added ts ext when probing m2ts in sockin and fixed wrong file ext sig…
Browse files Browse the repository at this point in the history
…naling when no path in URLs - cf #2711
  • Loading branch information
jeanlf committed Jan 18, 2024
1 parent b81953c commit f9e9fbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/filter_core/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -4336,7 +4336,15 @@ GF_Err gf_filter_pid_raw_new(GF_Filter *filter, const char *url, const char *loc
gf_filter_pid_set_property(pid, GF_PROP_PID_FILE_EXT, &PROP_STRING(tmp_ext));
ext_len = (u32) strlen(tmp_ext);
} else {
char *ext = gf_file_ext_start(url);
char *ext=NULL;
char *scheme = strstr(url, "://");
if (scheme) {
scheme = strchr(scheme+3, '/');
if (scheme)
ext = gf_file_ext_start(scheme);
} else {
ext = gf_file_ext_start(url);
}
if (ext) ext++;

if (ext) {
Expand Down
5 changes: 4 additions & 1 deletion src/filters/in_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ static GF_Err sockin_read_client(GF_Filter *filter, GF_SockInCtx *ctx, GF_SockIn
//first run, probe data
if (!sock_c->pid) {
const char *mime = ctx->mime;
const char *ext = ctx->ext;
//probe MPEG-2
if (ctx->tsprobe) {
/*TS over RTP signaled as udp */
Expand All @@ -351,12 +352,14 @@ static GF_Err sockin_read_client(GF_Filter *filter, GF_SockInCtx *ctx, GF_SockIn
sock_c->is_rtp = GF_TRUE;
#endif
mime = "video/mp2t";
ext = "ts";
} else if (ctx->buffer[0] == 0x47) {
mime = "video/mp2t";
ext = "ts";
}
}

e = gf_filter_pid_raw_new(filter, ctx->src, NULL, mime, ctx->ext, ctx->buffer, nb_read, GF_TRUE, &sock_c->pid);
e = gf_filter_pid_raw_new(filter, ctx->src, NULL, mime, ext, ctx->buffer, nb_read, GF_TRUE, &sock_c->pid);
if (e) return e;

// if (ctx->is_udp) gf_filter_pid_set_property(sock_c->pid, GF_PROP_PID_UDP, &PROP_BOOL(GF_TRUE) );
Expand Down

0 comments on commit f9e9fbe

Please sign in to comment.