annotate rtp.h @ 4269:bbb6561a3974 libavformat

'code' is used to index a table so make it unsigned this prevents using negative index and possibly crashing with broken files
author aurel
date Wed, 21 Jan 2009 22:32:17 +0000
parents 77e0c7511d41
children f49e5d92ab26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
1 /*
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
2 * RTP definitions
4251
77e0c7511d41 cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 4101
diff changeset
3 * Copyright (c) 2002 Fabrice Bellard
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
15 * Lesser General Public License for more details.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
16 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
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
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
20 */
3852
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 3617
diff changeset
21 #ifndef AVFORMAT_RTP_H
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 3617
diff changeset
22 #define AVFORMAT_RTP_H
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
23
3286
6f61c3b36632 Use full path for #includes from another directory.
diego
parents: 2901
diff changeset
24 #include "libavcodec/avcodec.h"
2171
a6d6b2b19341 include all prerequisites in header files
mru
parents: 1869
diff changeset
25 #include "avformat.h"
a6d6b2b19341 include all prerequisites in header files
mru
parents: 1869
diff changeset
26
1868
b92a67b0b4bd Doxygenize the unaltered comments for the rtp_payload_data_s struct.
takis
parents: 1867
diff changeset
27 /** Structure listing useful vars to parse RTP packet payload*/
4101
af2c0aef892b Rename rtp_payload_data_t to avoid clashes with the POSIX namespace
lucabe
parents: 4100
diff changeset
28 typedef struct rtp_payload_data
774
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
29 {
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
30 int sizelength;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
31 int indexlength;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
32 int indexdeltalength;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
33 int profile_level_id;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
34 int streamtype;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
35 int objecttype;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
36 char *mode;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
37
1869
48b1d0b70e09 Doxygenize the unaltered comments for the AUHeaders structure.
takis
parents: 1868
diff changeset
38 /** mpeg 4 AU headers */
774
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
39 struct AUHeaders {
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
40 int size;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
41 int index;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
42 int cts_flag;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
43 int cts;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
44 int dts_flag;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
45 int dts;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
46 int rap_flag;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
47 int streamstate;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
48 } *au_headers;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
49 int nb_au_headers;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
50 int au_headers_length_bytes;
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
51 int cur_au_index;
4101
af2c0aef892b Rename rtp_payload_data_t to avoid clashes with the POSIX namespace
lucabe
parents: 4100
diff changeset
52 } RTPPayloadData;
774
820863425158 RTP/RTSP and MPEG4-AAC audio
michael
parents: 294
diff changeset
53
4100
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
54 typedef struct PayloadContext PayloadContext;
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
55 typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
56
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
57 #define RTP_MIN_PACKET_LENGTH 12
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
58 #define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
59
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
60 int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
61
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
62 /** return < 0 if unknown payload type */
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
63 int rtp_get_payload_type(AVCodecContext *codec);
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
64
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
65 typedef struct RTPDemuxContext RTPDemuxContext;
4101
af2c0aef892b Rename rtp_payload_data_t to avoid clashes with the POSIX namespace
lucabe
parents: 4100
diff changeset
66 RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, RTPPayloadData *rtp_payload_data);
4100
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
67 void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
68 RTPDynamicProtocolHandler *handler);
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
69 int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
70 const uint8_t *buf, int len);
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
71 void rtp_parse_close(RTPDemuxContext *s);
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
72
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
73 int rtp_get_local_port(URLContext *h);
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
74 int rtp_set_remote_url(URLContext *h, const char *uri);
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
75 void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
76
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
77 /**
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
78 * some rtp servers assume client is dead if they don't hear from them...
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
79 * so we send a Receiver Report to the provided ByteIO context
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
80 * (we don't have access to the rtcp handle from here)
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
81 */
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
82 int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
83
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
84 #define RTP_PT_PRIVATE 96
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
85 #define RTP_VERSION 2
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
86 #define RTP_MAX_SDES 256 /**< maximum text length for SDES */
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
87
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
88 /* RTCP paquets use 0.5 % of the bandwidth */
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
89 #define RTCP_TX_RATIO_NUM 5
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
90 #define RTCP_TX_RATIO_DEN 1000
2e81931d3995 Remove useless typedef
lucabe
parents: 4099
diff changeset
91
3852
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 3617
diff changeset
92 #endif /* AVFORMAT_RTP_H */