Statistics
| Branch: | Revision:

ffmpeg / libavformat / rtp.h @ 756fb7fe

History | View | Annotate | Download (3.54 KB)

1 e309128f Fabrice Bellard
/*
2
 * RTP definitions
3
 * Copyright (c) 2002 Fabrice Bellard.
4
 *
5 b78e7197 Diego Biurrun
 * This file is part of FFmpeg.
6
 *
7
 * FFmpeg is free software; you can redistribute it and/or
8 e309128f Fabrice Bellard
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10 b78e7197 Diego Biurrun
 * version 2.1 of the License, or (at your option) any later version.
11 e309128f Fabrice Bellard
 *
12 b78e7197 Diego Biurrun
 * FFmpeg is distributed in the hope that it will be useful,
13 e309128f Fabrice Bellard
 * 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 b78e7197 Diego Biurrun
 * License along with FFmpeg; if not, write to the Free Software
19 5509bffa Diego Biurrun
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 e309128f Fabrice Bellard
 */
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 1dd7345a Panagiotis Issaris
30 01c9c33a Panagiotis Issaris
/** return < 0 if unknown payload type */
31 e309128f Fabrice Bellard
int rtp_get_payload_type(AVCodecContext *codec);
32 8b1ab7bf Fabrice Bellard
33
typedef struct RTPDemuxContext RTPDemuxContext;
34 d1ccf0e0 Romain Degez
typedef struct rtp_payload_data_s rtp_payload_data_s;
35 dbf30963 Thijs
RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data);
36 115329f1 Diego Biurrun
int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
37 8b1ab7bf Fabrice Bellard
                     const uint8_t *buf, int len);
38
void rtp_parse_close(RTPDemuxContext *s);
39 e309128f Fabrice Bellard
40 d2a067d1 Måns Rullgård
extern AVOutputFormat rtp_muxer;
41
extern AVInputFormat rtp_demuxer;
42 e309128f Fabrice Bellard
43
int rtp_get_local_port(URLContext *h);
44
int rtp_set_remote_url(URLContext *h, const char *uri);
45
void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
46 78740240 Panagiotis Issaris
47
/**
48
 * some rtp servers assume client is dead if they don't hear from them...
49
 * so we send a Receiver Report to the provided ByteIO context
50
 * (we don't have access to the rtcp handle from here)
51
 */
52 a58b82f8 Luca Barbato
int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
53 e309128f Fabrice Bellard
54
extern URLProtocol rtp_protocol;
55
56 d1ccf0e0 Romain Degez
#define RTP_PT_PRIVATE 96
57
#define RTP_VERSION 2
58 190e507b Panagiotis Issaris
#define RTP_MAX_SDES 256   /**< maximum text length for SDES */
59 d1ccf0e0 Romain Degez
60
/* RTCP paquets use 0.5 % of the bandwidth */
61
#define RTCP_TX_RATIO_NUM 5
62
#define RTCP_TX_RATIO_DEN 1000
63
64 01f132a1 Panagiotis Issaris
/** Structure listing useful vars to parse RTP packet payload*/
65 d1ccf0e0 Romain Degez
typedef struct rtp_payload_data_s
66
{
67
    int sizelength;
68
    int indexlength;
69
    int indexdeltalength;
70
    int profile_level_id;
71
    int streamtype;
72
    int objecttype;
73
    char *mode;
74
75 bdd54e37 Panagiotis Issaris
    /** mpeg 4 AU headers */
76 d1ccf0e0 Romain Degez
    struct AUHeaders {
77
        int size;
78
        int index;
79
        int cts_flag;
80
        int cts;
81
        int dts_flag;
82
        int dts;
83
        int rap_flag;
84
        int streamstate;
85
    } *au_headers;
86
    int nb_au_headers;
87
    int au_headers_length_bytes;
88
    int cur_au_index;
89
} rtp_payload_data_t;
90
91
typedef struct AVRtpPayloadType_s
92
{
93
    int pt;
94
    const char enc_name[50]; /* XXX: why 50 ? */
95
    enum CodecType codec_type;
96
    enum CodecID codec_id;
97
    int clock_rate;
98
    int audio_channels;
99
} AVRtpPayloadType_t;
100
101 33785a3a Michael Niedermayer
#if 0
102 d1ccf0e0 Romain Degez
typedef enum {
103
  RTCP_SR   = 200,
104
  RTCP_RR   = 201,
105
  RTCP_SDES = 202,
106
  RTCP_BYE  = 203,
107
  RTCP_APP  = 204
108
} rtcp_type_t;
109

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