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",
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int vorbis_header(AVFormatContext *s, int idx)
Copyright (C) 2005 Michael Ahlberg, Måns Rullgård.
int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m, const uint8_t *buf, int size)
Parse the vorbis header Vorbis Identification header from Vorbis_I_spec.html::vorbis-spec-codec [vorb...
static unsigned int fixup_vorbis_headers(AVFormatContext *as, struct oggvorbis_private *priv, uint8_t **buf)
#define AV_LOG_WARNING
Something somehow does not look correct.
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
unsigned char * packet[3]
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() and children.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
int id
unique ID to identify the chapter
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
bitstream reader API header.
static void vorbis_cleanup(AVFormatContext *s, int idx)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void av_log(void *avcl, int level, const char *fmt,...)
AVCodecContext * codec
codec context
int bit_rate
the average bitrate
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() and chilren.
struct ogg_stream * streams
static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val)
Copyright (C) 2005 Michael Ahlberg, Måns Rullgård.
enum AVMediaType codec_type
int sample_rate
samples per second
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
rational number numerator/denominator
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int channels
number of audio channels
void * priv_data
Format private data.
const struct ogg_codec ff_vorbis_codec
#define AV_NOPTS_VALUE
Undefined timestamp value.