Statistics
| Branch: | Revision:

ffmpeg / libavformat / rtp.h @ 1afdcdf1

History | View | Annotate | Download (3.3 KB)

1
/*
2
 * RTP 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 RTP_H
22
#define RTP_H
23

    
24
#define RTP_MIN_PACKET_LENGTH 12
25
#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
26

    
27
int rtp_init(void);
28
int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
29
int rtp_get_payload_type(AVCodecContext *codec);
30

    
31
typedef struct RTPDemuxContext RTPDemuxContext;
32
typedef struct rtp_payload_data_s rtp_payload_data_s;
33
RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data);
34
int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
35
                     const uint8_t *buf, int len);
36
void rtp_parse_close(RTPDemuxContext *s);
37

    
38
extern AVOutputFormat rtp_muxer;
39
extern AVInputFormat rtp_demuxer;
40

    
41
int rtp_get_local_port(URLContext *h);
42
int rtp_set_remote_url(URLContext *h, const char *uri);
43
void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
44
int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
45

    
46
extern URLProtocol rtp_protocol;
47

    
48
#define RTP_PT_PRIVATE 96
49
#define RTP_VERSION 2
50
#define RTP_MAX_SDES 256   /* maximum text length for SDES */
51

    
52
/* RTCP paquets use 0.5 % of the bandwidth */
53
#define RTCP_TX_RATIO_NUM 5
54
#define RTCP_TX_RATIO_DEN 1000
55

    
56
/* Structure listing useful vars to parse RTP packet payload*/
57
typedef struct rtp_payload_data_s
58
{
59
    int sizelength;
60
    int indexlength;
61
    int indexdeltalength;
62
    int profile_level_id;
63
    int streamtype;
64
    int objecttype;
65
    char *mode;
66

    
67
    /* mpeg 4 AU headers */
68
    struct AUHeaders {
69
        int size;
70
        int index;
71
        int cts_flag;
72
        int cts;
73
        int dts_flag;
74
        int dts;
75
        int rap_flag;
76
        int streamstate;
77
    } *au_headers;
78
    int nb_au_headers;
79
    int au_headers_length_bytes;
80
    int cur_au_index;
81
} rtp_payload_data_t;
82

    
83
typedef struct AVRtpPayloadType_s
84
{
85
    int pt;
86
    const char enc_name[50]; /* XXX: why 50 ? */
87
    enum CodecType codec_type;
88
    enum CodecID codec_id;
89
    int clock_rate;
90
    int audio_channels;
91
} AVRtpPayloadType_t;
92

    
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;
101

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
117

    
118
extern AVRtpPayloadType_t AVRtpPayloadTypes[];
119
#endif /* RTP_H */