44 int i, cnum,
h, m,
s, ms, keylen = strlen(
key);
51 if (sscanf(
val,
"%02d:%02d:%02d.%03d", &
h, &m, &
s, &ms) < 4)
55 ms + 1000 * (
s + 60 * (m + 60 *
h)),
101 s = bytestream_get_le32(&p);
103 if (end - p - 4 <
s ||
s < 0)
108 n = bytestream_get_le32(&p);
110 while (end - p >= 4 && n > 0) {
114 s = bytestream_get_le32(&p);
116 if (end - p <
s ||
s < 0)
123 v = memchr(t,
'=',
s);
154 if (!
av_strcasecmp(tt,
"METADATA_BLOCK_PICTURE") && parse_picture) {
191 "truncated comment header, %i comments not found\n", n);
228 uint64_t total_len = (uint64_t)priv->
len[0] + priv->
len[1] + priv->
len[2];
229 if (total_len + total_len / 255 + 64 > INT_MAX)
233 buf_len =
len +
len / 255 + 64;
241 memset(*buf,
'\0', buf_len);
247 for (
i = 0;
i < 3;
i++) {
259 struct ogg *
ogg =
s->priv_data;
265 for (
i = 0;
i < 3;
i++)
272 struct ogg *
ogg =
s->priv_data;
302 struct ogg *
ogg =
s->priv_data;
327 if (priv->
packet[pkt_type >> 1])
329 if (pkt_type > 1 && !priv->
packet[0] || pkt_type > 3 && !priv->
packet[1])
332 priv->
len[pkt_type >> 1] = os->
psize;
334 if (!priv->
packet[pkt_type >> 1])
339 unsigned blocksize, bs0, bs1;
346 if (bytestream_get_le32(&p) != 0)
355 srate = bytestream_get_le32(&p);
360 blocksize = bytestream_get_byte(&p);
361 bs0 = blocksize & 15;
362 bs1 = blocksize >> 4;
366 if (bs0 < 6 || bs1 > 13)
369 if (bytestream_get_byte(&p) != 1)
389 if (new_len >= 16 && new_len < os->psize) {
391 priv->
packet[1][new_len - 1] = 1;
392 priv->
len[1] = new_len;
421 struct ogg *
ogg =
s->priv_data;
450 last_pkt = next_pkt = next_pkt + os->
psize;
451 for (; seg < os->
nsegs; seg++) {
462 last_pkt = next_pkt + os->
segments[seg];
475 s->streams[idx]->duration -=
s->streams[idx]->start_time;
516 .
magic =
"\001vorbis",
static double val(void *priv, double ch)
uint8_t * av_packet_pack_dictionary(AVDictionary *dict, int *size)
#define flags(name, subs,...)
int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size, int truncate_workaround)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
#define AV_BASE64_DECODE_SIZE(x)
Calculate the output size in bytes needed to decode a base64 string with length x to a data buffer.
int av_base64_decode(uint8_t *out, const char *in_str, int out_size)
Decode a base64-encoded string.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#define AV_DICT_APPEND
If the entry already exists, append to it.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() or another memory allocation function.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
int av_strncasecmp(const char *a, const char *b, size_t n)
Locale-independent case-insensitive compare.
#define AV_NOPTS_VALUE
Undefined timestamp value.
common internal API header
#define PTRDIFF_SPECIFIER
static int ogm_chapter(AVFormatContext *as, uint8_t *key, uint8_t *val)
int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st, const uint8_t *buf, int size)
static int fixup_vorbis_headers(AVFormatContext *as, struct oggvorbis_private *priv, uint8_t **buf)
static void vorbis_cleanup(AVFormatContext *s, int idx)
static int vorbis_update_metadata(AVFormatContext *s, int idx)
int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m, const uint8_t *buf, int size, int parse_picture)
const struct ogg_codec ff_vorbis_codec
static int vorbis_packet(AVFormatContext *s, int idx)
static int vorbis_header(AVFormatContext *s, int idx)
int ff_replaygain_export(AVStream *st, AVDictionary *metadata)
Parse replaygain tags and export them as per-stream side data.
int id
unique ID to identify the chapter
int extradata_size
Size of the extradata content in bytes.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
Audio only.
unsigned int nb_chapters
Number of chapters in AVChapter array.
Rational number (pair of numerator and denominator).
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int event_flags
Flags indicating events happening on the stream, a combination of AVSTREAM_EVENT_FLAG_*.
Copyright (C) 2005 Michael Ahlberg, Måns Rullgård.
int end_trimming
set the number of packets to drop from the end
buffer_size_t new_metadata_size
struct ogg_stream * streams
unsigned char * packet[3]
AVVorbisParseContext * vp
static const uint8_t offset[127][2]
void av_vorbis_parse_free(AVVorbisParseContext **s)
Free the parser and everything associated with it.
int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, int buf_size, int *flags)
Get the duration for a Vorbis packet.
AVVorbisParseContext * av_vorbis_parse_init(const uint8_t *extradata, int extradata_size)
Allocate and initialize the Vorbis parser using headers in the extradata.
void av_vorbis_parse_reset(AVVorbisParseContext *s)
A public API for Vorbis parsing.
#define VORBIS_FLAG_COMMENT