Mercurial > libavformat.hg
annotate rtsp.h @ 4628:e2fa3c2bc471 libavformat
Add context to some av_log() calls.
author | benoit |
---|---|
date | Mon, 02 Mar 2009 09:28:37 +0000 |
parents | e1a5b4f5b9be |
children | 51899c07a4f1 |
rev | line source |
---|---|
0 | 1 /* |
2 * RTSP definitions | |
4251
77e0c7511d41
cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents:
4171
diff
changeset
|
3 * Copyright (c) 2002 Fabrice Bellard |
0 | 4 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1167
diff
changeset
|
5 * This file is part of FFmpeg. |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1167
diff
changeset
|
6 * |
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1167
diff
changeset
|
7 * FFmpeg is free software; you can redistribute it and/or |
0 | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1167
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
0 | 11 * |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1167
diff
changeset
|
12 * FFmpeg is distributed in the hope that it will be useful, |
0 | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
1358
0899bfe4105c
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
1167
diff
changeset
|
18 * License along with FFmpeg; if not, write to the Free Software |
896
edbe5c3717f9
Update licensing information: The FSF changed postal address.
diego
parents:
885
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 20 */ |
3853 | 21 #ifndef FFMPEG_RTSP_H |
22 #define FFMPEG_RTSP_H | |
0 | 23 |
2171 | 24 #include <stdint.h> |
25 #include "avformat.h" | |
0 | 26 #include "rtspcodes.h" |
4388 | 27 #include "rtpdec.h" |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
28 #include "network.h" |
0 | 29 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
30 /** |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
31 * Network layer over which RTP/etc packet data will be transported. |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
32 */ |
3957
9f943bb755f9
Rename RTSPProtocol to RTSPLowerTransport, so that its name properly tells us
rbultje
parents:
3855
diff
changeset
|
33 enum RTSPLowerTransport { |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
34 RTSP_LOWER_TRANSPORT_UDP = 0, /**< UDP/unicast */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
35 RTSP_LOWER_TRANSPORT_TCP = 1, /**< TCP; interleaved in RTSP */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
36 RTSP_LOWER_TRANSPORT_UDP_MULTICAST = 2, /**< UDP/multicast */ |
4514
2a84d46427d1
Rename RTSP_*_LAST to RTSP_*_NB in line with PIX_FMT_* in lavc. See "[PATCH]
rbultje
parents:
4512
diff
changeset
|
37 RTSP_LOWER_TRANSPORT_NB |
0 | 38 }; |
39 | |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
40 /** |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
41 * Packet profile of the data that we will be receiving. Real servers |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
42 * commonly send RDT (although they can sometimes send RTP as well), |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
43 * whereas most others will send RTP. |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
44 */ |
4377
8d6f64b2e949
Move enum RTSPTransport up a bit, so that all fields that are assigned a value
rbultje
parents:
4251
diff
changeset
|
45 enum RTSPTransport { |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
46 RTSP_TRANSPORT_RTP, /**< Standards-compliant RTP */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
47 RTSP_TRANSPORT_RDT, /**< Realmedia Data Transport */ |
4514
2a84d46427d1
Rename RTSP_*_LAST to RTSP_*_NB in line with PIX_FMT_* in lavc. See "[PATCH]
rbultje
parents:
4512
diff
changeset
|
48 RTSP_TRANSPORT_NB |
4377
8d6f64b2e949
Move enum RTSPTransport up a bit, so that all fields that are assigned a value
rbultje
parents:
4251
diff
changeset
|
49 }; |
8d6f64b2e949
Move enum RTSPTransport up a bit, so that all fields that are assigned a value
rbultje
parents:
4251
diff
changeset
|
50 |
0 | 51 #define RTSP_DEFAULT_PORT 554 |
52 #define RTSP_MAX_TRANSPORTS 8 | |
179 | 53 #define RTSP_TCP_MAX_PACKET_SIZE 1472 |
774 | 54 #define RTSP_DEFAULT_NB_AUDIO_CHANNELS 2 |
55 #define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100 | |
56 #define RTSP_RTP_PORT_MIN 5000 | |
57 #define RTSP_RTP_PORT_MAX 10000 | |
0 | 58 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
59 /** |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
60 * This describes a single item in the "Transport:" line of one stream as |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
61 * negotiated by the SETUP RTSP command. Multiple transports are comma- |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
62 * separated ("Transport: x-read-rdt/tcp;interleaved=0-1,rtp/avp/udp; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
63 * client_port=1000-1001;server_port=1800-1801") and described in separate |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
64 * RTSPTransportFields. |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
65 */ |
0 | 66 typedef struct RTSPTransportField { |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
67 /** interleave ids, if TCP transport; each TCP/RTSP data packet starts |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
68 * with a '$', stream length and stream ID. If the stream ID is within |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
69 * the range of this interleaved_min-max, then the packet belongs to |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
70 * this stream. */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
71 int interleaved_min, interleaved_max; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
72 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
73 /** UDP multicast port range; the ports to which we should connect to |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
74 * receive multicast UDP data. */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
75 int port_min, port_max; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
76 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
77 /** UDP client ports; these should be the local ports of the UDP RTP |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
78 * (and RTCP) sockets over which we receive RTP/RTCP data. */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
79 int client_port_min, client_port_max; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
80 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
81 /** UDP unicast server port range; the ports to which we should connect |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
82 * to receive unicast UDP RTP/RTCP data. */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
83 int server_port_min, server_port_max; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
84 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
85 /** time-to-live value (required for multicast); the amount of HOPs that |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
86 * packets will be allowed to make before being discarded. */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
87 int ttl; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
88 |
1871 | 89 uint32_t destination; /**< destination IP address */ |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
90 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
91 /** data/packet transport protocol; e.g. RTP or RDT */ |
4377
8d6f64b2e949
Move enum RTSPTransport up a bit, so that all fields that are assigned a value
rbultje
parents:
4251
diff
changeset
|
92 enum RTSPTransport transport; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
93 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
94 /** network layer transport protocol; e.g. TCP or UDP uni-/multicast */ |
3957
9f943bb755f9
Rename RTSPProtocol to RTSPLowerTransport, so that its name properly tells us
rbultje
parents:
3855
diff
changeset
|
95 enum RTSPLowerTransport lower_transport; |
0 | 96 } RTSPTransportField; |
97 | |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
98 /** |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
99 * This describes the server response to each RTSP command. |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
100 */ |
4557
bfe6fb676d46
Rename RTSPHeader to RTSPMessageHeader to reflect more clearly what the
rbultje
parents:
4514
diff
changeset
|
101 typedef struct RTSPMessageHeader { |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
102 /** length of the data following this header */ |
0 | 103 int content_length; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
104 |
1871 | 105 enum RTSPStatusCode status_code; /**< response code from server */ |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
106 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
107 /** number of items in the 'transports' variable below */ |
0 | 108 int nb_transports; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
109 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
110 /** Time range of the streams that the server will stream. In |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
111 * AV_TIME_BASE unit, AV_NOPTS_VALUE if not used */ |
885 | 112 int64_t range_start, range_end; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
113 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
114 /** describes the complete "Transport:" line of the server in response |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
115 * to a SETUP RTSP command by the client */ |
0 | 116 RTSPTransportField transports[RTSP_MAX_TRANSPORTS]; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
117 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
118 int seq; /**< sequence number */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
119 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
120 /** the "Session:" field. This value is initially set by the server and |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
121 * should be re-transmitted by the client in every RTSP command. */ |
0 | 122 char session_id[512]; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
123 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
124 /** the "RealChallenge1:" field from the server */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
125 char real_challenge[64]; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
126 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
127 /** the "Server: field, which can be used to identify some special-case |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
128 * servers that are not 100% standards-compliant. We use this to identify |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
129 * Windows Media Server, which has a value "WMServer/v.e.r.sion", where |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
130 * version is a sequence of digits (e.g. 9.0.0.3372). Helix/Real servers |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
131 * use something like "Helix [..] Server Version v.e.r.sion (platform) |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
132 * (RealServer compatible)" or "RealServer Version v.e.r.sion (platform)", |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
133 * where platform is the output of $uname -msr | sed 's/ /-/g'. */ |
4169
619845a9bab3
Use the "server" RTSP field to detect whether the server that we're talking
rbultje
parents:
4168
diff
changeset
|
134 char server[64]; |
4557
bfe6fb676d46
Rename RTSPHeader to RTSPMessageHeader to reflect more clearly what the
rbultje
parents:
4514
diff
changeset
|
135 } RTSPMessageHeader; |
0 | 136 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
137 /** |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
138 * Client state, i.e. whether we are currently receiving data (PLAYING) or |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
139 * setup-but-not-receiving (PAUSED). State can be changed in applications |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
140 * by calling av_read_play/pause(). |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
141 */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
142 enum RTSPClientState { |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
143 RTSP_STATE_IDLE, /**< not initialized */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
144 RTSP_STATE_PLAYING, /**< initialized and receiving data */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
145 RTSP_STATE_PAUSED, /**< initialized, but not receiving data */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
146 }; |
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
147 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
148 /** |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
149 * Identifies particular servers that require special handling, such as |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
150 * standards-incompliant "Transport:" lines in the SETUP request. |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
151 */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
152 enum RTSPServerType { |
4171
6af3e7ab7cbb
Fix typo ("Standard-compliant" -> "Standards-compliant"), as noticed by
rbultje
parents:
4170
diff
changeset
|
153 RTSP_SERVER_RTP, /**< Standards-compliant RTP-server */ |
4170 | 154 RTSP_SERVER_REAL, /**< Realmedia-style server */ |
155 RTSP_SERVER_WMS, /**< Windows Media server */ | |
4514
2a84d46427d1
Rename RTSP_*_LAST to RTSP_*_NB in line with PIX_FMT_* in lavc. See "[PATCH]
rbultje
parents:
4512
diff
changeset
|
156 RTSP_SERVER_NB |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
157 }; |
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
158 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
159 /** |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
160 * Private data for the RTSP demuxer. |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
161 */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
162 typedef struct RTSPState { |
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
163 URLContext *rtsp_hd; /* RTSP TCP connexion handle */ |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
164 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
165 /** number of items in the 'rtsp_streams' variable */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
166 int nb_rtsp_streams; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
167 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
168 struct RTSPStream **rtsp_streams; /**< streams in this session */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
169 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
170 /** indicator of whether we are currently receiving data from the |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
171 * server. Basically this isn't more than a simple cache of the |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
172 * last PLAY/PAUSE command sent to the server, to make sure we don't |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
173 * send 2x the same unexpectedly or commands in the wrong state. */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
174 enum RTSPClientState state; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
175 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
176 /** the seek value requested when calling av_seek_frame(). This value |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
177 * is subsequently used as part of the "Range" parameter when emitting |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
178 * the RTSP PLAY command. If we are currently playing, this command is |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
179 * called instantly. If we are currently paused, this command is called |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
180 * whenever we resume playback. Either way, the value is only used once, |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
181 * see rtsp_read_play() and rtsp_read_seek(). */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
182 int64_t seek_timestamp; |
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
183 |
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
184 /* XXX: currently we use unbuffered input */ |
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
185 // ByteIOContext rtsp_gb; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
186 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
187 int seq; /**< RTSP command sequence number */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
188 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
189 /** copy of RTSPMessageHeader->session_id, i.e. the server-provided session |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
190 * identifier that the client should re-transmit in each RTSP command */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
191 char session_id[512]; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
192 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
193 /** the negotiated data/packet transport protocol; e.g. RTP or RDT */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
194 enum RTSPTransport transport; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
195 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
196 /** the negotiated network layer transport protocol; e.g. TCP or UDP |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
197 * uni-/multicast */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
198 enum RTSPLowerTransport lower_transport; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
199 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
200 /** brand of server that we're talking to; e.g. WMS, REAL or other. |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
201 * Detected based on the value of RTSPMessageHeader->server or the presence |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
202 * of RTSPMessageHeader->real_challenge */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
203 enum RTSPServerType server_type; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
204 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
205 /** The last reply of the server to a RTSP command */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
206 char last_reply[2048]; /* XXX: allocate ? */ |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
207 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
208 /** RTSPStream->transport_priv of the last stream that we read a |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
209 * packet from */ |
4386
3dbd7fa2c2af
Rename "tx_ctx" and "cur_tx" variables to "transport_priv" and
rbultje
parents:
4381
diff
changeset
|
210 void *cur_transport_priv; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
211 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
212 /** The following are used for Real stream selection */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
213 //@{ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
214 /** whether we need to send a "SET_PARAMETER Subscribe:" command */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
215 int need_subscription; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
216 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
217 /** stream setup during the last frame read. This is used to detect if |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
218 * we need to subscribe or unsubscribe to any new streams. */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
219 enum AVDiscard real_setup_cache[MAX_STREAMS]; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
220 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
221 /** the last value of the "SET_PARAMETER Subscribe:" RTSP command. |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
222 * this is used to send the same "Unsubscribe:" if stream setup changed, |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
223 * before sending a new "Subscribe:" command. */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
224 char last_subscription[1024]; |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
225 //@} |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
226 } RTSPState; |
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
227 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
228 /** |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
229 * Describes a single stream, as identified by a single m= line block in the |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
230 * SDP content. In the case of RDT, one RTSPStream can represent multiple |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
231 * AVStreams. In this case, each AVStream in this set has similar content |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
232 * (but different codec/bitrate). |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
233 */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
234 typedef struct RTSPStream { |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
235 URLContext *rtp_handle; /**< RTP stream handle (if UDP) */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
236 void *transport_priv; /**< RTP/RDT parse context */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
237 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
238 /** corresponding stream index, if any. -1 if none (MPEG2TS case) */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
239 int stream_index; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
240 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
241 /** interleave IDs; copies of RTSPTransportField->interleaved_min/max |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
242 * for the selected transport. Only used for TCP. */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
243 int interleaved_min, interleaved_max; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
244 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
245 char control_url[1024]; /**< url for this stream (from SDP) */ |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
246 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
247 /** The following are used only in SDP, not RTSP */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
248 //@{ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
249 int sdp_port; /**< port (from SDP content) */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
250 struct in_addr sdp_ip; /**< IP address (from SDP content) */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
251 int sdp_ttl; /**< IP Time-To-Live (from SDP content) */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
252 int sdp_payload_type; /**< payload type */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
253 //@} |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
254 |
4588
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
255 /** rtp payload parsing infos from SDP (i.e. mapping between private |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
256 * payload IDs and media-types (string), so that we can derive what |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
257 * type of payload we're dealing with (and how to parse it). */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
258 RTPPayloadData rtp_payload_data; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
259 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
260 /** The following are used for dynamic protocols (rtp_*.c/rdt.c) */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
261 //@{ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
262 /** handler structure */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
263 RTPDynamicProtocolHandler *dynamic_handler; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
264 |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
265 /** private data associated with the dynamic protocol */ |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
266 PayloadContext *dynamic_protocol_context; |
e1a5b4f5b9be
Document rtsp.h, see "[PATCH] document rtsp.h" thread.
rbultje
parents:
4557
diff
changeset
|
267 //@} |
4168
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
268 } RTSPStream; |
0ebf63d12ea4
Export RTSPState and RTSPStream from rtsp.c into rtsp.h. This allows future
rbultje
parents:
3960
diff
changeset
|
269 |
0 | 270 int rtsp_init(void); |
4557
bfe6fb676d46
Rename RTSPHeader to RTSPMessageHeader to reflect more clearly what the
rbultje
parents:
4514
diff
changeset
|
271 void rtsp_parse_line(RTSPMessageHeader *reply, const char *buf); |
0 | 272 |
2884 | 273 #if LIBAVFORMAT_VERSION_INT < (53 << 16) |
0 | 274 extern int rtsp_default_protocols; |
2884 | 275 #endif |
0 | 276 extern int rtsp_rtp_port_min; |
277 extern int rtsp_rtp_port_max; | |
179 | 278 |
279 int rtsp_pause(AVFormatContext *s); | |
280 int rtsp_resume(AVFormatContext *s); | |
0 | 281 |
3853 | 282 #endif /* FFMPEG_RTSP_H */ |