Statistics
| Branch: | Revision:

ffmpeg / libavformat / rtp.h @ d7fb5a18

History | View | Annotate | Download (2.97 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 AVFORMAT_RTP_H
22
#define AVFORMAT_RTP_H
23

    
24
#include "libavcodec/avcodec.h"
25
#include "avformat.h"
26

    
27
/** Structure listing useful vars to parse RTP packet payload*/
28
typedef struct rtp_payload_data
29
{
30
    int sizelength;
31
    int indexlength;
32
    int indexdeltalength;
33
    int profile_level_id;
34
    int streamtype;
35
    int objecttype;
36
    char *mode;
37

    
38
    /** mpeg 4 AU headers */
39
    struct AUHeaders {
40
        int size;
41
        int index;
42
        int cts_flag;
43
        int cts;
44
        int dts_flag;
45
        int dts;
46
        int rap_flag;
47
        int streamstate;
48
    } *au_headers;
49
    int nb_au_headers;
50
    int au_headers_length_bytes;
51
    int cur_au_index;
52
} RTPPayloadData;
53

    
54
typedef struct PayloadContext PayloadContext;
55
typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
56

    
57
#define RTP_MIN_PACKET_LENGTH 12
58
#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
59

    
60
int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
61

    
62
/** return < 0 if unknown payload type */
63
int rtp_get_payload_type(AVCodecContext *codec);
64

    
65
typedef struct RTPDemuxContext RTPDemuxContext;
66
RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, RTPPayloadData *rtp_payload_data);
67
void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
68
                                    RTPDynamicProtocolHandler *handler);
69
int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
70
                     const uint8_t *buf, int len);
71
void rtp_parse_close(RTPDemuxContext *s);
72

    
73
int rtp_get_local_port(URLContext *h);
74
int rtp_set_remote_url(URLContext *h, const char *uri);
75
void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
76

    
77
/**
78
 * some rtp servers assume client is dead if they don't hear from them...
79
 * so we send a Receiver Report to the provided ByteIO context
80
 * (we don't have access to the rtcp handle from here)
81
 */
82
int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
83

    
84
#define RTP_PT_PRIVATE 96
85
#define RTP_VERSION 2
86
#define RTP_MAX_SDES 256   /**< maximum text length for SDES */
87

    
88
/* RTCP paquets use 0.5 % of the bandwidth */
89
#define RTCP_TX_RATIO_NUM 5
90
#define RTCP_TX_RATIO_DEN 1000
91

    
92
#endif /* AVFORMAT_RTP_H */