[vlc-commits] commit: stream_filter/httplive.c: relative_URI() determine base path of p_sys->m3u8.psz_path (Jean-Paul Saman )
git at videolan.org
git at videolan.org
Wed Dec 29 16:51:16 CET 2010
vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Dec 29 15:41:54 2010 +0100| [30834428ddf147f1c102be3559d73ff7e5cfbd0d] | committer: Jean-Paul Saman
stream_filter/httplive.c: relative_URI() determine base path of p_sys->m3u8.psz_path
commit-id: 61042012fa846988d7d7c364396478850afedf67 simplified relative_URI()
a bit too much.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30834428ddf147f1c102be3559d73ff7e5cfbd0d
---
modules/stream_filter/httplive.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index f875854..2242f6f 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -347,22 +347,30 @@ static char *relative_URI(stream_t *s, const char *uri, const char *path)
if (p != NULL)
return NULL;
+ char *psz_path = strdup(p_sys->m3u8.psz_path);
+ if (psz_path == NULL) return NULL;
+ p = strrchr(psz_path, '/');
+ if (p) *p = '\0';
+
char *psz_uri = NULL;
if (p_sys->m3u8.psz_password || p_sys->m3u8.psz_username)
{
if (asprintf(&psz_uri, "%s://%s:%s@%s%s/%s", p_sys->m3u8.psz_protocol,
p_sys->m3u8.psz_username, p_sys->m3u8.psz_password,
- p_sys->m3u8.psz_host,
- path ? path : p_sys->m3u8.psz_path, uri) < 0)
- return NULL;
+ p_sys->m3u8.psz_host, path ? path : psz_path, uri) < 0)
+ goto fail;
}
else
{
if (asprintf(&psz_uri, "%s://%s%s/%s", p_sys->m3u8.psz_protocol,
- p_sys->m3u8.psz_host, path ? path : p_sys->m3u8.psz_path, uri) < 0)
- return NULL;
+ p_sys->m3u8.psz_host, path ? path : psz_path, uri) < 0)
+ goto fail;
}
return psz_uri;
+
+fail:
+ free(psz_path);
+ return NULL;
}
static void parse_SegmentInformation(stream_t *s, hls_stream_t *hls, char *p_read, char *uri)
@@ -1270,8 +1278,6 @@ static int Open(vlc_object_t *p_this)
free(p_sys);
return VLC_ENOMEM;
}
- char *psz_path = strrchr(psz_uri, '/');
- if (psz_path) *psz_path = '\0';
vlc_UrlParse(&p_sys->m3u8, psz_uri, 0);
free(psz_uri);
More information about the vlc-commits
mailing list