39 int i, cnum, h,
m, s, ms, keylen = strlen(key);
42 if (keylen < 9 || sscanf(key,
"CHAPTER%02d", &cnum) != 1)
46 if (sscanf(val,
"%02d:%02d:%02d.%03d", &h, &m, &s, &ms) < 4)
50 ms + 1000*(s + 60*(m + 60*h)),
53 }
else if (!strcmp(key+9,
"NAME")) {
82 s = bytestream_get_le32(&p);
84 if (end - p - 4 < s || s < 0)
89 n = bytestream_get_le32(&p);
91 while (end - p >= 4 && n > 0) {
95 s = bytestream_get_le32(&p);
97 if (end - p < s || s < 0)
104 v = memchr(t,
'=', s);
124 for (j = 0; j < tl; j++)
142 "truncated comment header, %i comments not found\n", n);
179 len = priv->
len[0] + priv->
len[1] + priv->
len[2];
180 buf_len = len + len/255 + 64;
184 memset(*buf,
'\0', buf_len);
190 for (i = 0; i < 3; i++) {
191 memcpy(&ptr[offset], priv->
packet[i], priv->
len[i]);
192 offset += priv->
len[i];
206 for (i = 0; i < 3; i++)
228 if (os->
psize < 1 || pkt_type > 5)
233 if (priv->
packet[pkt_type>>1])
235 if (pkt_type > 1 && !priv->
packet[0] || pkt_type > 3 && !priv->
packet[1])
238 priv->
len[pkt_type >> 1] = os->
psize;
240 if (!priv->
packet[pkt_type >> 1])
245 unsigned blocksize, bs0, bs1;
252 if (bytestream_get_le32(&p) != 0)
255 channels= bytestream_get_byte(&p);
261 srate = bytestream_get_le32(&p);
266 blocksize = bytestream_get_byte(&p);
267 bs0 = blocksize & 15;
268 bs1 = blocksize >> 4;
272 if (bs0 < 6 || bs1 > 13)
275 if (bytestream_get_byte(&p) != 1)
289 unsigned new_len = 7 + 4 +
AV_RL32(priv->
packet[1] + 7) + 4 + 1;
290 if (new_len >= 16 && new_len < os->psize) {
292 priv->
packet[1][new_len - 1] = 1;
293 priv->
len[1] = new_len;
335 last_pkt = next_pkt = next_pkt + os->
psize;
336 for (; seg < os->
nsegs; seg++) {
344 last_pkt = next_pkt + os->
segments[seg];
386 .
magic =
"\001vorbis",