Mercurial > mplayer.hg
comparison libmpdemux/realrtsp/rtsp.c @ 11506:fff1b6f1a9cc
Real rtsp Range parameter (Start and End) support.
Patch by rgselk <rgselknospam(at)yahoo(dot)com>
author | rtognimp |
---|---|
date | Sun, 23 Nov 2003 13:35:55 +0000 |
parents | 6e35326c742f |
children | d700a93ab34c |
comparison
equal
deleted
inserted
replaced
11505:8de9dba0ffaa | 11506:fff1b6f1a9cc |
---|---|
63 int s; | 63 int s; |
64 | 64 |
65 char *host; | 65 char *host; |
66 int port; | 66 int port; |
67 char *path; | 67 char *path; |
68 char *param; | |
68 char *mrl; | 69 char *mrl; |
69 char *user_agent; | 70 char *user_agent; |
70 | 71 |
71 char *server; | 72 char *server; |
72 unsigned int server_state; | 73 unsigned int server_state; |
620 s->user_agent=strdup("User-Agent: RealMedia Player Version 6.0.9.1235 (linux-2.0-libc6-i386-gcc2.95)"); | 621 s->user_agent=strdup("User-Agent: RealMedia Player Version 6.0.9.1235 (linux-2.0-libc6-i386-gcc2.95)"); |
621 | 622 |
622 s->mrl = strdup(mrl); | 623 s->mrl = strdup(mrl); |
623 s->host = strdup(host); | 624 s->host = strdup(host); |
624 s->port = port; | 625 s->port = port; |
626 while (*path == '/') | |
627 path++; | |
625 s->path = strdup(path); | 628 s->path = strdup(path); |
629 if ((s->param = strchr(s->path, '?')) != NULL) | |
630 s->param++; | |
631 //printf("path=%s\n", s->path); | |
632 //printf("param=%s\n", s->param ? s->param : "NULL"); | |
626 s->s = fd; | 633 s->s = fd; |
627 | 634 |
628 if (s->s < 0) { | 635 if (s->s < 0) { |
629 printf ("rtsp: failed to connect to '%s'\n", s->host); | 636 printf ("rtsp: failed to connect to '%s'\n", s->host); |
630 rtsp_close(s); | 637 rtsp_close(s); |
714 | 721 |
715 return s->mrl; | 722 return s->mrl; |
716 | 723 |
717 } | 724 } |
718 | 725 |
726 char *rtsp_get_param(rtsp_t *s, char *p) { | |
727 int len; | |
728 char *param; | |
729 if (!s->param) | |
730 return NULL; | |
731 if (!p) | |
732 return strdup(s->param); | |
733 len = strlen(p); | |
734 param = s->param; | |
735 while (param && *param) { | |
736 char *nparam = strchr(param, '&'); | |
737 if (strncmp(param, p, len) == 0 && param[len] == '=') { | |
738 param += len + 1; | |
739 len = nparam ? nparam - param : strlen(param); | |
740 nparam = malloc(len + 1); | |
741 memcpy(nparam, param, len); | |
742 nparam[len] = 0; | |
743 return nparam; | |
744 } | |
745 param = nparam ? nparam + 1 : NULL; | |
746 } | |
747 return NULL; | |
748 } | |
749 | |
719 /* | 750 /* |
720 * schedules a field for transmission | 751 * schedules a field for transmission |
721 */ | 752 */ |
722 | 753 |
723 void rtsp_schedule_field(rtsp_t *s, const char *string) { | 754 void rtsp_schedule_field(rtsp_t *s, const char *string) { |