Mark formats requiring external libs with an 'E' in the format support tables.
[FFMpeg-mirror/ffmpeg-vdpau.git] / libavformat / rtp.h
blob4de5919c7812697b67402e2e7cd2c6ea04eb3fc8
1 /*
2 * RTP definitions
3 * Copyright (c) 2002 Fabrice Bellard.
5 * This file is part of FFmpeg.
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.
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.
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
21 #ifndef AVFORMAT_RTP_H
22 #define AVFORMAT_RTP_H
24 #include "libavcodec/avcodec.h"
25 #include "avformat.h"
27 typedef struct PayloadContext PayloadContext;
28 typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
30 #define RTP_MIN_PACKET_LENGTH 12
31 #define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
33 int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
35 /** return < 0 if unknown payload type */
36 int rtp_get_payload_type(AVCodecContext *codec);
38 typedef struct RTPDemuxContext RTPDemuxContext;
39 typedef struct rtp_payload_data_s rtp_payload_data_s;
40 RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data);
41 void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
42 RTPDynamicProtocolHandler *handler);
43 int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
44 const uint8_t *buf, int len);
45 void rtp_parse_close(RTPDemuxContext *s);
47 int rtp_get_local_port(URLContext *h);
48 int rtp_set_remote_url(URLContext *h, const char *uri);
49 void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
51 /**
52 * some rtp servers assume client is dead if they don't hear from them...
53 * so we send a Receiver Report to the provided ByteIO context
54 * (we don't have access to the rtcp handle from here)
56 int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
58 #define RTP_PT_PRIVATE 96
59 #define RTP_VERSION 2
60 #define RTP_MAX_SDES 256 /**< maximum text length for SDES */
62 /* RTCP paquets use 0.5 % of the bandwidth */
63 #define RTCP_TX_RATIO_NUM 5
64 #define RTCP_TX_RATIO_DEN 1000
66 /** Structure listing useful vars to parse RTP packet payload*/
67 typedef struct rtp_payload_data_s
69 int sizelength;
70 int indexlength;
71 int indexdeltalength;
72 int profile_level_id;
73 int streamtype;
74 int objecttype;
75 char *mode;
77 /** mpeg 4 AU headers */
78 struct AUHeaders {
79 int size;
80 int index;
81 int cts_flag;
82 int cts;
83 int dts_flag;
84 int dts;
85 int rap_flag;
86 int streamstate;
87 } *au_headers;
88 int nb_au_headers;
89 int au_headers_length_bytes;
90 int cur_au_index;
91 } rtp_payload_data_t;
93 #if 0
94 typedef enum {
95 RTCP_SR = 200,
96 RTCP_RR = 201,
97 RTCP_SDES = 202,
98 RTCP_BYE = 203,
99 RTCP_APP = 204
100 } rtcp_type_t;
102 typedef enum {
103 RTCP_SDES_END = 0,
104 RTCP_SDES_CNAME = 1,
105 RTCP_SDES_NAME = 2,
106 RTCP_SDES_EMAIL = 3,
107 RTCP_SDES_PHONE = 4,
108 RTCP_SDES_LOC = 5,
109 RTCP_SDES_TOOL = 6,
110 RTCP_SDES_NOTE = 7,
111 RTCP_SDES_PRIV = 8,
112 RTCP_SDES_IMG = 9,
113 RTCP_SDES_DOOR = 10,
114 RTCP_SDES_SOURCE = 11
115 } rtcp_sdes_type_t;
116 #endif
118 #endif /* AVFORMAT_RTP_H */