annotate rtp_internal.h @ 1477:56fe078ffc27 libavformat

updating nut demuxer to latest spec no muxing yet no index yet no seeking yet libnuts crcs dont match mine (didnt investigate yet) samplerate is stored wrong by libnut (demuxer has a workaround) code is not clean or beautifull yet, but i thought its better to commit early before someone unneccesarily wastes his time duplicating the work demuxer split from muxer
author michael
date Sat, 11 Nov 2006 01:35:50 +0000
parents db97355877b1
children a6d6b2b19341
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
1 /*
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
2 * RTP definitions
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
3 * Copyright (c) 2006 Ryan Martell <rdm4@martellventures.com>
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
4 *
1421
2a02386efc5a move licence header fixes
gpoirier
parents: 1420
diff changeset
5 * This file is part of FFmpeg.
2a02386efc5a move licence header fixes
gpoirier
parents: 1420
diff changeset
6 *
2a02386efc5a move licence header fixes
gpoirier
parents: 1420
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
1420
af616468863c Fix licence header (aka <pedantic mode='on' /> )
gpoirier
parents: 1419
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
11 *
1420
af616468863c Fix licence header (aka <pedantic mode='on' /> )
gpoirier
parents: 1419
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
15 * Lesser General Public License for more details.
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
16 *
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
1422
0c8c68a6b35f Last fix of licence header
gpoirier
parents: 1421
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
20 */
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
21
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
22 // this is a bit of a misnomer, because rtp & rtsp internal structures and prototypes are in here.
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
23 #ifndef RTP_INTERNAL_H
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
24 #define RTP_INTERNAL_H
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
25
1445
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
26 // these statistics are used for rtcp receiver reports...
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
27 typedef struct {
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
28 uint16_t max_seq; ///< highest sequence number seen
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
29 uint32_t cycles; ///< shifted count of sequence number cycles
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
30 uint32_t base_seq; ///< base sequence number
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
31 uint32_t bad_seq; ///< last bad sequence number + 1
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
32 int probation; ///< sequence packets till source is valid
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
33 int received; ///< packets received
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
34 int expected_prior; ///< packets expected in last interval
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
35 int received_prior; ///< packets received in last interval
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
36 uint32_t transit; ///< relative transit time for previous packet
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
37 uint32_t jitter; ///< estimated jitter.
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
38 } RTPStatistics;
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
39
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
40
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
41 typedef int (*DynamicPayloadPacketHandlerProc) (struct RTPDemuxContext * s,
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
42 AVPacket * pkt,
1431
2d8a17631520 fix more dynamic protocol stuff, needed by the forthcoming h264
gpoirier
parents: 1425
diff changeset
43 uint32_t *timestamp,
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
44 const uint8_t * buf,
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
45 int len);
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
46
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
47 typedef struct RTPDynamicProtocolHandler_s {
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
48 // fields from AVRtpDynamicPayloadType_s
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
49 const char enc_name[50]; /* XXX: still why 50 ? ;-) */
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
50 enum CodecType codec_type;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
51 enum CodecID codec_id;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
52
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
53 // may be null
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
54 int (*parse_sdp_a_line) (AVStream * stream,
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
55 void *protocol_data,
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
56 const char *line); ///< Parse the a= line from the sdp field
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
57 void *(*open) (); ///< allocate any data needed by the rtp parsing for this dynamic data.
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
58 void (*close)(void *protocol_data); ///< free any data needed by the rtp parsing for this dynamic data.
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
59 DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet.
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
60
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
61 struct RTPDynamicProtocolHandler_s *next;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
62 } RTPDynamicProtocolHandler;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
63
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
64 // moved out of rtp.c, because the h264 decoder needs to know about this structure..
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
65 struct RTPDemuxContext {
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
66 AVFormatContext *ic;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
67 AVStream *st;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
68 int payload_type;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
69 uint32_t ssrc;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
70 uint16_t seq;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
71 uint32_t timestamp;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
72 uint32_t base_timestamp;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
73 uint32_t cur_timestamp;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
74 int max_payload_size;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
75 struct MpegTSContext *ts; /* only used for MP2T payloads */
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
76 int read_buf_index;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
77 int read_buf_size;
1425
00d9393a126f make ffmpeg able to send back a RTCP receiver report.
gpoirier
parents: 1422
diff changeset
78 /* used to send back RTCP RR */
00d9393a126f make ffmpeg able to send back a RTCP receiver report.
gpoirier
parents: 1422
diff changeset
79 URLContext *rtp_ctx;
00d9393a126f make ffmpeg able to send back a RTCP receiver report.
gpoirier
parents: 1422
diff changeset
80 char hostname[256];
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
81
1445
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
82 RTPStatistics statistics; ///< Statistics for this stream (used by RTCP receiver reports)
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
83
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
84 /* rtcp sender statistics receive */
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
85 int64_t last_rtcp_ntp_time; // TODO: move into statistics
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
86 int64_t first_rtcp_ntp_time; // TODO: move into statistics
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
87 uint32_t last_rtcp_timestamp; // TODO: move into statistics
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
88
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
89 /* rtcp sender statistics */
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
90 unsigned int packet_count; // TODO: move into statistics (outgoing)
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
91 unsigned int octet_count; // TODO: move into statistics (outgoing)
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
92 unsigned int last_octet_count; // TODO: move into statistics (outgoing)
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
93 int first_packet;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
94 /* buffer for output */
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
95 uint8_t buf[RTP_MAX_PACKET_LENGTH];
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
96 uint8_t *buf_ptr;
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
97
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
98 /* special infos for au headers parsing */
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
99 rtp_payload_data_t *rtp_payload_data; // TODO: Move into dynamic payload handlers
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
100
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
101 /* dynamic payload stuff */
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
102 DynamicPayloadPacketHandlerProc parse_packet; ///< This is also copied from the dynamic protocol handler structure
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
103 void *dynamic_protocol_context; ///< This is a copy from the values setup from the sdp parsing, in rtsp.c don't free me.
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
104 };
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
105
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
106 extern RTPDynamicProtocolHandler *RTPFirstDynamicPayloadHandler;
1445
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
107
db97355877b1 add valid statistics for the RTCP receiver report.
gpoirier
parents: 1431
diff changeset
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.
1419
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
109 #endif /* RTP_INTERNAL_H */
8fb4910bdcc0 Add support for H264 over RTP
gpoirier
parents:
diff changeset
110