diff options
author | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-11-23 13:35:55 +0000 |
---|---|---|
committer | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-11-23 13:35:55 +0000 |
commit | b84ba866d7535fb8955420c7f856c39d7dc48468 (patch) | |
tree | 214154d8219d7a1ed7fce2d02d4409fc9043ce06 /libmpdemux/realrtsp/rtsp.c | |
parent | 8e0dd8484f88ff34477168edd7c5bef883944ea2 (diff) | |
download | mpv-b84ba866d7535fb8955420c7f856c39d7dc48468.tar.bz2 mpv-b84ba866d7535fb8955420c7f856c39d7dc48468.tar.xz |
Real rtsp Range parameter (Start and End) support.
Patch by rgselk <rgselknospam(at)yahoo(dot)com>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11507 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/realrtsp/rtsp.c')
-rw-r--r-- | libmpdemux/realrtsp/rtsp.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libmpdemux/realrtsp/rtsp.c b/libmpdemux/realrtsp/rtsp.c index f346b6b13a..29738b909e 100644 --- a/libmpdemux/realrtsp/rtsp.c +++ b/libmpdemux/realrtsp/rtsp.c @@ -65,6 +65,7 @@ struct rtsp_s { char *host; int port; char *path; + char *param; char *mrl; char *user_agent; @@ -622,7 +623,13 @@ rtsp_t *rtsp_connect(int fd, char* mrl, char *path, char *host, int port, char * s->mrl = strdup(mrl); s->host = strdup(host); s->port = port; + while (*path == '/') + path++; s->path = strdup(path); + if ((s->param = strchr(s->path, '?')) != NULL) + s->param++; + //printf("path=%s\n", s->path); + //printf("param=%s\n", s->param ? s->param : "NULL"); s->s = fd; if (s->s < 0) { @@ -716,6 +723,30 @@ char *rtsp_get_mrl(rtsp_t *s) { } +char *rtsp_get_param(rtsp_t *s, char *p) { + int len; + char *param; + if (!s->param) + return NULL; + if (!p) + return strdup(s->param); + len = strlen(p); + param = s->param; + while (param && *param) { + char *nparam = strchr(param, '&'); + if (strncmp(param, p, len) == 0 && param[len] == '=') { + param += len + 1; + len = nparam ? nparam - param : strlen(param); + nparam = malloc(len + 1); + memcpy(nparam, param, len); + nparam[len] = 0; + return nparam; + } + param = nparam ? nparam + 1 : NULL; + } + return NULL; +} + /* * schedules a field for transmission */ |