annotate rdt.h @ 6491:b7f807b4cd88 libavformat tip

In mov demuxer, check that nb_streams is valid before using it in read_dac3
author bcoudurier
date Tue, 28 Sep 2010 00:33:21 +0000
parents a036426dc8e6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3876
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
1 /*
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
2 * Realmedia RTSP (RDT) definitions
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
3 * Copyright (c) 2007 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
4 *
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
5 * This file is part of FFmpeg.
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
6 *
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
11 *
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
15 * Lesser General Public License for more details.
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
16 *
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
20 */
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
21
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
22 #ifndef AVFORMAT_RDT_H
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
23 #define AVFORMAT_RDT_H
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
24
3981
ff78dd8e198a Fix 'make checkheaders', based on a patch by Diego Petten, flameeyes gmail com.
diego
parents: 3979
diff changeset
25 #include <stdint.h>
ff78dd8e198a Fix 'make checkheaders', based on a patch by Diego Petten, flameeyes gmail com.
diego
parents: 3979
diff changeset
26 #include "avformat.h"
4388
80f21f72d7d6 Split rtp.h in rtp.h, rtpdec.h, and rtpenc.h
lucabe
parents: 4165
diff changeset
27 #include "rtpdec.h"
3981
ff78dd8e198a Fix 'make checkheaders', based on a patch by Diego Petten, flameeyes gmail com.
diego
parents: 3979
diff changeset
28
3979
e6bf0896a019 Implement RDTDemuxContext, which contains RDT-specific data (similar to
rbultje
parents: 3962
diff changeset
29 typedef struct RDTDemuxContext RDTDemuxContext;
e6bf0896a019 Implement RDTDemuxContext, which contains RDT-specific data (similar to
rbultje
parents: 3962
diff changeset
30
4051
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
31 /**
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
32 * Allocate and init the RDT parsing context.
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
33 * @param ic the containing RTSP demuxer context
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
34 * @param first_stream_of_set_idx index to the first AVStream in the RTSP
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
35 * demuxer context's ic->streams array that is part of this
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
36 * particular stream's set of streams (with identical content)
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
37 * @param priv_data private data of the payload data handler context
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
38 * @param handler pointer to the parse_packet() payload parsing function
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
39 * @return a newly allocated RDTDemuxContext. Free with ff_rdt_parse_close().
53c652f24105 document ff_rdt_parse_open(). See ML discussion in "[PATCH] RDT/Realmedia
rbultje
parents: 4050
diff changeset
40 */
4050
7bc64c735f8b Change function prototype from taking an AVStream to taking an index to the
rbultje
parents: 4031
diff changeset
41 RDTDemuxContext *ff_rdt_parse_open(AVFormatContext *ic,
7bc64c735f8b Change function prototype from taking an AVStream to taking an index to the
rbultje
parents: 4031
diff changeset
42 int first_stream_of_set_idx,
3979
e6bf0896a019 Implement RDTDemuxContext, which contains RDT-specific data (similar to
rbultje
parents: 3962
diff changeset
43 void *priv_data,
e6bf0896a019 Implement RDTDemuxContext, which contains RDT-specific data (similar to
rbultje
parents: 3962
diff changeset
44 RTPDynamicProtocolHandler *handler);
e6bf0896a019 Implement RDTDemuxContext, which contains RDT-specific data (similar to
rbultje
parents: 3962
diff changeset
45 void ff_rdt_parse_close(RDTDemuxContext *s);
e6bf0896a019 Implement RDTDemuxContext, which contains RDT-specific data (similar to
rbultje
parents: 3962
diff changeset
46
3876
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
47 /**
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
48 * Calculate the response (RealChallenge2 in the RTSP header) to the
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
49 * challenge (RealChallenge1 in the RTSP header from the Real/Helix
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
50 * server), which is used as some sort of client validation.
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
51 *
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
52 * @param response pointer to response buffer, it should be at least 41 bytes
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
53 * (40 data + 1 zero) bytes long.
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
54 * @param chksum pointer to buffer containing a checksum of the response,
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
55 * it should be at least 9 (8 data + 1 zero) bytes long.
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
56 * @param challenge pointer to the RealChallenge1 value provided by the
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
57 * server.
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
58 */
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
59 void ff_rdt_calc_response_and_checksum(char response[41], char chksum[9],
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
60 const char *challenge);
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
61
3902
5f9bec099c69 Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents: 3876
diff changeset
62 /**
5f9bec099c69 Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents: 3876
diff changeset
63 * Register RDT-related dynamic payload handlers with our cache.
5f9bec099c69 Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents: 3876
diff changeset
64 */
5f9bec099c69 Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents: 3876
diff changeset
65 void av_register_rdt_dynamic_payload_handlers(void);
5f9bec099c69 Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents: 3876
diff changeset
66
3903
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
67 /**
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
68 * Add subscription information to Subscribe parameter string.
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
69 *
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
70 * @param cmd string to write the subscription information into.
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
71 * @param size size of cmd.
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
72 * @param stream_nr stream number.
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
73 * @param rule_nr rule number to conform to.
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
74 */
3959
ed6f6aa977ec Remove access to rdt_data struct in functions called outside of the
rbultje
parents: 3905
diff changeset
75 void ff_rdt_subscribe_rule(char *cmd, int size,
3903
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
76 int stream_nr, int rule_nr);
aeb79f68ba7e Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents: 3902
diff changeset
77
3905
91987686113d Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents: 3903
diff changeset
78 /**
3962
72efef66f566 This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents: 3959
diff changeset
79 * Parse RDT-style packet header.
72efef66f566 This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents: 3959
diff changeset
80 *
72efef66f566 This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents: 3959
diff changeset
81 * @param buf input buffer
72efef66f566 This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents: 3959
diff changeset
82 * @param len length of input buffer
4025
4a266106f604 Rename variables in ff_rdt_parse_header() and callers to match the
rbultje
parents: 3981
diff changeset
83 * @param set_id will be set to the set ID this packet belongs to
4031
cd5a6a766b14 Make function comment a bit more linguistically correct.
rbultje
parents: 4029
diff changeset
84 * @param seq_no will be set to the sequence number of the packet
4025
4a266106f604 Rename variables in ff_rdt_parse_header() and callers to match the
rbultje
parents: 3981
diff changeset
85 * @param stream_id will be set to the stream ID this packet belongs to
4029
9a0a46d465ae Add is_keyframe param to ff_rdt_parse_header(). See ML discussion in
rbultje
parents: 4025
diff changeset
86 * @param is_keyframe will be whether this packet belongs to a keyframe
4025
4a266106f604 Rename variables in ff_rdt_parse_header() and callers to match the
rbultje
parents: 3981
diff changeset
87 * @param timestamp will be set to the timestamp of the packet
6219
a036426dc8e6 Remove angular brackets from Doxygen comments; Doxygen confuses them for HTML.
diego
parents: 4388
diff changeset
88 * @return the amount of bytes consumed, or negative on error
3962
72efef66f566 This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents: 3959
diff changeset
89 */
72efef66f566 This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents: 3959
diff changeset
90 int ff_rdt_parse_header(const uint8_t *buf, int len,
4029
9a0a46d465ae Add is_keyframe param to ff_rdt_parse_header(). See ML discussion in
rbultje
parents: 4025
diff changeset
91 int *set_id, int *seq_no, int *stream_id,
9a0a46d465ae Add is_keyframe param to ff_rdt_parse_header(). See ML discussion in
rbultje
parents: 4025
diff changeset
92 int *is_keyframe, uint32_t *timestamp);
3962
72efef66f566 This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents: 3959
diff changeset
93
72efef66f566 This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents: 3959
diff changeset
94 /**
3905
91987686113d Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents: 3903
diff changeset
95 * Parse RDT-style packet data (header + media data).
91987686113d Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents: 3903
diff changeset
96 * Usage similar to rtp_parse_packet().
91987686113d Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents: 3903
diff changeset
97 */
3979
e6bf0896a019 Implement RDTDemuxContext, which contains RDT-specific data (similar to
rbultje
parents: 3962
diff changeset
98 int ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt,
3905
91987686113d Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents: 3903
diff changeset
99 const uint8_t *buf, int len);
91987686113d Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents: 3903
diff changeset
100
4163
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
101 /**
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
102 * Parse a server-related SDP line.
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
103 *
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
104 * @param s the RTSP AVFormatContext
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
105 * @param stream_index the index of the first stream in the set represented
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
106 * by the SDP m= line (in s->streams)
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
107 * @param buf the SDP line
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
108 */
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
109 void ff_real_parse_sdp_a_line(AVFormatContext *s, int stream_index,
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
110 const char *buf);
8d6512cbd657 Parse the ASMRuleBook SDP line to dynamically create one new AVStream for
rbultje
parents: 4051
diff changeset
111
3876
1026953d4ffe Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff changeset
112 #endif /* AVFORMAT_RDT_H */