Libav
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
libavformat
rtsp.h
Go to the documentation of this file.
1
/*
2
* RTSP definitions
3
* Copyright (c) 2002 Fabrice Bellard
4
*
5
* This file is part of Libav.
6
*
7
* Libav is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
11
*
12
* Libav is distributed in the hope that it will be useful,
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
18
* License along with Libav; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
#ifndef AVFORMAT_RTSP_H
22
#define AVFORMAT_RTSP_H
23
24
#include <stdint.h>
25
#include "
avformat.h
"
26
#include "
rtspcodes.h
"
27
#include "
rtpdec.h
"
28
#include "
network.h
"
29
#include "
httpauth.h
"
30
31
#include "
libavutil/log.h
"
32
#include "
libavutil/opt.h
"
33
37
enum
RTSPLowerTransport
{
38
RTSP_LOWER_TRANSPORT_UDP
= 0,
39
RTSP_LOWER_TRANSPORT_TCP
= 1,
40
RTSP_LOWER_TRANSPORT_UDP_MULTICAST
= 2,
41
RTSP_LOWER_TRANSPORT_NB
,
42
RTSP_LOWER_TRANSPORT_HTTP
= 8,
45
RTSP_LOWER_TRANSPORT_CUSTOM
= 16,
49
};
50
56
enum
RTSPTransport
{
57
RTSP_TRANSPORT_RTP
,
58
RTSP_TRANSPORT_RDT
,
59
RTSP_TRANSPORT_RAW
,
60
RTSP_TRANSPORT_NB
61
};
62
67
enum
RTSPControlTransport
{
68
RTSP_MODE_PLAIN
,
69
RTSP_MODE_TUNNEL
70
};
71
72
#define RTSP_DEFAULT_PORT 554
73
#define RTSP_MAX_TRANSPORTS 8
74
#define RTSP_TCP_MAX_PACKET_SIZE 1472
75
#define RTSP_DEFAULT_NB_AUDIO_CHANNELS 1
76
#define RTSP_DEFAULT_AUDIO_SAMPLERATE 44100
77
#define RTSP_RTP_PORT_MIN 5000
78
#define RTSP_RTP_PORT_MAX 10000
79
87
typedef
struct
RTSPTransportField
{
92
int
interleaved_min
,
interleaved_max
;
93
96
int
port_min
,
port_max
;
97
100
int
client_port_min
,
client_port_max
;
101
104
int
server_port_min
,
server_port_max
;
105
108
int
ttl
;
109
111
int
mode_record
;
112
113
struct
sockaddr_storage
destination
;
114
char
source
[
INET6_ADDRSTRLEN
+ 1];
117
enum
RTSPTransport
transport
;
118
120
enum
RTSPLowerTransport
lower_transport
;
121
}
RTSPTransportField
;
122
126
typedef
struct
RTSPMessageHeader
{
128
int
content_length
;
129
130
enum
RTSPStatusCode
status_code
;
133
int
nb_transports
;
134
137
int64_t
range_start
,
range_end
;
138
141
RTSPTransportField
transports
[
RTSP_MAX_TRANSPORTS
];
142
143
int
seq
;
147
char
session_id
[512];
148
151
char
location
[4096];
152
154
char
real_challenge
[64];
155
163
char
server
[64];
164
171
int
timeout
;
172
176
int
notice
;
177
181
char
reason
[256];
182
186
char
content_type
[64];
187
}
RTSPMessageHeader
;
188
194
enum
RTSPClientState
{
195
RTSP_STATE_IDLE
,
196
RTSP_STATE_STREAMING
,
197
RTSP_STATE_PAUSED
,
198
RTSP_STATE_SEEKING
,
199
};
200
205
enum
RTSPServerType
{
206
RTSP_SERVER_RTP
,
207
RTSP_SERVER_REAL
,
208
RTSP_SERVER_WMS
,
209
RTSP_SERVER_NB
210
};
211
217
typedef
struct
RTSPState
{
218
const
AVClass
*
class
;
219
URLContext
*
rtsp_hd
;
/* RTSP TCP connection handle */
220
222
int
nb_rtsp_streams
;
223
224
struct
RTSPStream
**
rtsp_streams
;
230
enum
RTSPClientState
state
;
231
238
int64_t
seek_timestamp
;
239
240
int
seq
;
244
char
session_id
[512];
245
249
int
timeout
;
250
254
int64_t
last_cmd_time
;
255
257
enum
RTSPTransport
transport
;
258
261
enum
RTSPLowerTransport
lower_transport
;
262
266
enum
RTSPServerType
server_type
;
267
269
char
real_challenge
[64];
270
272
char
auth
[128];
273
275
HTTPAuthState
auth_state
;
276
278
char
last_reply
[2048];
/* XXX: allocate ? */
279
282
void
*
cur_transport_priv
;
283
287
int
need_subscription
;
288
291
enum
AVDiscard
*
real_setup_cache
;
292
295
enum
AVDiscard
*
real_setup
;
296
300
char
last_subscription
[1024];
302
306
AVFormatContext
*
asf_ctx
;
307
310
uint64_t
asf_pb_pos
;
312
316
char
control_uri
[1024];
317
320
struct
MpegTSContext
*
ts
;
321
int
recvbuf_pos
;
322
int
recvbuf_len
;
324
327
URLContext
*
rtsp_hd_out
;
328
330
enum
RTSPControlTransport
control_transport
;
331
332
/* Number of RTCP BYE packets the RTSP session has received.
333
* An EOF is propagated back if nb_byes == nb_streams.
334
* This is reset after a seek. */
335
int
nb_byes
;
336
338
uint8_t
*
recvbuf
;
339
343
int
lower_transport_mask
;
344
348
uint64_t
packets
;
349
353
struct
pollfd *
p
;
354
358
int
get_parameter_supported
;
359
363
int
initial_pause
;
364
368
int
rtp_muxer_flags
;
369
371
int
accept_dynamic_rate
;
372
376
int
rtsp_flags
;
377
381
int
media_type_mask
;
382
386
int
rtp_port_min
,
rtp_port_max
;
387
391
int
initial_timeout
;
392
396
int
reordering_queue_size
;
397
}
RTSPState
;
398
399
#define RTSP_FLAG_FILTER_SRC 0x1
402
#define RTSP_FLAG_LISTEN 0x2
403
#define RTSP_FLAG_CUSTOM_IO 0x4
404
#define RTSP_FLAG_RTCP_TO_SOURCE 0x8
407
typedef struct RTSPSource {
408
char
addr[128];
409
}
RTSPSource
;
410
417
typedef
struct
RTSPStream
{
418
URLContext
*
rtp_handle
;
419
void
*
transport_priv
;
422
int
stream_index
;
423
426
int
interleaved_min
,
interleaved_max
;
427
428
char
control_url
[1024];
432
int
sdp_port
;
433
struct
sockaddr_storage
sdp_ip
;
434
int
nb_include_source_addrs
;
435
struct
RTSPSource
**
include_source_addrs
;
436
int
nb_exclude_source_addrs
;
437
struct
RTSPSource
**
exclude_source_addrs
;
438
int
sdp_ttl
;
439
int
sdp_payload_type
;
441
445
RTPDynamicProtocolHandler
*
dynamic_handler
;
446
448
PayloadContext
*
dynamic_protocol_context
;
450
452
int
feedback
;
453
454
char
crypto_suite
[40];
455
char
crypto_params
[100];
456
}
RTSPStream
;
457
458
void
ff_rtsp_parse_line
(
RTSPMessageHeader
*reply,
const
char
*buf,
459
RTSPState
*rt,
const
char
*method);
460
466
int
ff_rtsp_send_cmd_async
(
AVFormatContext
*s,
const
char
*method,
467
const
char
*url,
const
char
*headers);
468
485
int
ff_rtsp_send_cmd_with_content
(
AVFormatContext
*s,
486
const
char
*method,
const
char
*url,
487
const
char
*headers,
488
RTSPMessageHeader
*reply,
489
unsigned
char
**content_ptr,
490
const
unsigned
char
*send_content,
491
int
send_content_length);
492
498
int
ff_rtsp_send_cmd
(
AVFormatContext
*s,
const
char
*method,
499
const
char
*url,
const
char
*headers,
500
RTSPMessageHeader
*reply,
unsigned
char
**content_ptr);
501
525
int
ff_rtsp_read_reply
(
AVFormatContext
*s,
RTSPMessageHeader
*reply,
526
unsigned
char
**content_ptr,
527
int
return_on_interleaved_data,
const
char
*method);
528
532
void
ff_rtsp_skip_packet
(
AVFormatContext
*s);
533
543
int
ff_rtsp_connect
(
AVFormatContext
*s);
544
550
void
ff_rtsp_close_streams
(
AVFormatContext
*s);
551
557
void
ff_rtsp_close_connections
(
AVFormatContext
*s);
558
563
int
ff_rtsp_setup_input_streams
(
AVFormatContext
*s,
RTSPMessageHeader
*reply);
564
569
int
ff_rtsp_setup_output_streams
(
AVFormatContext
*s,
const
char
*
addr
);
570
575
int
ff_rtsp_parse_streaming_commands
(
AVFormatContext
*s);
576
582
int
ff_sdp_parse
(
AVFormatContext
*s,
const
char
*content);
583
587
int
ff_rtsp_tcp_read_packet
(
AVFormatContext
*s,
RTSPStream
**prtsp_st,
588
uint8_t
*buf,
int
buf_size);
589
593
int
ff_rtsp_tcp_write_packet
(
AVFormatContext
*s,
RTSPStream
*rtsp_st);
594
599
int
ff_rtsp_fetch_packet
(
AVFormatContext
*s,
AVPacket
*pkt);
600
606
int
ff_rtsp_make_setup_request
(
AVFormatContext
*s,
const
char
*host,
int
port,
607
int
lower_transport,
const
char
*real_challenge);
608
613
void
ff_rtsp_undo_setup
(
AVFormatContext
*s,
int
send_packets);
614
618
int
ff_rtsp_open_transport_ctx
(
AVFormatContext
*s,
RTSPStream
*rtsp_st);
619
620
extern
const
AVOption
ff_rtsp_options
[];
621
622
#endif
/* AVFORMAT_RTSP_H */
Generated on Thu Sep 30 2021 23:03:21 for Libav by
1.8.1.2