FFmpeg  1.2.12
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 FFmpeg.
6  *
7  * FFmpeg 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  * FFmpeg 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 FFmpeg; 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 
49 };
50 
61 };
62 
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 65000
79 
87 typedef struct RTSPTransportField {
93 
97 
101 
105 
108  int ttl;
109 
112 
118 
122 
126 typedef struct RTSPMessageHeader {
129 
134 
138 
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];
188 
199 };
200 
210 };
211 
217 typedef struct RTSPState {
218  const AVClass *class;
219  URLContext *rtsp_hd; /* RTSP TCP connection handle */
220 
223 
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 
258 
262 
267 
269  char real_challenge[64];
270 
272  char auth[128];
273 
276 
278  char last_reply[2048]; /* XXX: allocate ? */
279 
283 
288 
292 
296 
300  char last_subscription[1024];
302 
307 
310  uint64_t asf_pb_pos;
312 
316  char control_uri[1024];
317 
320  struct MpegTSContext *ts;
324 
328 
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 
339 
344 
348  uint64_t packets;
349 
353  struct pollfd *p;
354 
359 
364 
369 
372 
377 
382 
387 
392 
397 } RTSPState;
398 
399 #define RTSP_FLAG_FILTER_SRC 0x1
402 #define RTSP_FLAG_LISTEN 0x2
403 #define RTSP_FLAG_CUSTOM_IO 0x4
411 typedef struct RTSPStream {
417 
420  int interleaved_min, interleaved_max;
421 
422  char control_url[1024];
426  int sdp_port;
427  struct sockaddr_storage sdp_ip;
428  int sdp_ttl;
431 
436 
440 
442  int feedback;
443 
444  char crypto_suite[40];
445  char crypto_params[100];
446 } RTSPStream;
447 
448 void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
449  RTSPState *rt, const char *method);
450 
456 int ff_rtsp_send_cmd_async(AVFormatContext *s, const char *method,
457  const char *url, const char *headers);
458 
476  const char *method, const char *url,
477  const char *headers,
478  RTSPMessageHeader *reply,
479  unsigned char **content_ptr,
480  const unsigned char *send_content,
481  int send_content_length);
482 
488 int ff_rtsp_send_cmd(AVFormatContext *s, const char *method,
489  const char *url, const char *headers,
490  RTSPMessageHeader *reply, unsigned char **content_ptr);
491 
516  unsigned char **content_ptr,
517  int return_on_interleaved_data, const char *method);
518 
523 
534 
541 
548 
554 
559 int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr);
560 
566 
572 int ff_sdp_parse(AVFormatContext *s, const char *content);
573 
578  uint8_t *buf, int buf_size);
579 
585 
591 int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
592  int lower_transport, const char *real_challenge);
593 
599 
604 
605 extern const AVOption ff_rtsp_options[];
606 
607 #endif /* AVFORMAT_RTSP_H */