88 int ident, fragmented, tdt, num_pkts, pkt_len;
120 fragmented = buf[3] >> 6;
121 tdt = (buf[3] >> 4) & 3;
122 num_pkts = buf[3] & 0xf;
125 if (pkt_len > len - 6) {
127 "Invalid packet length %d in %d byte packet\n", pkt_len,
132 if (ident != data->
ident) {
134 "Unimplemented Xiph SDP configuration change detected\n");
140 "Unimplemented RTP Xiph packet settings (%d,%d,%d)\n",
141 fragmented, tdt, num_pkts);
148 if (fragmented == 0) {
154 memcpy(pkt->
data, buf, pkt_len);
179 }
else if (fragmented == 1) {
203 "Received packet without a start fragment; dropping.\n");
210 if (fragmented == 3) {
215 "Error occurred when getting fragment buffer.");
232 for (; *buf < buf_end; ++*buf) {
235 if (!(**buf & 0x80)) {
248 const uint8_t * packed_headers_end,
252 unsigned num_packed, num_headers, length, length1, length2, extradata_alloc;
255 if (packed_headers_end - packed_headers < 9) {
257 "Invalid %td byte packed header.",
258 packed_headers_end - packed_headers);
262 num_packed = bytestream_get_be32(&packed_headers);
263 xiph_data->
ident = bytestream_get_be24(&packed_headers);
264 length = bytestream_get_be16(&packed_headers);
265 num_headers =
get_base128(&packed_headers, packed_headers_end);
266 length1 =
get_base128(&packed_headers, packed_headers_end);
267 length2 =
get_base128(&packed_headers, packed_headers_end);
269 if (num_packed != 1 || num_headers > 3) {
271 "Unimplemented number of headers: %d packed headers, %d headers\n",
272 num_packed, num_headers);
276 if (packed_headers_end - packed_headers != length ||
277 length1 > length || length2 > length - length1) {
279 "Bad packed header lengths (%d,%d,%td,%d)\n", length1,
280 length2, packed_headers_end - packed_headers, length);
298 memcpy(ptr, packed_headers, length);
309 char *attr,
char *
value)
314 if (!strcmp(attr,
"sampling")) {
315 if (!strcmp(value,
"YCbCr-4:2:0")) {
317 }
else if (!strcmp(value,
"YCbCr-4:4:2")) {
319 }
else if (!strcmp(value,
"YCbCr-4:4:4")) {
323 "Unsupported pixel format %s\n", attr);
326 }
else if (!strcmp(attr,
"width")) {
329 codec->
width = atoi(value);
331 }
else if (!strcmp(attr,
"height")) {
334 codec->
height = atoi(value);
336 }
else if (!strcmp(attr,
"delivery-method")) {
339 }
else if (!strcmp(attr,
"configuration-uri")) {
344 }
else if (!strcmp(attr,
"configuration")) {
349 size_t decoded_alloc = strlen(value) / 4 * 3 + 4;
351 if (decoded_alloc <= INT_MAX) {
352 decoded_packet =
av_malloc(decoded_alloc);
353 if (decoded_packet) {
358 (decoded_packet, decoded_packet + packet_size, codec,
362 "Out of memory while decoding SDP configuration.\n");