33 int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
55 switch (metadata_type) {
65 if (
avio_read(s->
pb, buffer, metadata_size) != metadata_size) {
79 if (found_streaminfo) {
94 if (si.samplerate > 0) {
103 int i, chapters, track, ti;
104 if (metadata_size < 431)
106 offset = buffer + 395;
107 chapters = bytestream_get_byte(&offset) - 1;
110 for (i = 0; i < chapters; i++) {
111 if (offset + 36 - buffer > metadata_size)
113 start = bytestream_get_be64(&offset);
114 track = bytestream_get_byte(&offset);
118 ti = bytestream_get_byte(&offset);
133 if (!found_streaminfo) {
167 .extensions =
"flac",
void avpriv_flac_parse_block_header(const uint8_t *block_header, int *last, int *type, int *size)
Parse the metadata block parameters from the header.
#define AV_LOG_WARNING
Something somehow does not look correct.
AVCodecContext * codec
Codec context associated with this stream.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static const uint8_t offset[511][2]
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
enum AVStreamParseType need_parsing
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m, const uint8_t *buf, int size)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
FLAC (Free Lossless Audio Codec) decoder/demuxer common functions.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void avpriv_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer)
Parse the Streaminfo metadata block.
int buf_size
Size of buf except extra allocated bytes.
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
#define FLAC_STREAMINFO_SIZE
int ff_flac_parse_picture(AVFormatContext *s, uint8_t *buf, int buf_size)
static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, uint8_t *dst, unsigned int size)
enum AVMediaType codec_type
AVIOContext * pb
I/O context.
#define MKTAG(a, b, c, d)
#define RETURN_ERROR(code)
This structure contains the data a format has to probe a file.
int64_t duration
Decoding: duration of the stream, in stream time base.
#define AVERROR_INVALIDDATA
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
#define AV_NOPTS_VALUE
Undefined timestamp value.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...