~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libavformat/rtp_internal.h

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-25 15:47:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080225154712-qvr11ekcea4c9ry8
Tags: 1.1.6-0.1ubuntu1
* Merge from debian-multimedia (LP: #120003), Ubuntu Changes:
 - For ffmpeg-related build-deps, remove cvs from package names.
 - Standards-Version 3.7.3
 - Maintainer Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * RTP definitions
 
3
 * Copyright (c) 2006 Ryan Martell <rdm4@martellventures.com>
 
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
 
 
22
// this is a bit of a misnomer, because rtp & rtsp internal structures and prototypes are in here.
 
23
#ifndef RTP_INTERNAL_H
 
24
#define RTP_INTERNAL_H
 
25
 
 
26
// these statistics are used for rtcp receiver reports...
 
27
typedef struct {
 
28
    uint16_t max_seq;           ///< highest sequence number seen
 
29
    uint32_t cycles;            ///< shifted count of sequence number cycles
 
30
    uint32_t base_seq;          ///< base sequence number
 
31
    uint32_t bad_seq;           ///< last bad sequence number + 1
 
32
    int probation;              ///< sequence packets till source is valid
 
33
    int received;               ///< packets received
 
34
    int expected_prior;         ///< packets expected in last interval
 
35
    int received_prior;         ///< packets received in last interval
 
36
    uint32_t transit;           ///< relative transit time for previous packet
 
37
    uint32_t jitter;            ///< estimated jitter.
 
38
} RTPStatistics;
 
39
 
 
40
 
 
41
typedef int (*DynamicPayloadPacketHandlerProc) (struct RTPDemuxContext * s,
 
42
                                                AVPacket * pkt,
 
43
                                                uint32_t *timestamp,
 
44
                                                const uint8_t * buf,
 
45
                                                int len);
 
46
 
 
47
typedef struct RTPDynamicProtocolHandler_s {
 
48
    // fields from AVRtpDynamicPayloadType_s
 
49
    const char enc_name[50];    /* XXX: still why 50 ? ;-) */
 
50
    enum CodecType codec_type;
 
51
    enum CodecID codec_id;
 
52
 
 
53
    // may be null
 
54
    int (*parse_sdp_a_line) (AVStream * stream,
 
55
                             void *protocol_data,
 
56
                             const char *line); ///< Parse the a= line from the sdp field
 
57
    void *(*open) (); ///< allocate any data needed by the rtp parsing for this dynamic data.
 
58
    void (*close)(void *protocol_data); ///< free any data needed by the rtp parsing for this dynamic data.
 
59
    DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet.
 
60
 
 
61
    struct RTPDynamicProtocolHandler_s *next;
 
62
} RTPDynamicProtocolHandler;
 
63
 
 
64
// moved out of rtp.c, because the h264 decoder needs to know about this structure..
 
65
struct RTPDemuxContext {
 
66
    AVFormatContext *ic;
 
67
    AVStream *st;
 
68
    int payload_type;
 
69
    uint32_t ssrc;
 
70
    uint16_t seq;
 
71
    uint32_t timestamp;
 
72
    uint32_t base_timestamp;
 
73
    uint32_t cur_timestamp;
 
74
    int max_payload_size;
 
75
    struct MpegTSContext *ts;   /* only used for MP2T payloads */
 
76
    int read_buf_index;
 
77
    int read_buf_size;
 
78
    /* used to send back RTCP RR */
 
79
    URLContext *rtp_ctx;
 
80
    char hostname[256];
 
81
 
 
82
    RTPStatistics statistics; ///< Statistics for this stream (used by RTCP receiver reports)
 
83
 
 
84
    /* rtcp sender statistics receive */
 
85
    int64_t last_rtcp_ntp_time;    // TODO: move into statistics
 
86
    int64_t first_rtcp_ntp_time;   // TODO: move into statistics
 
87
    uint32_t last_rtcp_timestamp;  // TODO: move into statistics
 
88
 
 
89
    /* rtcp sender statistics */
 
90
    unsigned int packet_count;     // TODO: move into statistics (outgoing)
 
91
    unsigned int octet_count;      // TODO: move into statistics (outgoing)
 
92
    unsigned int last_octet_count; // TODO: move into statistics (outgoing)
 
93
    int first_packet;
 
94
    /* buffer for output */
 
95
    uint8_t buf[RTP_MAX_PACKET_LENGTH];
 
96
    uint8_t *buf_ptr;
 
97
 
 
98
    /* special infos for au headers parsing */
 
99
    rtp_payload_data_t *rtp_payload_data; // TODO: Move into dynamic payload handlers
 
100
 
 
101
    /* dynamic payload stuff */
 
102
    DynamicPayloadPacketHandlerProc parse_packet;     ///< This is also copied from the dynamic protocol handler structure
 
103
    void *dynamic_protocol_context;        ///< This is a copy from the values setup from the sdp parsing, in rtsp.c don't free me.
 
104
};
 
105
 
 
106
extern RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler;
 
107
 
 
108
int rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, char *value, int value_size); ///< from rtsp.c, but used by rtp dynamic protocol handlers.
 
109
#endif /* RTP_INTERNAL_H */
 
110