78 int ident, fragmented, tdt, num_pkts, pkt_len;
110 fragmented = buf[3] >> 6;
111 tdt = (buf[3] >> 4) & 3;
112 num_pkts = buf[3] & 0xf;
115 if (pkt_len > len - 6) {
117 "Invalid packet length %d in %d byte packet\n", pkt_len,
122 if (ident != data->
ident) {
124 "Unimplemented Xiph SDP configuration change detected\n");
130 "Unimplemented RTP Xiph packet settings (%d,%d,%d)\n",
131 fragmented, tdt, num_pkts);
138 if (fragmented == 0) {
144 memcpy(pkt->
data, buf, pkt_len);
169 }
else if (fragmented == 1) {
193 "Received packet without a start fragment; dropping.\n");
200 if (fragmented == 3) {
205 "Error occurred when getting fragment buffer.");
222 for (; *buf < buf_end; ++*buf) {
225 if (!(**buf & 0x80)) {
238 const uint8_t * packed_headers_end,
242 unsigned num_packed, num_headers, length, length1, length2, extradata_alloc;
245 if (packed_headers_end - packed_headers < 9) {
247 "Invalid %td byte packed header.",
248 packed_headers_end - packed_headers);
252 num_packed = bytestream_get_be32(&packed_headers);
253 xiph_data->
ident = bytestream_get_be24(&packed_headers);
254 length = bytestream_get_be16(&packed_headers);
255 num_headers =
get_base128(&packed_headers, packed_headers_end);
256 length1 =
get_base128(&packed_headers, packed_headers_end);
257 length2 =
get_base128(&packed_headers, packed_headers_end);
259 if (num_packed != 1 || num_headers > 3) {
261 "Unimplemented number of headers: %d packed headers, %d headers\n",
262 num_packed, num_headers);
266 if (packed_headers_end - packed_headers != length ||
267 length1 > length || length2 > length - length1) {
269 "Bad packed header lengths (%d,%d,%td,%d)\n", length1,
270 length2, packed_headers_end - packed_headers, length);
288 memcpy(ptr, packed_headers, length);
299 char *attr,
char *
value)
304 if (!strcmp(attr,
"sampling")) {
305 if (!strcmp(value,
"YCbCr-4:2:0")) {
307 }
else if (!strcmp(value,
"YCbCr-4:4:2")) {
309 }
else if (!strcmp(value,
"YCbCr-4:4:4")) {
313 "Unsupported pixel format %s\n", attr);
316 }
else if (!strcmp(attr,
"width")) {
319 codec->
width = atoi(value);
321 }
else if (!strcmp(attr,
"height")) {
324 codec->
height = atoi(value);
326 }
else if (!strcmp(attr,
"delivery-method")) {
329 }
else if (!strcmp(attr,
"configuration-uri")) {
334 }
else if (!strcmp(attr,
"configuration")) {
339 size_t decoded_alloc = strlen(value) / 4 * 3 + 4;
341 if (decoded_alloc <= INT_MAX) {
342 decoded_packet =
av_malloc(decoded_alloc);
343 if (decoded_packet) {
348 (decoded_packet, decoded_packet + packet_size, codec,
352 "Out of memory while decoding SDP configuration.\n");