Mercurial > mplayer.hg
changeset 18774:332e5ad0ed53
cosmetic changes (defines will be used later in other parts of the code)
author | ben |
---|---|
date | Wed, 21 Jun 2006 17:50:50 +0000 |
parents | 518b5935a909 |
children | bdcbf1070680 |
files | libmpdemux/realrtsp/rtsp.c libmpdemux/realrtsp/rtsp.h |
diffstat | 2 files changed, 21 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/realrtsp/rtsp.c Wed Jun 21 17:42:54 2006 +0000 +++ b/libmpdemux/realrtsp/rtsp.c Wed Jun 21 17:50:50 2006 +0000 @@ -92,7 +92,7 @@ * constants */ -const char rtsp_protocol_version[]="RTSP/1.0"; +#define RTSP_PROTOCOL_VERSION "RTSP/1.0" /* server states */ #define RTSP_CONNECTED 1 @@ -339,17 +339,17 @@ char buf[4]; int code=0; - if (!strncmp(string, rtsp_protocol_version, strlen(rtsp_protocol_version))) + if (!strncmp(string, RTSP_PROTOCOL_VERSION, strlen(RTSP_PROTOCOL_VERSION))) { - memcpy(buf, string+strlen(rtsp_protocol_version)+1, 3); + memcpy(buf, string+strlen(RTSP_PROTOCOL_VERSION)+1, 3); buf[3]=0; code=atoi(buf); - } else if (!strncmp(string, "SET_PARAMETER",8)) + } else if (!strncmp(string, RTSP_METHOD_SET_PARAMETER,8)) { return RTSP_STATUS_SET_PARAMETER; } - if(code != 200) mp_msg(MSGT_OPEN, MSGL_INFO, "librtsp: server responds: '%s'\n",string); + if(code != RTSP_STATUS_OK) mp_msg(MSGT_OPEN, MSGL_INFO, "librtsp: server responds: '%s'\n",string); return code; } @@ -363,9 +363,9 @@ char **payload=s->scheduled; char *buf; - buf = malloc(strlen(type)+strlen(what)+strlen(rtsp_protocol_version)+3); + buf = malloc(strlen(type)+strlen(what)+strlen(RTSP_PROTOCOL_VERSION)+3); - sprintf(buf,"%s %s %s",type, what, rtsp_protocol_version); + sprintf(buf,"%s %s %s",type, what, RTSP_PROTOCOL_VERSION); rtsp_put(s,buf); free(buf); if (payload) @@ -498,7 +498,7 @@ buf=malloc(sizeof(char)*(strlen(s->host)+16)); sprintf(buf,"rtsp://%s:%i", s->host, s->port); } - rtsp_send_request(s,"OPTIONS",buf); + rtsp_send_request(s,RTSP_METHOD_OPTIONS,buf); free(buf); return rtsp_get_answers(s); @@ -515,7 +515,7 @@ buf=malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } - rtsp_send_request(s,"DESCRIBE",buf); + rtsp_send_request(s,RTSP_METHOD_DESCRIBE,buf); free(buf); return rtsp_get_answers(s); @@ -538,7 +538,7 @@ control ? "/" : "", control ? control : ""); } - rtsp_send_request (s, "SETUP", buf); + rtsp_send_request (s, RTSP_METHOD_SETUP, buf); free (buf); return rtsp_get_answers (s); } @@ -554,7 +554,7 @@ buf=malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } - rtsp_send_request(s,"SET_PARAMETER",buf); + rtsp_send_request(s,RTSP_METHOD_SET_PARAMETER,buf); free(buf); return rtsp_get_answers(s); @@ -572,11 +572,11 @@ buf=malloc(sizeof(char)*(strlen(s->host)+strlen(s->path)+16)); sprintf(buf,"rtsp://%s:%i/%s", s->host, s->port, s->path); } - rtsp_send_request(s,"PLAY",buf); + rtsp_send_request(s,RTSP_METHOD_PLAY,buf); free(buf); ret = rtsp_get_answers (s); - if (ret == 200) + if (ret == RTSP_STATUS_OK) s->server_state = RTSP_PLAYING; return ret; @@ -594,7 +594,7 @@ malloc (strlen (s->host) + strlen (s->path) + 16); sprintf (buf, "rtsp://%s:%i/%s", s->host, s->port, s->path); } - rtsp_send_request (s, "TEARDOWN", buf); + rtsp_send_request (s, RTSP_METHOD_TEARDOWN, buf); free (buf); return rtsp_get_answers(s);
--- a/libmpdemux/realrtsp/rtsp.h Wed Jun 21 17:42:54 2006 +0000 +++ b/libmpdemux/realrtsp/rtsp.h Wed Jun 21 17:50:50 2006 +0000 @@ -38,6 +38,13 @@ #define RTSP_STATUS_SET_PARAMETER 10 #define RTSP_STATUS_OK 200 +#define RTSP_METHOD_OPTIONS "OPTIONS" +#define RTSP_METHOD_DESCRIBE "DESCRIBE" +#define RTSP_METHOD_SETUP "SETUP" +#define RTSP_METHOD_PLAY "PLAY" +#define RTSP_METHOD_TEARDOWN "TEARDOWN" +#define RTSP_METHOD_SET_PARAMETER "SET_PARAMETER" + typedef struct rtsp_s rtsp_t; rtsp_t* rtsp_connect (int fd, char *mrl, char *path, char *host, int port, char *user_agent);