31 #define SEEKPOINT_SIZE 18
50 int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
74 switch (metadata_type) {
101 if (found_streaminfo) {
107 found_streaminfo = 1;
118 if (samplerate > 0) {
127 int i, chapters, track, ti;
128 if (metadata_size < 431)
131 chapters = bytestream_get_byte(&
offset) - 1;
134 for (
i = 0;
i < chapters;
i++) {
137 start = bytestream_get_be64(&
offset);
138 track = bytestream_get_byte(&
offset);
142 ti = bytestream_get_byte(&
offset);
160 for(
i=0;
i<seek_point_count;
i++) {
161 int64_t timestamp = bytestream_get_be64(&seekpoint);
162 int64_t
pos = bytestream_get_be64(&seekpoint);
164 bytestream_get_be16(&seekpoint);
173 if (!found_streaminfo) {
183 }
else if (ret > 0) {
188 chmask =
av_dict_get(
s->metadata,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
NULL, 0);
193 "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
218 if ((p->
buf[2] & 0xF0) == 0)
220 if ((p->
buf[2] & 0x0F) == 0x0F)
225 if ((p->
buf[3] & 0x06) == 0x06)
227 if ((p->
buf[3] & 0x01) == 0x01)
245 if (memcmp(p->
buf,
"fLaC", 4))
249 min_block_size >= 16 &&
250 max_block_size >= min_block_size &&
260 int64_t *ppos, int64_t pos_limit)
321 if(index<0 || index >=
s->streams[0]->nb_index_entries)
324 e =
s->streams[0]->index_entries[
index];
342 .extensions =
"flac",
345 .priv_class = &flac_demuxer_class,
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define PARSER_FLAG_USE_CODEC_TS
#define RETURN_ERROR(code)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
unsigned int avio_rl32(AVIOContext *s)
static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, uint8_t *dst, unsigned int size)
#define flags(name, subs,...)
#define MKTAG(a, b, c, d)
FLAC (Free Lossless Audio Codec) decoder/demuxer common functions.
static av_always_inline void flac_parse_block_header(const uint8_t *block_header, int *last, int *type, int *size)
Parse the metadata block parameters from the header.
#define FLAC_MAX_CHANNELS
@ FLAC_METADATA_TYPE_SEEKTABLE
@ FLAC_METADATA_TYPE_CUESHEET
@ FLAC_METADATA_TYPE_PICTURE
@ FLAC_METADATA_TYPE_VORBIS_COMMENT
@ FLAC_METADATA_TYPE_STREAMINFO
#define FLAC_STREAMINFO_SIZE
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.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
AVCodecParserContext * av_parser_init(int codec_id)
void av_parser_close(AVCodecParserContext *s)
int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int64_t pts, int64_t dts, int64_t pos)
Parse a packet.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
#define AV_NOPTS_VALUE
Undefined timestamp value.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const uint16_t mask[17]
int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m, const uint8_t *buf, int size, int parse_picture)
#define FF_RAW_DEMUXER_CLASS(name)
int ff_replaygain_export(AVStream *st, AVDictionary *metadata)
Parse replaygain tags and export them as per-stream side data.
static const uint8_t header[24]
Describe the class of an AVClass context structure.
int extradata_size
Size of the extradata content in bytes.
uint64_t channel_layout
Audio only.
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).
int64_t next_frame_offset
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
This structure contains the data a format has to probe a file.
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int64_t duration
Decoding: duration of the stream, in stream time base.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
enum AVStreamParseType need_parsing
AVStreamInternal * internal
An opaque field for libavformat internal usage.
static const uint8_t offset[127][2]