90 int ident, fragmented, tdt, num_pkts, pkt_len;
122 fragmented = buf[3] >> 6;
123 tdt = (buf[3] >> 4) & 3;
124 num_pkts = buf[3] & 0xf;
127 if (pkt_len > len - 6) {
129 "Invalid packet length %d in %d byte packet\n", pkt_len,
134 if (ident != data->
ident) {
136 "Unimplemented Xiph SDP configuration change detected\n");
142 "Unimplemented RTP Xiph packet settings (%d,%d,%d)\n",
143 fragmented, tdt, num_pkts);
150 if (fragmented == 0) {
156 memcpy(pkt->
data, buf, pkt_len);
181 }
else if (fragmented == 1) {
205 "Received packet without a start fragment; dropping.\n");
212 if (fragmented == 3) {
217 "Error occurred when getting fragment buffer.");
234 for (; *buf < buf_end; ++*
buf) {
237 if (!(**buf & 0x80)) {
250 const uint8_t * packed_headers_end,
254 unsigned num_packed, num_headers,
length, length1, length2, extradata_alloc;
257 if (packed_headers_end - packed_headers < 9) {
259 "Invalid %td byte packed header.",
260 packed_headers_end - packed_headers);
264 num_packed = bytestream_get_be32(&packed_headers);
265 xiph_data->
ident = bytestream_get_be24(&packed_headers);
266 length = bytestream_get_be16(&packed_headers);
267 num_headers =
get_base128(&packed_headers, packed_headers_end);
268 length1 =
get_base128(&packed_headers, packed_headers_end);
269 length2 =
get_base128(&packed_headers, packed_headers_end);
271 if (num_packed != 1 || num_headers > 3) {
273 "Unimplemented number of headers: %d packed headers, %d headers\n",
274 num_packed, num_headers);
278 if (packed_headers_end - packed_headers != length ||
279 length1 > length || length2 > length - length1) {
281 "Bad packed header lengths (%d,%d,%td,%d)\n", length1,
282 length2, packed_headers_end - packed_headers, length);
300 memcpy(ptr, packed_headers, length);
311 char *attr,
char *
value)
316 if (!strcmp(attr,
"sampling")) {
317 if (!strcmp(value,
"YCbCr-4:2:0")) {
319 }
else if (!strcmp(value,
"YCbCr-4:4:2")) {
321 }
else if (!strcmp(value,
"YCbCr-4:4:4")) {
325 "Unsupported pixel format %s\n", attr);
328 }
else if (!strcmp(attr,
"width")) {
331 codec->
width = atoi(value);
333 }
else if (!strcmp(attr,
"height")) {
336 codec->
height = atoi(value);
338 }
else if (!strcmp(attr,
"delivery-method")) {
341 }
else if (!strcmp(attr,
"configuration-uri")) {
346 }
else if (!strcmp(attr,
"configuration")) {
349 uint8_t *decoded_packet = NULL;
351 size_t decoded_alloc = strlen(value) / 4 * 3 + 4;
353 if (decoded_alloc <= INT_MAX) {
354 decoded_packet =
av_malloc(decoded_alloc);
355 if (decoded_packet) {
360 (decoded_packet, decoded_packet + packet_size, codec,
364 "Out of memory while decoding SDP configuration.\n");