42 int i, cnum, h,
m,
s, ms, keylen = strlen(key);
45 if (keylen < 9 || sscanf(key,
"CHAPTER%03d", &cnum) != 1)
49 if (sscanf(val,
"%02d:%02d:%02d.%03d", &h, &m, &s, &ms) < 4)
53 ms + 1000 * (s + 60 * (m + 60 * h)),
56 }
else if (!strcmp(key + keylen - 4,
"NAME")) {
85 s = bytestream_get_le32(&p);
87 if (end - p - 4 < s || s < 0)
92 n = bytestream_get_le32(&p);
94 while (end - p >= 4 && n > 0) {
98 s = bytestream_get_le32(&p);
100 if (end - p < s || s < 0)
107 v = memchr(t,
'=', s);
126 for (j = 0; j < tl; j++)
139 if (!strcmp(tt,
"METADATA_BLOCK_PICTURE")) {
167 "%ti bytes of comment header remain\n", end - p);
170 "truncated comment header, %i comments not found\n", n);
208 len = priv->
len[0] + priv->
len[1] + priv->
len[2];
209 buf_len = len + len / 255 + 64;
213 memset(*buf,
'\0', buf_len);
219 for (i = 0; i < 3; i++) {
220 memcpy(&ptr[offset], priv->
packet[i], priv->
len[i]);
221 offset += priv->
len[i];
236 for (i = 0; i < 3; i++)
257 if (os->
psize < 1 || pkt_type > 5)
262 if (priv->
packet[pkt_type >> 1])
264 if (pkt_type > 1 && !priv->
packet[0] || pkt_type > 3 && !priv->
packet[1])
267 priv->
len[pkt_type >> 1] = os->
psize;
269 if (!priv->
packet[pkt_type >> 1])
274 unsigned blocksize, bs0, bs1;
281 if (bytestream_get_le32(&p) != 0)
284 channels = bytestream_get_byte(&p);
290 srate = bytestream_get_le32(&p);
295 blocksize = bytestream_get_byte(&p);
296 bs0 = blocksize & 15;
297 bs1 = blocksize >> 4;
301 if (bs0 < 6 || bs1 > 13)
304 if (bytestream_get_byte(&p) != 1)
317 os->
psize - 8) >= 0) {
319 unsigned new_len = 7 + 4 +
AV_RL32(priv->
packet[1] + 7) + 4 + 1;
320 if (new_len >= 16 && new_len < os->psize) {
322 priv->
packet[1][new_len - 1] = 1;
323 priv->
len[1] = new_len;
368 last_pkt = next_pkt = next_pkt + os->
psize;
369 for (; seg < os->
nsegs; seg++) {
377 last_pkt = next_pkt + os->
segments[seg];
420 .
magic =
"\001vorbis",