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++)
125 tt[j] = toupper(t[j]);
142 "truncated comment header, %i comments not found\n", n);
179 len = priv->
len[0] + priv->
len[1] + priv->
len[2];
186 for (i = 0; i < 3; i++) {
187 memcpy(&ptr[offset], priv->
packet[i], priv->
len[i]);
188 offset += priv->
len[i];
202 for (i = 0; i < 3; i++)
224 if (os->
psize < 1 || pkt_type > 5)
229 if (priv->
packet[pkt_type>>1])
231 if (pkt_type > 1 && !priv->
packet[0] || pkt_type > 3 && !priv->
packet[1])
234 priv->
len[pkt_type >> 1] = os->
psize;
239 unsigned blocksize, bs0, bs1;
245 if (bytestream_get_le32(&p) != 0)
249 srate = bytestream_get_le32(&p);
254 blocksize = bytestream_get_byte(&p);
255 bs0 = blocksize & 15;
256 bs1 = blocksize >> 4;
260 if (bs0 < 6 || bs1 > 13)
263 if (bytestream_get_byte(&p) != 1)
277 unsigned new_len = 7 + 4 +
AV_RL32(priv->
packet[1] + 7) + 4 + 1;
278 if (new_len >= 16 && new_len < os->psize) {
280 priv->
packet[1][new_len - 1] = 1;
281 priv->
len[1] = new_len;
313 int first_duration = 0;
317 for (seg = 0; seg < os->
nsegs; seg++) {
327 last_pkt = next_pkt + os->
segments[seg];
368 .
magic =
"\001vorbis",
void * av_malloc(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)
#define AV_PKT_FLAG_CORRUPT
Copyright (C) 2005 Michael Ahlberg, Måns Rullgård.
int avpriv_vorbis_parse_frame(VorbisParseContext *s, const uint8_t *buf, int buf_size)
Get the duration for a Vorbis packet.
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)
void avpriv_vorbis_parse_reset(VorbisParseContext *s)
unsigned char * packet[3]
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)
#define AV_DICT_DONT_STRDUP_VAL
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 associated with this stream.
int bit_rate
the average bitrate
#define AV_DICT_DONT_STRDUP_KEY
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.
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
rational number numerator/denominator
#define FF_INPUT_BUFFER_PADDING_SIZE
int64_t duration
Decoding: duration of the stream, in stream time base.
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
int64_t start_time
Decoding: pts of the first frame of the stream, in stream time base.
static int vorbis_packet(AVFormatContext *s, int idx)
int channels
number of audio channels
void * priv_data
Format private data.
const struct ogg_codec ff_vorbis_codec
int avpriv_vorbis_parse_extradata(AVCodecContext *avctx, VorbisParseContext *s)
Initialize the Vorbis parser using headers in the extradata.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...