1 /*
2 * Common code for the RTP depacketization of MPEG-4 formats.
3 * Copyright (c) 2010 Fabrice Bellard
4 * Romain Degez
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23 /**
24 * @file
25 * @brief MPEG4 / RTP Code
26 * @author Fabrice Bellard
27 * @author Romain Degez
28 */
29
35
36 /** Structure listing useful vars to parse RTP packet payload */
45
46 /** mpeg 4 AU headers */
61
64 };
65
71
72 /* All known fmtp parameters and the corresponding RTPAttrTypeEnum */
73 #define ATTR_NAME_TYPE_INT 0
74 #define ATTR_NAME_TYPE_STR 1
88 { NULL, -1, -1 },
89 };
90
92 {
94 }
95
97 {
101 }
102
104 {
105 /* decode the hexa encoded parameter */
111 return 0;
112 }
113
115 {
116 int au_headers_length, au_header_size, i;
118
119 if (len < 2)
121
122 /* decode the first 2 bytes where the AUHeader sections are stored
123 length in bits */
124 au_headers_length =
AV_RB16(buf);
125
127 return -1;
128
130
131 /* skip AU headers length section (2 bytes) */
132 buf += 2;
133 len -= 2;
134
135 if (len < data->au_headers_length_bytes)
137
139
140 /* XXX: Wrong if optional additional sections are present (cts, dts etc...) */
142 if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
143 return -1;
144
152 }
153
157 }
158
159 return 0;
160 }
161
162
163 /* Follows RFC 3640 */
168 {
170
171 if (!buf) {
183 }
184
186 return -1;
187
190
191 if (len < data->au_headers[0].
size)
199
205 return 1;
206 }
207
208 return 0;
209 }
210
212 char *attr,
char *
value)
213 {
216
217 if (!strcmp(attr, "config")) {
219
220 if (res < 0)
222 }
223
225 /* Looking for a known attribute */
226 for (i = 0; attr_names[i].
str; ++i) {
229 *(int *)((char *)data+
230 attr_names[i].
offset) = atoi(value);
232 *(char **)((char *)data+
234 }
235 }
236 }
237 return 0;
238 }
239
242 {
243 const char *p;
244
245 if (st_index < 0)
246 return 0;
247
250
251 return 0;
252 }
253
256 {
257 if (st_index < 0)
258 return 0;
260 return 0;
261 }
262
269 };
270
279 };