43 int i, cnum, h,
m,
s, ms, keylen = strlen(key);
46 if (keylen < 9 || sscanf(key,
"CHAPTER%03d", &cnum) != 1)
50 if (sscanf(val,
"%02d:%02d:%02d.%03d", &h, &m, &s, &ms) < 4)
54 ms + 1000 * (s + 60 * (m + 60 * h)),
57 }
else if (!strcmp(key + keylen - 4,
"NAME")) {
100 s = bytestream_get_le32(&p);
102 if (end - p - 4 < s || s < 0)
107 n = bytestream_get_le32(&p);
109 while (end - p >= 4 && n > 0) {
113 s = bytestream_get_le32(&p);
115 if (end - p < s || s < 0)
122 v = memchr(t,
'=', s);
141 for (j = 0; j < tl; j++)
154 if (!strcmp(tt,
"METADATA_BLOCK_PICTURE") && parse_picture) {
191 "truncated comment header, %i comments not found\n", n);
229 len = priv->
len[0] + priv->
len[1] + priv->
len[2];
230 buf_len = len + len / 255 + 64;
234 memset(*buf,
'\0', buf_len);
240 for (i = 0; i < 3; i++) {
241 memcpy(&ptr[offset], priv->
packet[i], priv->
len[i]);
242 offset += priv->
len[i];
258 for (i = 0; i < 3; i++)
312 if (os->
psize < 1 || pkt_type > 5)
315 if (priv->
packet[pkt_type >> 1])
317 if (pkt_type > 1 && !priv->
packet[0] || pkt_type > 3 && !priv->
packet[1])
320 priv->
len[pkt_type >> 1] = os->
psize;
322 if (!priv->
packet[pkt_type >> 1])
327 unsigned blocksize, bs0, bs1;
334 if (bytestream_get_le32(&p) != 0)
337 channels = bytestream_get_byte(&p);
343 srate = bytestream_get_le32(&p);
348 blocksize = bytestream_get_byte(&p);
349 bs0 = blocksize & 15;
350 bs1 = blocksize >> 4;
354 if (bs0 < 6 || bs1 > 13)
357 if (bytestream_get_byte(&p) != 1)
377 if (new_len >= 16 && new_len < os->psize) {
379 priv->
packet[1][new_len - 1] = 1;
380 priv->
len[1] = new_len;
430 last_pkt = next_pkt = next_pkt + os->
psize;
431 for (; seg < os->
nsegs; seg++) {
437 }
else if (flags & VORBIS_FLAG_COMMENT) {
442 last_pkt = next_pkt + os->
segments[seg];
492 .
magic =
"\001vorbis",