annotate stream/librtsp/rtsp.h @ 37165:681c7f805a23

Double-check that we are really at audio EOF by trying to refill. Somewhat improves trac #2196.
author reimar
date Sun, 31 Aug 2014 09:33:38 +0000
parents 629b30951662
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18799
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
1 /*
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
2 * This file was ported to MPlayer from xine CVS rtsp.h,v 1.2 2002/12/16 21:50:55
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
3 */
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
4
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
5 /*
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
6 * Copyright (C) 2002 the xine project
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
7 *
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
8 * This file is part of xine, a free video player.
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
9 *
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
10 * xine is free software; you can redistribute it and/or modify
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
13 * (at your option) any later version.
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
14 *
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
15 * xine is distributed in the hope that it will be useful,
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
18 * GNU General Public License for more details.
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
19 *
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
23 *
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
24 *
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
25 * a minimalistic implementation of rtsp protocol,
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
26 * *not* RFC 2326 compilant yet.
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
27 *
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
28 * 2006, Benjamin Zores and Vincent Mussard
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
29 * fixed a lot of RFC compliance issues.
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
30 */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27104
diff changeset
31
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25869
diff changeset
32 #ifndef MPLAYER_RTSP_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25869
diff changeset
33 #define MPLAYER_RTSP_H
18799
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
34
27104
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
35 #include <inttypes.h>
18799
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
36
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
37 /* some codes returned by rtsp_request_* functions */
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
38
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
39 #define RTSP_STATUS_SET_PARAMETER 10
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
40 #define RTSP_STATUS_OK 200
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
41
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
42 #define RTSP_METHOD_OPTIONS "OPTIONS"
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
43 #define RTSP_METHOD_DESCRIBE "DESCRIBE"
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
44 #define RTSP_METHOD_SETUP "SETUP"
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
45 #define RTSP_METHOD_PLAY "PLAY"
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
46 #define RTSP_METHOD_TEARDOWN "TEARDOWN"
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
47 #define RTSP_METHOD_SET_PARAMETER "SET_PARAMETER"
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
48
27104
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
49 #define BUF_SIZE 4096
30152
629b30951662 Disambiguate HEADER_SIZE definition in stream/librtsp and stream/realrtsp.
diego
parents: 29263
diff changeset
50 #define RTSP_HEADER_SIZE 1024
27104
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
51 #define MAX_FIELDS 256
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
52
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
53
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
54 struct rtsp_s {
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
55
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
56 int s;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
57
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
58 char *host;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
59 int port;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
60 char *path;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
61 char *param;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
62 char *mrl;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
63 char *user_agent;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
64
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
65 char *server;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
66 unsigned int server_state;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
67 uint32_t server_caps;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 27104
diff changeset
68
27104
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
69 unsigned int cseq;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
70 char *session;
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
71
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
72 char *answers[MAX_FIELDS]; /* data of last message */
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
73 char *scheduled[MAX_FIELDS]; /* will be sent with next message */
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
74 };
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
75
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
76 /*
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
77 * constants
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
78 */
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
79
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
80 #define RTSP_PROTOCOL_VERSION "RTSP/1.0"
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
81
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
82 /* server states */
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
83 #define RTSP_CONNECTED 1
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
84 #define RTSP_INIT 2
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
85 #define RTSP_READY 4
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
86 #define RTSP_PLAYING 8
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
87 #define RTSP_RECORDING 16
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
88
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
89 /* server capabilities */
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
90 #define RTSP_OPTIONS 0x001
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
91 #define RTSP_DESCRIBE 0x002
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
92 #define RTSP_ANNOUNCE 0x004
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
93 #define RTSP_SETUP 0x008
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
94 #define RTSP_GET_PARAMETER 0x010
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
95 #define RTSP_SET_PARAMETER 0x020
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
96 #define RTSP_TEARDOWN 0x040
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
97 #define RTSP_PLAY 0x080
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
98 #define RTSP_RECORD 0x100
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
99
83d160a30ca7 Complete the code move across librtsp, fixes the rtsp_close collision with libnemesi
lu_zero
parents: 27103
diff changeset
100
18799
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
101 typedef struct rtsp_s rtsp_t;
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
102
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
103 rtsp_t* rtsp_connect (int fd, char *mrl, char *path, char *host, int port, char *user_agent);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
104
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
105 int rtsp_request_options(rtsp_t *s, const char *what);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
106 int rtsp_request_describe(rtsp_t *s, const char *what);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
107 int rtsp_request_setup(rtsp_t *s, const char *what, char *control);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
108 int rtsp_request_setparameter(rtsp_t *s, const char *what);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
109 int rtsp_request_play(rtsp_t *s, const char *what);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
110 int rtsp_request_teardown(rtsp_t *s, const char *what);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
111
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
112 int rtsp_send_ok(rtsp_t *s);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
113
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
114 int rtsp_read_data(rtsp_t *s, char *buffer, unsigned int size);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
115
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
116 char* rtsp_search_answers(rtsp_t *s, const char *tag);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
117 void rtsp_add_to_payload(char **payload, const char *string);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
118
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
119 void rtsp_free_answers(rtsp_t *this);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
120
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
121 int rtsp_read (rtsp_t *this, char *data, int len);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
122
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
123 void rtsp_set_session(rtsp_t *s, const char *id);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
124 char *rtsp_get_session(rtsp_t *s);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
125
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
126 char *rtsp_get_mrl(rtsp_t *s);
19108
5e767cabf4cd marks several read-only string parameters and function return-values which can only be used read-only as const. Patch by Stefan Huehner, stefan _AT huener-org
reynaldo
parents: 18799
diff changeset
127 char *rtsp_get_param(rtsp_t *s, const char *param);
18799
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
128
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
129 /*int rtsp_peek_header (rtsp_t *this, char *data); */
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
130
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
131 void rtsp_schedule_field(rtsp_t *s, const char *string);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
132 void rtsp_unschedule_field(rtsp_t *s, const char *string);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
133 void rtsp_unschedule_all(rtsp_t *s);
e16345b97dab moved generic rtsp related files from realrtsp to librtsp
ben
parents:
diff changeset
134
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25869
diff changeset
135 #endif /* MPLAYER_RTSP_H */