Statistics
| Branch: | Revision:

ffmpeg / libavformat / rtp.h @ b973f9ad

History | View | Annotate | Download (3.22 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 5b21bdab Diego Biurrun
#ifndef FFMPEG_RTP_H
22
#define FFMPEG_RTP_H
23 e309128f Fabrice Bellard
24 99545457 Måns Rullgård
#include "avcodec.h"
25
#include "avformat.h"
26
27 e309128f Fabrice Bellard
#define RTP_MIN_PACKET_LENGTH 12
28
#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
29
30
int rtp_get_codec_info(AVCodecContext *codec, int payload_type);
31 1dd7345a Panagiotis Issaris
32 01c9c33a Panagiotis Issaris
/** return < 0 if unknown payload type */
33 e309128f Fabrice Bellard
int rtp_get_payload_type(AVCodecContext *codec);
34 8b1ab7bf Fabrice Bellard
35
typedef struct RTPDemuxContext RTPDemuxContext;
36 d1ccf0e0 Romain Degez
typedef struct rtp_payload_data_s rtp_payload_data_s;
37 dbf30963 Thijs
RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data);
38 115329f1 Diego Biurrun
int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
39 8b1ab7bf Fabrice Bellard
                     const uint8_t *buf, int len);
40
void rtp_parse_close(RTPDemuxContext *s);
41 e309128f Fabrice Bellard
42
int rtp_get_local_port(URLContext *h);
43
int rtp_set_remote_url(URLContext *h, const char *uri);
44
void rtp_get_file_handles(URLContext *h, int *prtp_fd, int *prtcp_fd);
45 78740240 Panagiotis Issaris
46
/**
47
 * some rtp servers assume client is dead if they don't hear from them...
48
 * so we send a Receiver Report to the provided ByteIO context
49
 * (we don't have access to the rtcp handle from here)
50
 */
51 a58b82f8 Luca Barbato
int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
52 e309128f Fabrice Bellard
53 d1ccf0e0 Romain Degez
#define RTP_PT_PRIVATE 96
54
#define RTP_VERSION 2
55 190e507b Panagiotis Issaris
#define RTP_MAX_SDES 256   /**< maximum text length for SDES */
56 d1ccf0e0 Romain Degez
57
/* RTCP paquets use 0.5 % of the bandwidth */
58
#define RTCP_TX_RATIO_NUM 5
59
#define RTCP_TX_RATIO_DEN 1000
60
61 01f132a1 Panagiotis Issaris
/** Structure listing useful vars to parse RTP packet payload*/
62 d1ccf0e0 Romain Degez
typedef struct rtp_payload_data_s
63
{
64
    int sizelength;
65
    int indexlength;
66
    int indexdeltalength;
67
    int profile_level_id;
68
    int streamtype;
69
    int objecttype;
70
    char *mode;
71
72 bdd54e37 Panagiotis Issaris
    /** mpeg 4 AU headers */
73 d1ccf0e0 Romain Degez
    struct AUHeaders {
74
        int size;
75
        int index;
76
        int cts_flag;
77
        int cts;
78
        int dts_flag;
79
        int dts;
80
        int rap_flag;
81
        int streamstate;
82
    } *au_headers;
83
    int nb_au_headers;
84
    int au_headers_length_bytes;
85
    int cur_au_index;
86
} rtp_payload_data_t;
87
88 33785a3a Michael Niedermayer
#if 0
89 d1ccf0e0 Romain Degez
typedef enum {
90
  RTCP_SR   = 200,
91
  RTCP_RR   = 201,
92
  RTCP_SDES = 202,
93
  RTCP_BYE  = 203,
94
  RTCP_APP  = 204
95
} rtcp_type_t;
96

97
typedef enum {
98
  RTCP_SDES_END    =  0,
99
  RTCP_SDES_CNAME  =  1,
100
  RTCP_SDES_NAME   =  2,
101
  RTCP_SDES_EMAIL  =  3,
102
  RTCP_SDES_PHONE  =  4,
103
  RTCP_SDES_LOC    =  5,
104
  RTCP_SDES_TOOL   =  6,
105
  RTCP_SDES_NOTE   =  7,
106
  RTCP_SDES_PRIV   =  8,
107
  RTCP_SDES_IMG    =  9,
108
  RTCP_SDES_DOOR   = 10,
109
  RTCP_SDES_SOURCE = 11
110
} rtcp_sdes_type_t;
111 33785a3a Michael Niedermayer
#endif
112 d1ccf0e0 Romain Degez
113 5b21bdab Diego Biurrun
#endif /* FFMPEG_RTP_H */