sync with en/mplayer.1 r28991
[mplayer/glamo.git] / stream / librtsp / rtsp.h
blobefca1f77798a50722df0ec0615eaa0d0ba5ccc95
1 /*
2 * This file was ported to MPlayer from xine CVS rtsp.h,v 1.2 2002/12/16 21:50:55
3 */
5 /*
6 * Copyright (C) 2002 the xine project
8 * This file is part of xine, a free video player.
10 * xine is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * xine is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
25 * a minimalistic implementation of rtsp protocol,
26 * *not* RFC 2326 compilant yet.
28 * 2006, Benjamin Zores and Vincent Mussard
29 * fixed a lot of RFC compliance issues.
32 #ifndef MPLAYER_RTSP_H
33 #define MPLAYER_RTSP_H
35 #include <inttypes.h>
37 /* some codes returned by rtsp_request_* functions */
39 #define RTSP_STATUS_SET_PARAMETER 10
40 #define RTSP_STATUS_OK 200
42 #define RTSP_METHOD_OPTIONS "OPTIONS"
43 #define RTSP_METHOD_DESCRIBE "DESCRIBE"
44 #define RTSP_METHOD_SETUP "SETUP"
45 #define RTSP_METHOD_PLAY "PLAY"
46 #define RTSP_METHOD_TEARDOWN "TEARDOWN"
47 #define RTSP_METHOD_SET_PARAMETER "SET_PARAMETER"
49 #define BUF_SIZE 4096
50 #define HEADER_SIZE 1024
51 #define MAX_FIELDS 256
54 struct rtsp_s {
56 int s;
58 char *host;
59 int port;
60 char *path;
61 char *param;
62 char *mrl;
63 char *user_agent;
65 char *server;
66 unsigned int server_state;
67 uint32_t server_caps;
69 unsigned int cseq;
70 char *session;
72 char *answers[MAX_FIELDS]; /* data of last message */
73 char *scheduled[MAX_FIELDS]; /* will be sent with next message */
77 * constants
80 #define RTSP_PROTOCOL_VERSION "RTSP/1.0"
82 /* server states */
83 #define RTSP_CONNECTED 1
84 #define RTSP_INIT 2
85 #define RTSP_READY 4
86 #define RTSP_PLAYING 8
87 #define RTSP_RECORDING 16
89 /* server capabilities */
90 #define RTSP_OPTIONS 0x001
91 #define RTSP_DESCRIBE 0x002
92 #define RTSP_ANNOUNCE 0x004
93 #define RTSP_SETUP 0x008
94 #define RTSP_GET_PARAMETER 0x010
95 #define RTSP_SET_PARAMETER 0x020
96 #define RTSP_TEARDOWN 0x040
97 #define RTSP_PLAY 0x080
98 #define RTSP_RECORD 0x100
101 typedef struct rtsp_s rtsp_t;
103 rtsp_t* rtsp_connect (int fd, char *mrl, char *path, char *host, int port, char *user_agent);
105 int rtsp_request_options(rtsp_t *s, const char *what);
106 int rtsp_request_describe(rtsp_t *s, const char *what);
107 int rtsp_request_setup(rtsp_t *s, const char *what, char *control);
108 int rtsp_request_setparameter(rtsp_t *s, const char *what);
109 int rtsp_request_play(rtsp_t *s, const char *what);
110 int rtsp_request_teardown(rtsp_t *s, const char *what);
112 int rtsp_send_ok(rtsp_t *s);
114 int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size);
116 char* rtsp_search_answers(rtsp_t *s, const char *tag);
117 void rtsp_add_to_payload(char **payload, const char *string);
119 void rtsp_free_answers(rtsp_t *this);
121 int rtsp_read (rtsp_t *this, char *data, int len);
123 void rtsp_set_session(rtsp_t *s, const char *id);
124 char *rtsp_get_session(rtsp_t *s);
126 char *rtsp_get_mrl(rtsp_t *s);
127 char *rtsp_get_param(rtsp_t *s, const char *param);
129 /*int rtsp_peek_header (rtsp_t *this, char *data); */
131 void rtsp_schedule_field(rtsp_t *s, const char *string);
132 void rtsp_unschedule_field(rtsp_t *s, const char *string);
133 void rtsp_unschedule_all(rtsp_t *s);
135 #endif /* MPLAYER_RTSP_H */