Mercurial > libavformat.hg
annotate rdt.h @ 3962:72efef66f566 libavformat
This patch refactors RDT packet header parsing so that it can be used in
rtsp.c to detect the ID of the packet source also in case of TCP streams.
This allows proper playback of RDT streams with multiple stream types, e.g.
audio + video. Accepted by LucaB in "RDT/Realmedia patches #2" thread on ML.
author | rbultje |
---|---|
date | Wed, 01 Oct 2008 12:37:07 +0000 |
parents | ed6f6aa977ec |
children | e6bf0896a019 |
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 |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
25 /** |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
26 * Calculate the response (RealChallenge2 in the RTSP header) to the |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
27 * challenge (RealChallenge1 in the RTSP header from the Real/Helix |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
28 * server), which is used as some sort of client validation. |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
29 * |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
30 * @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
|
31 * (40 data + 1 zero) bytes long. |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
32 * @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
|
33 * 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
|
34 * @param challenge pointer to the RealChallenge1 value provided by the |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
35 * server. |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
36 */ |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
37 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
|
38 const char *challenge); |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
39 |
3902
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
40 /** |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
41 * 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
|
42 */ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
43 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
|
44 |
3903
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
45 /** |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
46 * Add subscription information to Subscribe parameter string. |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
47 * |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
48 * @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
|
49 * @param size size of cmd. |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
50 * @param stream_nr stream number. |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
51 * @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
|
52 */ |
3959
ed6f6aa977ec
Remove access to rdt_data struct in functions called outside of the
rbultje
parents:
3905
diff
changeset
|
53 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
|
54 int stream_nr, int rule_nr); |
3959
ed6f6aa977ec
Remove access to rdt_data struct in functions called outside of the
rbultje
parents:
3905
diff
changeset
|
55 // FIXME this will be removed ASAP |
ed6f6aa977ec
Remove access to rdt_data struct in functions called outside of the
rbultje
parents:
3905
diff
changeset
|
56 void ff_rdt_subscribe_rule2(RTPDemuxContext *s, char *cmd, int size, |
ed6f6aa977ec
Remove access to rdt_data struct in functions called outside of the
rbultje
parents:
3905
diff
changeset
|
57 int stream_nr, int rule_nr); |
3903
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
58 |
3905
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
59 /** |
3962
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
60 * 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
|
61 * |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
62 * @param buf input buffer |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
63 * @param len length of input buffer |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
64 * @param sn will be set to the stream number this packet belongs to |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
65 * @param seq will be set to the sequence number this packet belongs to |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
66 * @param rn will be set to the rule number this packet belongs to |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
67 * @param ts will be set to the timestamp of the packet |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
68 * @return the amount of bytes consumed, or <0 on error |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
69 */ |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
70 int ff_rdt_parse_header(const uint8_t *buf, int len, |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
71 int *sn, int *seq, int *rn, uint32_t *ts); |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
72 |
72efef66f566
This patch refactors RDT packet header parsing so that it can be used in
rbultje
parents:
3959
diff
changeset
|
73 /** |
3905
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
74 * Parse RDT-style packet data (header + media data). |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
75 * Usage similar to rtp_parse_packet(). |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
76 */ |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
77 int ff_rdt_parse_packet(RTPDemuxContext *s, AVPacket *pkt, |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
78 const uint8_t *buf, int len); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
79 |
3876
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
80 #endif /* AVFORMAT_RDT_H */ |