Statistics
| Branch: | Revision:

ffmpeg / libavformat / rtp.h @ c04c3282

History | View | Annotate | Download (3.47 KB)

1 e309128f Fabrice Bellard
/*
2
 * RTP definitions
3
 * Copyright (c) 2002 Fabrice Bellard.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2 of the License, or (at your option) any later version.
9
 *
10
 * This library is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17 5509bffa Diego Biurrun
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 e309128f Fabrice Bellard
 */
19
#ifndef RTP_H
20
#define RTP_H
21
22
#define RTP_MIN_PACKET_LENGTH 12
23
#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
24
25
int rtp_init(void);
26
int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
27
int rtp_get_payload_type(AVCodecContext *codec);
28 8b1ab7bf Fabrice Bellard
29
typedef struct RTPDemuxContext RTPDemuxContext;
30 d1ccf0e0 Romain Degez
typedef struct rtp_payload_data_s rtp_payload_data_s;
31
RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, int payload_type, rtp_payload_data_s *rtp_payload_data);
32 115329f1 Diego Biurrun
int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
33 8b1ab7bf Fabrice Bellard
                     const uint8_t *buf, int len);
34
void rtp_parse_close(RTPDemuxContext *s);
35 e309128f Fabrice Bellard
36
extern AVOutputFormat rtp_mux;
37
extern AVInputFormat rtp_demux;
38
39
int rtp_get_local_port(URLContext *h);
40
int rtp_set_remote_url(URLContext *h, const char *uri);
41
void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
42
43
extern URLProtocol rtp_protocol;
44
45 d1ccf0e0 Romain Degez
#define RTP_PT_PRIVATE 96
46
#define RTP_VERSION 2
47
#define RTP_MAX_SDES 256   /* maximum text length for SDES */
48
49
/* RTCP paquets use 0.5 % of the bandwidth */
50
#define RTCP_TX_RATIO_NUM 5
51
#define RTCP_TX_RATIO_DEN 1000
52
53
/* Structure listing usefull vars to parse RTP packet payload*/
54
typedef struct rtp_payload_data_s
55
{
56
    int sizelength;
57
    int indexlength;
58
    int indexdeltalength;
59
    int profile_level_id;
60
    int streamtype;
61
    int objecttype;
62
    char *mode;
63
64
    /* mpeg 4 AU headers */
65
    struct AUHeaders {
66
        int size;
67
        int index;
68
        int cts_flag;
69
        int cts;
70
        int dts_flag;
71
        int dts;
72
        int rap_flag;
73
        int streamstate;
74
    } *au_headers;
75
    int nb_au_headers;
76
    int au_headers_length_bytes;
77
    int cur_au_index;
78
} rtp_payload_data_t;
79
80
typedef struct AVRtpPayloadType_s
81
{
82
    int pt;
83
    const char enc_name[50]; /* XXX: why 50 ? */
84
    enum CodecType codec_type;
85
    enum CodecID codec_id;
86
    int clock_rate;
87
    int audio_channels;
88
} AVRtpPayloadType_t;
89
90
typedef struct AVRtpDynamicPayloadType_s /* payload type >= 96 */
91
{
92
    const char enc_name[50]; /* XXX: still why 50 ? ;-) */
93
    enum CodecType codec_type;
94
    enum CodecID codec_id;
95
} AVRtpDynamicPayloadType_t;
96
97 33785a3a Michael Niedermayer
#if 0
98 d1ccf0e0 Romain Degez
typedef enum {
99
  RTCP_SR   = 200,
100
  RTCP_RR   = 201,
101
  RTCP_SDES = 202,
102
  RTCP_BYE  = 203,
103
  RTCP_APP  = 204
104
} rtcp_type_t;
105

106
typedef enum {
107
  RTCP_SDES_END    =  0,
108
  RTCP_SDES_CNAME  =  1,
109
  RTCP_SDES_NAME   =  2,
110
  RTCP_SDES_EMAIL  =  3,
111
  RTCP_SDES_PHONE  =  4,
112
  RTCP_SDES_LOC    =  5,
113
  RTCP_SDES_TOOL   =  6,
114
  RTCP_SDES_NOTE   =  7,
115
  RTCP_SDES_PRIV   =  8,
116
  RTCP_SDES_IMG    =  9,
117
  RTCP_SDES_DOOR   = 10,
118
  RTCP_SDES_SOURCE = 11
119
} rtcp_sdes_type_t;
120 33785a3a Michael Niedermayer
#endif
121 d1ccf0e0 Romain Degez
122
extern AVRtpPayloadType_t AVRtpPayloadTypes[];
123
extern AVRtpDynamicPayloadType_t AVRtpDynamicPayloadTypes[];
124
125 e309128f Fabrice Bellard
#endif /* RTP_H */