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];
257 for (i = 0; i < 3; i++)
308 if (os->
psize < 1 || pkt_type > 5)
313 if (priv->
packet[pkt_type >> 1])
315 if (pkt_type > 1 && !priv->
packet[0] || pkt_type > 3 && !priv->
packet[1])
318 priv->
len[pkt_type >> 1] = os->
psize;
320 if (!priv->
packet[pkt_type >> 1])
325 unsigned blocksize, bs0, bs1;
332 if (bytestream_get_le32(&p) != 0)
335 channels = bytestream_get_byte(&p);
341 srate = bytestream_get_le32(&p);
346 blocksize = bytestream_get_byte(&p);
347 bs0 = blocksize & 15;
348 bs1 = blocksize >> 4;
352 if (bs0 < 6 || bs1 > 13)
355 if (bytestream_get_byte(&p) != 1)
375 if (new_len >= 16 && new_len < os->psize) {
377 priv->
packet[1][new_len - 1] = 1;
378 priv->
len[1] = new_len;
426 last_pkt = next_pkt = next_pkt + os->
psize;
427 for (; seg < os->
nsegs; seg++) {
433 }
else if (flags & VORBIS_FLAG_COMMENT) {
438 last_pkt = next_pkt + os->
segments[seg];
488 .
magic =
"\001vorbis",