Mercurial > libavformat.hg
annotate rdt.c @ 3947:a324a7aa8a5b libavformat
Move doxygen comments for av_gettime from utils.c to avformat.h.
author | diego |
---|---|
date | Sat, 27 Sep 2008 17:37:22 +0000 |
parents | 91987686113d |
children | ed6f6aa977ec |
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 protocol (RDT) support. |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
3 * Copyright (c) 2007 Ronald S. Bultje |
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 /** |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
23 * @file rdt.c |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
24 * @brief Realmedia RTSP protocol (RDT) support |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
25 * @author Ronald S. Bultje <rbultje@ronald.bitfreak.net> |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
26 */ |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
27 |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
28 #include "avformat.h" |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
29 #include "libavutil/avstring.h" |
3902
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
30 #include "rtp_internal.h" |
3876
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
31 #include "rdt.h" |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
32 #include "libavutil/base64.h" |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
33 #include "libavutil/md5.h" |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
34 #include "rm.h" |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
35 #include "internal.h" |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
36 |
3902
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
37 typedef struct rdt_data { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
38 AVFormatContext *rmctx; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
39 uint8_t *mlti_data; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
40 unsigned int mlti_data_size; |
3905
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
41 uint32_t prev_sn, prev_ts; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
42 char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE]; |
3902
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
43 } rdt_data; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
44 |
3876
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
45 void |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
46 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
|
47 const char *challenge) |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
48 { |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
49 int ch_len = strlen (challenge), i; |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
50 unsigned char zres[16], |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
51 buf[64] = { 0xa1, 0xe9, 0x14, 0x9d, 0x0e, 0x6b, 0x3b, 0x59 }; |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
52 #define XOR_TABLE_SIZE 37 |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
53 const unsigned char xor_table[XOR_TABLE_SIZE] = { |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
54 0x05, 0x18, 0x74, 0xd0, 0x0d, 0x09, 0x02, 0x53, |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
55 0xc0, 0x01, 0x05, 0x05, 0x67, 0x03, 0x19, 0x70, |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
56 0x08, 0x27, 0x66, 0x10, 0x10, 0x72, 0x08, 0x09, |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
57 0x63, 0x11, 0x03, 0x71, 0x08, 0x08, 0x70, 0x02, |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
58 0x10, 0x57, 0x05, 0x18, 0x54 }; |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
59 |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
60 /* some (length) checks */ |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
61 if (ch_len == 40) /* what a hack... */ |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
62 ch_len = 32; |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
63 else if (ch_len > 56) |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
64 ch_len = 56; |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
65 memcpy(buf + 8, challenge, ch_len); |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
66 |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
67 /* xor challenge bytewise with xor_table */ |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
68 for (i = 0; i < XOR_TABLE_SIZE; i++) |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
69 buf[8 + i] ^= xor_table[i]; |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
70 |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
71 av_md5_sum(zres, buf, 64); |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
72 ff_data_to_hex(response, zres, 16); |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
73 for (i=0;i<32;i++) response[i] = tolower(response[i]); |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
74 |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
75 /* add tail */ |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
76 strcpy (response + 32, "01d0a8e3"); |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
77 |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
78 /* calculate checksum */ |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
79 for (i = 0; i < 8; i++) |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
80 chksum[i] = response[i * 4]; |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
81 chksum[8] = 0; |
1026953d4ffe
Implement Realmedia/RTSP-compatible SETUP command. This includes calculation
rbultje
parents:
diff
changeset
|
82 } |
3902
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
83 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
84 static int |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
85 rdt_load_mdpr (rdt_data *rdt, AVStream *st, int rule_nr) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
86 { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
87 ByteIOContext *pb; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
88 int size; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
89 uint32_t tag; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
90 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
91 /** |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
92 * Layout of the MLTI chunk: |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
93 * 4:MLTI |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
94 * 2:<number of streams> |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
95 * Then for each stream ([number_of_streams] times): |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
96 * 2:<mdpr index> |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
97 * 2:<number of mdpr chunks> |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
98 * Then for each mdpr chunk ([number_of_mdpr_chunks] times): |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
99 * 4:<size> |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
100 * [size]:<data> |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
101 * we skip MDPR chunks until we reach the one of the stream |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
102 * we're interested in, and forward that ([size]+[data]) to |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
103 * the RM demuxer to parse the stream-specific header data. |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
104 */ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
105 if (!rdt->mlti_data) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
106 return -1; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
107 url_open_buf(&pb, rdt->mlti_data, rdt->mlti_data_size, URL_RDONLY); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
108 tag = get_le32(pb); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
109 if (tag == MKTAG('M', 'L', 'T', 'I')) { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
110 int num, chunk_nr; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
111 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
112 /* read index of MDPR chunk numbers */ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
113 num = get_be16(pb); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
114 if (rule_nr < 0 || rule_nr >= num) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
115 return -1; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
116 url_fskip(pb, rule_nr * 2); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
117 chunk_nr = get_be16(pb); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
118 url_fskip(pb, (num - 1 - rule_nr) * 2); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
119 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
120 /* read MDPR chunks */ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
121 num = get_be16(pb); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
122 if (chunk_nr >= num) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
123 return -1; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
124 while (chunk_nr--) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
125 url_fskip(pb, get_be32(pb)); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
126 size = get_be32(pb); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
127 } else { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
128 size = rdt->mlti_data_size; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
129 url_fseek(pb, 0, SEEK_SET); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
130 } |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
131 rdt->rmctx->pb = pb; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
132 if (ff_rm_read_mdpr_codecdata(rdt->rmctx, st, size) < 0) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
133 return -1; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
134 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
135 url_close_buf(pb); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
136 return 0; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
137 } |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
138 |
3905
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
139 /** |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
140 * Actual data handling. |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
141 */ |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
142 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
143 static int rdt_parse_header(struct RTPDemuxContext *s, const uint8_t *buf, |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
144 int len, int *seq, uint32_t *timestamp, int *flags) |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
145 { |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
146 rdt_data *rdt = s->dynamic_protocol_context; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
147 int consumed = 0, sn; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
148 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
149 if (buf[0] < 0x40 || buf[0] > 0x42) { |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
150 buf += 9; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
151 len -= 9; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
152 consumed += 9; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
153 } |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
154 sn = (buf[0]>>1) & 0x1f; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
155 *seq = AV_RB16(buf+1); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
156 *timestamp = AV_RB32(buf+4); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
157 if (!(buf[3] & 1) && (sn != rdt->prev_sn || *timestamp != rdt->prev_ts)) { |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
158 *flags |= PKT_FLAG_KEY; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
159 rdt->prev_sn = sn; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
160 rdt->prev_ts = *timestamp; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
161 } |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
162 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
163 return consumed + 10; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
164 } |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
165 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
166 /**< return 0 on packet, no more left, 1 on packet, 1 on partial packet... */ |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
167 static int |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
168 rdt_parse_packet (RTPDemuxContext *s, AVPacket *pkt, uint32_t *timestamp, |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
169 const uint8_t *buf, int len, int flags) |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
170 { |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
171 rdt_data *rdt = s->dynamic_protocol_context; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
172 int seq = 1, res; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
173 ByteIOContext *pb = rdt->rmctx->pb; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
174 RMContext *rm = rdt->rmctx->priv_data; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
175 AVStream *st = s->st; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
176 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
177 if (rm->audio_pkt_cnt == 0) { |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
178 int pos; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
179 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
180 url_open_buf (&pb, buf, len, URL_RDONLY); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
181 flags = (flags & PKT_FLAG_KEY) ? 2 : 0; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
182 rdt->rmctx->pb = pb; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
183 res = ff_rm_parse_packet (rdt->rmctx, st, len, pkt, |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
184 &seq, &flags, timestamp); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
185 pos = url_ftell(pb); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
186 url_close_buf (pb); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
187 if (res < 0) |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
188 return res; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
189 if (rm->audio_pkt_cnt > 0 && |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
190 st->codec->codec_id == CODEC_ID_AAC) { |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
191 memcpy (rdt->buffer, buf + pos, len - pos); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
192 url_open_buf (&pb, rdt->buffer, len - pos, URL_RDONLY); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
193 rdt->rmctx->pb = pb; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
194 } |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
195 } else { |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
196 ff_rm_retrieve_cache (rdt->rmctx, st, pkt); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
197 if (rm->audio_pkt_cnt == 0 && |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
198 st->codec->codec_id == CODEC_ID_AAC) |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
199 url_close_buf (pb); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
200 } |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
201 pkt->stream_index = st->index; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
202 pkt->pts = *timestamp; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
203 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
204 return rm->audio_pkt_cnt > 0; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
205 } |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
206 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
207 int |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
208 ff_rdt_parse_packet(RTPDemuxContext *s, AVPacket *pkt, |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
209 const uint8_t *buf, int len) |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
210 { |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
211 int seq, flags = 0; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
212 uint32_t timestamp; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
213 int rv= 0; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
214 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
215 if (!buf) { |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
216 /* return the next packets, if any */ |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
217 timestamp= 0; ///< Should not be used if buf is NULL, but should be set to the timestamp of the packet returned.... |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
218 rv= rdt_parse_packet(s, pkt, ×tamp, NULL, 0, flags); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
219 return rv; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
220 } |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
221 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
222 if (len < 12) |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
223 return -1; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
224 rv = rdt_parse_header(s, buf, len, &seq, ×tamp, &flags); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
225 if (rv < 0) |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
226 return rv; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
227 buf += rv; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
228 len -= rv; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
229 s->seq = seq; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
230 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
231 rv = rdt_parse_packet(s, pkt, ×tamp, buf, len, flags); |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
232 |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
233 return rv; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
234 } |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
235 |
3903
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
236 void |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
237 ff_rdt_subscribe_rule (RTPDemuxContext *s, char *cmd, int size, |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
238 int stream_nr, int rule_nr) |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
239 { |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
240 rdt_data *rdt = s->dynamic_protocol_context; |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
241 |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
242 av_strlcatf(cmd, size, "stream=%d;rule=%d,stream=%d;rule=%d", |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
243 stream_nr, rule_nr, stream_nr, rule_nr + 1); |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
244 |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
245 rdt_load_mdpr(rdt, s->st, 0); |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
246 } |
aeb79f68ba7e
Implement a RDT-specific SET_PARAMETER command that subscribes to the
rbultje
parents:
3902
diff
changeset
|
247 |
3902
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
248 static unsigned char * |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
249 rdt_parse_b64buf (unsigned int *target_len, const char *p) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
250 { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
251 unsigned char *target; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
252 int len = strlen(p); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
253 if (*p == '\"') { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
254 p++; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
255 len -= 2; /* skip embracing " at start/end */ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
256 } |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
257 *target_len = len * 3 / 4; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
258 target = av_mallocz(*target_len + FF_INPUT_BUFFER_PADDING_SIZE); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
259 av_base64_decode(target, p, *target_len); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
260 return target; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
261 } |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
262 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
263 static int |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
264 rdt_parse_sdp_line (AVStream *stream, void *d, const char *line) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
265 { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
266 rdt_data *rdt = d; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
267 const char *p = line; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
268 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
269 if (av_strstart(p, "OpaqueData:buffer;", &p)) { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
270 rdt->mlti_data = rdt_parse_b64buf(&rdt->mlti_data_size, p); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
271 } else if (av_strstart(p, "StartTime:integer;", &p)) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
272 stream->first_dts = atoi(p); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
273 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
274 return 0; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
275 } |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
276 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
277 static void * |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
278 rdt_new_extradata (void) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
279 { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
280 rdt_data *rdt = av_mallocz(sizeof(rdt_data)); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
281 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
282 av_open_input_stream(&rdt->rmctx, NULL, "", &rdt_demuxer, NULL); |
3905
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
283 rdt->prev_ts = -1; |
91987686113d
Implement RDT-specific data parsing routines. After these changes, simple
rbultje
parents:
3903
diff
changeset
|
284 rdt->prev_sn = -1; |
3902
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
285 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
286 return rdt; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
287 } |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
288 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
289 static void |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
290 rdt_free_extradata (void *d) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
291 { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
292 rdt_data *rdt = d; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
293 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
294 if (rdt->rmctx) |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
295 av_close_input_stream(rdt->rmctx); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
296 av_freep(&rdt->mlti_data); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
297 av_free(rdt); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
298 } |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
299 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
300 #define RDT_HANDLER(n, s, t) \ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
301 static RTPDynamicProtocolHandler ff_rdt_ ## n ## _handler = { \ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
302 s, \ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
303 t, \ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
304 CODEC_ID_NONE, \ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
305 rdt_parse_sdp_line, \ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
306 rdt_new_extradata, \ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
307 rdt_free_extradata \ |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
308 }; |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
309 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
310 RDT_HANDLER(live_video, "x-pn-multirate-realvideo-live", CODEC_TYPE_VIDEO); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
311 RDT_HANDLER(live_audio, "x-pn-multirate-realaudio-live", CODEC_TYPE_AUDIO); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
312 RDT_HANDLER(video, "x-pn-realvideo", CODEC_TYPE_VIDEO); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
313 RDT_HANDLER(audio, "x-pn-realaudio", CODEC_TYPE_AUDIO); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
314 |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
315 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
|
316 { |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
317 ff_register_dynamic_payload_handler(&ff_rdt_video_handler); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
318 ff_register_dynamic_payload_handler(&ff_rdt_audio_handler); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
319 ff_register_dynamic_payload_handler(&ff_rdt_live_video_handler); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
320 ff_register_dynamic_payload_handler(&ff_rdt_live_audio_handler); |
5f9bec099c69
Add dynamic payload handlers to rdt.c. These follow the same API as the ones
rbultje
parents:
3876
diff
changeset
|
321 } |