89 int ident, fragmented, tdt, num_pkts, pkt_len;
121 fragmented = buf[3] >> 6;
122 tdt = (buf[3] >> 4) & 3;
123 num_pkts = buf[3] & 0xf;
126 if (pkt_len > len - 6) {
128 "Invalid packet length %d in %d byte packet\n", pkt_len,
133 if (ident != data->
ident) {
135 "Unimplemented Xiph SDP configuration change detected\n");
141 "Unimplemented RTP Xiph packet settings (%d,%d,%d)\n",
142 fragmented, tdt, num_pkts);
149 if (fragmented == 0) {
155 memcpy(pkt->
data, buf, pkt_len);
180 }
else if (fragmented == 1) {
204 "Received packet without a start fragment; dropping.\n");
211 if (fragmented == 3) {
216 "Error occurred when getting fragment buffer.");
233 for (; *buf < buf_end; ++*
buf) {
236 if (!(**buf & 0x80)) {
249 const uint8_t * packed_headers_end,
253 unsigned num_packed, num_headers,
length, length1, length2, extradata_alloc;
256 if (packed_headers_end - packed_headers < 9) {
258 "Invalid %td byte packed header.",
259 packed_headers_end - packed_headers);
263 num_packed = bytestream_get_be32(&packed_headers);
264 xiph_data->
ident = bytestream_get_be24(&packed_headers);
265 length = bytestream_get_be16(&packed_headers);
266 num_headers =
get_base128(&packed_headers, packed_headers_end);
267 length1 =
get_base128(&packed_headers, packed_headers_end);
268 length2 =
get_base128(&packed_headers, packed_headers_end);
270 if (num_packed != 1 || num_headers > 3) {
272 "Unimplemented number of headers: %d packed headers, %d headers\n",
273 num_packed, num_headers);
277 if (packed_headers_end - packed_headers != length ||
278 length1 > length || length2 > length - length1) {
280 "Bad packed header lengths (%d,%d,%td,%d)\n", length1,
281 length2, packed_headers_end - packed_headers, length);
299 memcpy(ptr, packed_headers, length);
310 char *attr,
char *
value)
315 if (!strcmp(attr,
"sampling")) {
316 if (!strcmp(value,
"YCbCr-4:2:0")) {
318 }
else if (!strcmp(value,
"YCbCr-4:4:2")) {
320 }
else if (!strcmp(value,
"YCbCr-4:4:4")) {
324 "Unsupported pixel format %s\n", attr);
327 }
else if (!strcmp(attr,
"width")) {
330 codec->
width = atoi(value);
332 }
else if (!strcmp(attr,
"height")) {
335 codec->
height = atoi(value);
337 }
else if (!strcmp(attr,
"delivery-method")) {
340 }
else if (!strcmp(attr,
"configuration-uri")) {
345 }
else if (!strcmp(attr,
"configuration")) {
348 uint8_t *decoded_packet = NULL;
350 size_t decoded_alloc = strlen(value) / 4 * 3 + 4;
352 if (decoded_alloc <= INT_MAX) {
353 decoded_packet =
av_malloc(decoded_alloc);
354 if (decoded_packet) {
359 (decoded_packet, decoded_packet + packet_size, codec,
363 "Out of memory while decoding SDP configuration.\n");