Statistics
| Branch: | Revision:

ffmpeg / libavformat / rtp.h @ d7fb5a18

History | View | Annotate | Download (2.97 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 98790382 Stefano Sabatini
#ifndef AVFORMAT_RTP_H
22
#define AVFORMAT_RTP_H
23 e309128f Fabrice Bellard
24 245976da Diego Biurrun
#include "libavcodec/avcodec.h"
25 99545457 Måns Rullgård
#include "avformat.h"
26
27 1afe09d5 Luca Abeni
/** Structure listing useful vars to parse RTP packet payload*/
28 be73a544 Luca Abeni
typedef struct rtp_payload_data
29 1afe09d5 Luca Abeni
{
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 be73a544 Luca Abeni
} RTPPayloadData;
53 1afe09d5 Luca Abeni
54 99a1d191 Ronald S. Bultje
typedef struct PayloadContext PayloadContext;
55
typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
56
57 e309128f Fabrice Bellard
#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 1dd7345a Panagiotis Issaris
62 01c9c33a Panagiotis Issaris
/** return < 0 if unknown payload type */
63 e309128f Fabrice Bellard
int rtp_get_payload_type(AVCodecContext *codec);
64 8b1ab7bf Fabrice Bellard
65
typedef struct RTPDemuxContext RTPDemuxContext;
66 be73a544 Luca Abeni
RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, RTPPayloadData *rtp_payload_data);
67 99a1d191 Ronald S. Bultje
void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
68
                                    RTPDynamicProtocolHandler *handler);
69 115329f1 Diego Biurrun
int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
70 8b1ab7bf Fabrice Bellard
                     const uint8_t *buf, int len);
71
void rtp_parse_close(RTPDemuxContext *s);
72 e309128f Fabrice Bellard
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 78740240 Panagiotis Issaris
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 a58b82f8 Luca Barbato
int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
83 e309128f Fabrice Bellard
84 d1ccf0e0 Romain Degez
#define RTP_PT_PRIVATE 96
85
#define RTP_VERSION 2
86 190e507b Panagiotis Issaris
#define RTP_MAX_SDES 256   /**< maximum text length for SDES */
87 d1ccf0e0 Romain Degez
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 98790382 Stefano Sabatini
#endif /* AVFORMAT_RTP_H */