diff options
author | Stefan Holst <holstsn@users.sourceforge.net> | 2002-12-16 21:50:54 +0000 |
---|---|---|
committer | Stefan Holst <holstsn@users.sourceforge.net> | 2002-12-16 21:50:54 +0000 |
commit | a2ce19ef7930303350698d1b684080b061a57d7c (patch) | |
tree | aac0eae2e0d973a9ba1ad922236fc29443da4c1c /src/input/librtsp/rtsp.c | |
parent | 97c8f6a9d8bbd13a1ef0e071f60009f5110ca210 (diff) | |
download | xine-lib-a2ce19ef7930303350698d1b684080b061a57d7c.tar.gz xine-lib-a2ce19ef7930303350698d1b684080b061a57d7c.tar.bz2 |
real streaming fixes:
- removing exit()s from pnm.c
- server error message retrieving fixed in pnm.c
- handling of server messages in rtsp
CVS patchset: 3564
CVS date: 2002/12/16 21:50:54
Diffstat (limited to 'src/input/librtsp/rtsp.c')
-rw-r--r-- | src/input/librtsp/rtsp.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/src/input/librtsp/rtsp.c b/src/input/librtsp/rtsp.c index b1f92ce6a..15cef3066 100644 --- a/src/input/librtsp/rtsp.c +++ b/src/input/librtsp/rtsp.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: rtsp.c,v 1.2 2002/12/14 00:02:31 holstsn Exp $ + * $Id: rtsp.c,v 1.3 2002/12/16 21:50:55 holstsn Exp $ * * a minimalistic implementation of rtsp protocol, * *not* RFC 2326 compilant yet. @@ -301,11 +301,17 @@ static void rtsp_put(rtsp_t *s, const char *string) { static int rtsp_get_code(const char *string) { char buf[4]; - int code; - - memcpy(buf, string+strlen(rtsp_protocol_version)+1, 3); - buf[3]=0; - code=atoi(buf); + int code=0; + + if (!strncmp(string, rtsp_protocol_version, strlen(rtsp_protocol_version))) + { + memcpy(buf, string+strlen(rtsp_protocol_version)+1, 3); + buf[3]=0; + code=atoi(buf); + } else if (!strncmp(string, "SET_PARAMETER",8)) + { + return RTSP_STATUS_SET_PARAMETER; + } if(code != 200) printf("librtsp: server responds: '%s'\n",string); @@ -367,8 +373,12 @@ static int rtsp_get_answers(rtsp_t *s) { if (!strncmp(answer,"Cseq:",5)) { sscanf(answer,"Cseq: %u",&answer_seq); if (s->cseq != answer_seq) { +#ifdef LOG printf("librtsp: warning: Cseq mismatch. got %u, assumed %u", answer_seq, s->cseq); - } +#endif + s->cseq=answer_seq; + } else + s->cseq++; } if (!strncmp(answer,"Server:",7)) { sscanf(answer,"Server: %s",s->buffer); @@ -397,13 +407,26 @@ static int rtsp_get_answers(rtsp_t *s) { } while (strlen(answer)!=0); *answer_ptr=NULL; - s->cseq++; rtsp_schedule_standard(s); return code; } /* + * send an ok message + */ + +int rtsp_send_ok(rtsp_t *s) { + char cseq[16]; + + rtsp_put(s, "RTSP/1.0 200 OK"); + sprintf(cseq,"CSeq: %u", s->cseq); + rtsp_put(s, cseq); + rtsp_put(s, ""); + +} + +/* * implementation of must-have rtsp requests; functions return * server status code. */ @@ -568,6 +591,7 @@ rtsp_t *rtsp_connect(const char *mrl, const char *user_agent) { s->host=NULL; s->port=554; /* rtsp standard port */ s->path=NULL; + s->mrl=NULL; s->mrl=strdup(mrl); s->server=NULL; |