83 total_len = (uint64_t)priv->
len[0] + priv->
len[1] + priv->
len[2];
84 if (total_len + total_len / 255 + 64 > INT_MAX)
88 buf_len =
len +
len / 255 + 64;
96 memset(*buf,
'\0', buf_len);
102 for (
i = 0;
i < 3;
i++) {
114 struct ogg *
ogg =
s->priv_data;
120 for (
i = 0;
i < 3;
i++)
126 const uint8_t *buf,
int size)
128 struct ogg *
ogg =
s->priv_data;
152 const uint8_t *p,
unsigned int psize)
154 unsigned blocksize, bs0, bs1;
163 if (bytestream_get_le32(&p) != 0)
173 srate = bytestream_get_le32(&p);
178 blocksize = bytestream_get_byte(&p);
179 bs0 = blocksize & 15;
180 bs1 = blocksize >> 4;
184 if (bs0 < 6 || bs1 > 13)
187 if (bytestream_get_byte(&p) != 1)
209 struct ogg *
ogg =
s->priv_data;
222 struct ogg *
ogg =
s->priv_data;
248 if (priv->
packet[pkt_type >> 1])
250 if (pkt_type > 1 && !priv->
packet[0] || pkt_type > 3 && !priv->
packet[1])
253 priv->
len[pkt_type >> 1] = os->
psize;
255 if (!priv->
packet[pkt_type >> 1])
270 if (new_len >= 16 && new_len < os->psize) {
272 priv->
packet[1][new_len - 1] = 1;
273 priv->
len[1] = new_len;
322 error =
"data packet before the setup header";
326 error =
"identification header before the setup header";
330 error =
"comment header without identification header";
334 error =
"setup header without comment header";
340 "Invalid chained stream headers: %s, discarding them\n",
error);
343 for (
int i = 0;
i < 3;
i++)
352 struct ogg *
ogg =
s->priv_data;
356 int bos, skip_packet = 0;
396 s->streams[idx]->start_time = os->
lastpts;
398 s->streams[idx]->duration -=
s->streams[idx]->start_time;
408 uint8_t *next_pkt = last_pkt;
410 for (seg = os->
segp; seg < os->nsegs; seg++) {
412 if (os->
segments[seg] < 255 && next_pkt != last_pkt) {
538 .magic =
"\001vorbis",
static void BS_FUNC skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
uint8_t * av_packet_pack_dictionary(const AVDictionary *dict, size_t *size)
Pack a dictionary for use in side_data.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
#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_ERROR
Something went wrong and cannot losslessly be recovered.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
#define AV_NOPTS_VALUE
Undefined timestamp value.
const struct ogg_codec ff_vorbis_codec
Memory handling functions.
int ff_replaygain_export(AVStream *st, AVDictionary *metadata)
Parse replaygain tags and export them as per-stream side data.
int nb_channels
Number of channels in this layout.
int extradata_size
Size of the extradata content in bytes.
AVChannelLayout ch_layout
The channel layout and number of channels.
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
The number of audio samples per second.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int index
stream index in AVFormatContext
Copyright (C) 2005 Michael Ahlberg, Måns Rullgård.
size_t new_extradata_size
int end_trimming
set the number of packets to drop from the end
int page_start
current packet is the first one starting in the page
int64_t page_pos
file offset of the current page
struct ogg_stream * streams
unsigned char * packet[3]
AVVorbisParseContext * vp
enum VorbisPacketType last_packet
type of the last packet seen by vorbis_packet()
int64_t last_page_granule
static void error(const char *err)
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_SETUP
#define VORBIS_FLAG_COMMENT
#define VORBIS_FLAG_HEADER