diff options
author | Uwe L. Korn <uwelk@xhochy.com> | 2014-05-05 21:47:05 +0100 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2014-05-06 23:41:56 +0300 |
commit | 7ce3bd9614717e545af8fb8455032c807e389b78 (patch) | |
tree | bb36c4b7d055b87743b5d37fc575bf57e33538c7 /libavformat | |
parent | 3828eb8519c1530392ab8820b1aa784602128afc (diff) | |
download | ffmpeg-7ce3bd9614717e545af8fb8455032c807e389b78.tar.gz |
rtmpproto: Support alternative slist parameter in rtmp URLs
Support the URL scheme where the playpath is in an RTMP URL is
passed as the slist argument and the app is given infront of the
query part of the URL:
rtmp://host[:port]/[app]?slist=[playpath]
(other arguments in the query part are stripped as they are not used)
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rtmpproto.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 8d8aabc60a..2962737ed0 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -2382,7 +2382,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) { RTMPContext *rt = s->priv_data; char proto[8], hostname[256], path[1024], auth[100], *fname; - char *old_app; + char *old_app, *qmark, fname_buffer[1024]; uint8_t buf[2048]; int port; AVDictionary *opts = NULL; @@ -2480,7 +2480,19 @@ reconnect: } //extract "app" part from path - if (!strncmp(path, "/ondemand/", 10)) { + qmark = strchr(path, '?'); + if (qmark && strstr(qmark, "slist=")) { + char* amp; + // After slist we have the playpath, before the params, the app + av_strlcpy(rt->app, path + 1, qmark - path); + fname = strstr(path, "slist=") + 6; + // Strip any further query parameters from fname + amp = strchr(fname, '&'); + if (amp) { + av_strlcpy(fname_buffer, fname, amp - fname + 1); + fname = fname_buffer; + } + } else if (!strncmp(path, "/ondemand/", 10)) { fname = path + 10; memcpy(rt->app, "ondemand", 9); } else { |