38 int i, cnum, h, m, s, ms, keylen = strlen(key);
41 if (keylen < 9 || sscanf(key,
"CHAPTER%02d", &cnum) != 1)
45 if (sscanf(val,
"%02d:%02d:%02d.%03d", &h, &m, &s, &ms) < 4)
49 ms + 1000*(s + 60*(m + 60*h)),
52 }
else if (!strcmp(key+9,
"NAME")) {
73 const uint8_t *p = buf;
74 const uint8_t *end = buf +
size;
81 s = bytestream_get_le32(&p);
83 if (end - p - 4 < s || s < 0)
88 n = bytestream_get_le32(&p);
90 while (end - p >= 4 && n > 0) {
94 s = bytestream_get_le32(&p);
96 if (end - p < s || s < 0)
103 v = memchr(t,
'=', s);
123 for (j = 0; j < tl; j++)
124 tt[j] = toupper(t[j]);
141 "truncated comment header, %i comments not found\n", n);
175 len = priv->
len[0] + priv->
len[1] + priv->
len[2];
182 for (i = 0; i < 3; i++) {
183 memcpy(&ptr[offset], priv->
packet[i], priv->
len[i]);
184 offset += priv->
len[i];
198 for (i = 0; i < 3; i++)
220 if (os->
psize < 1 || pkt_type > 5)
225 if (priv->
packet[pkt_type>>1])
227 if (pkt_type > 1 && !priv->
packet[0] || pkt_type > 3 && !priv->
packet[1])
230 priv->
len[pkt_type >> 1] = os->
psize;
234 const uint8_t *p = os->
buf + os->
pstart + 7;
235 unsigned blocksize, bs0, bs1;
241 if (bytestream_get_le32(&p) != 0)
245 srate = bytestream_get_le32(&p);
250 blocksize = bytestream_get_byte(&p);
251 bs0 = blocksize & 15;
252 bs1 = blocksize >> 4;
256 if (bs0 < 6 || bs1 > 13)
259 if (bytestream_get_byte(&p) != 1)
273 unsigned new_len = 7 + 4 +
AV_RL32(priv->
packet[1] + 7) + 4 + 1;
274 if (new_len >= 16 && new_len < os->psize) {
276 priv->
packet[1][new_len - 1] = 1;
277 priv->
len[1] = new_len;
289 .
magic =
"\001vorbis",