57 if (memcmp(&buf[1],
"vorbis", 6)) {
62 if (!(buf[29] & 0x1)) {
79 int got_framing_bit, mode_count, got_mode_header, last_mode_count = 0;
94 if (memcmp(&buf[1],
"vorbis", 6)) {
104 for (i = 0; i < buf_size; i++)
105 rev_buf[i] = buf[buf_size - 1 - i];
115 if (!got_framing_bit) {
137 if (
get_bits(&gb0, 6) + 1 == mode_count) {
139 last_mode_count = mode_count;
142 if (!got_mode_header) {
151 if (last_mode_count > 2) {
153 "%d modes (either a false positive or a "
154 "sample from an unknown encoder)",
159 if (last_mode_count > 63) {
174 for (i = mode_count - 1; i >= 0; i--) {
185 const uint8_t *extradata,
int extradata_size)
187 const uint8_t *header_start[3];
196 header_start, header_len)) < 0) {
214 int buf_size,
int *
flags)
219 int mode, current_blocksize;
230 else if (buf[0] == 3)
232 else if (buf[0] == 5)
257 duration = (previous_blocksize + current_blocksize) >> 2;
299 #if LIBAVCODEC_VERSION_MAJOR < 57
314 int buf_size,
int *
flags)
320 #if CONFIG_VORBIS_PARSER
322 typedef struct VorbisParseContext {
324 } VorbisParseContext;
327 const uint8_t **poutbuf,
int *poutbuf_size,
346 *poutbuf_size = buf_size;
358 .priv_data_size =
sizeof(VorbisParseContext),
359 .parser_parse = vorbis_parse,
360 .parser_close = vorbis_parser_close,