36#define SEEKPOINT_SIZE 18
50 if (0x7FFFFFFFFFFFFFFF - metadata_head_size < sti->index_entries[
i].
pos)
58 0, 1764, 3528, 3840, 160, 320, 441, 480, 640, 882, 960, 1920, 0, 0, 0, 0
63 int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
78 if (marker !=
MKTAG(
'f',
'L',
'a',
'C')) {
79 const int sample_rate = 50 *
sr_table[(marker >> 16) & 0xF];
91 }
else if (
ret != 4) {
97 switch (metadata_type) {
125 if (found_streaminfo) {
131 found_streaminfo = 1;
142 if (samplerate > 0) {
151 int i, chapters, track, ti;
152 if (metadata_size < 431)
155 chapters = bytestream_get_byte(&
offset) - 1;
158 for (
i = 0;
i < chapters;
i++) {
161 start = bytestream_get_be64(&
offset);
162 track = bytestream_get_byte(&
offset);
166 ti = bytestream_get_byte(&
offset);
180 const uint8_t *seekpoint =
buffer;
184 for(
i=0;
i<seek_point_count;
i++) {
185 int64_t timestamp = bytestream_get_be64(&seekpoint);
186 int64_t pos = bytestream_get_be64(&seekpoint);
188 bytestream_get_be16(&seekpoint);
197 if (!found_streaminfo) {
207 }
else if (
ret > 0) {
212 chmask =
av_dict_get(
s->metadata,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
NULL, 0);
217 "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
243 if ((p->buf[2] & 0xF0) == 0)
245 if ((p->buf[2] & 0x0F) == 0x0F)
250 if ((p->buf[3] & 0x06) == 0x06)
252 if ((p->buf[3] & 0x01) == 0x01)
259 if ((
AV_RB16(p->buf) & 0xFFFE) == 0xFFF8)
263 if (p->buf_size >= 4 + 4 + 13) {
264 int type = p->buf[4] & 0x7f;
266 int min_block_size =
AV_RB16(p->buf + 8);
267 int max_block_size =
AV_RB16(p->buf + 10);
268 int sample_rate =
AV_RB24(p->buf + 18) >> 4;
270 if (memcmp(p->buf,
"fLaC", 4))
274 min_block_size >= 16 &&
275 max_block_size >= min_block_size &&
276 sample_rate && sample_rate <= 655350)
333 pkt->pts,
pkt->dts, *ppos);
388 .p.extensions =
"flac",
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Libavcodec external API header.
#define PARSER_FLAG_USE_CODEC_TS
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)
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, uint8_t *dst, unsigned int size)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
int avcodec_parameters_to_context(AVCodecContext *codec, const AVCodecParameters *par)
AVChapter * avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base, int64_t start, int64_t end, const char *title)
Add a new chapter.
#define FF_INFMT_FLAG_ID3V2_AUTO
Automatically parse ID3v2 metadata.
FLAC (Free Lossless Audio Codec) common stuff.
@ FLAC_METADATA_TYPE_SEEKTABLE
@ FLAC_METADATA_TYPE_CUESHEET
@ FLAC_METADATA_TYPE_PICTURE
@ FLAC_METADATA_TYPE_VORBIS_COMMENT
@ FLAC_METADATA_TYPE_STREAMINFO
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
#define FLAC_STREAMINFO_SIZE
int ff_flac_parse_picture(AVFormatContext *s, uint8_t **bufp, int buf_size, int truncate_workaround)
Parse a FLAC METADATA_BLOCK_PICTURE.
#define RETURN_ERROR(code)
AVCodecContext * avcodec_alloc_context3(const AVCodec *codec)
Allocate an AVCodecContext and set its fields to default values.
void avcodec_free_context(AVCodecContext **avctx)
Free the codec context and everything associated with it and write NULL to the provided pointer.
#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(enum AVCodecID 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 struct 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_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
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 AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const uint16_t mask[17]
#define MKTAG(a, b, c, d)
Memory handling functions.
int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m, const uint8_t *buf, int size, int parse_picture)
Parse Vorbis comments.
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]
main external API structure.
int extradata_size
Size of the extradata content in bytes.
AVChannelLayout ch_layout
The channel layout and number of channels.
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.
This structure contains the data a format has to probe a file.
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.
AVPacket * parse_pkt
The generic code uses this as a temporary packet to parse packets or for muxing, especially flushing.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
enum AVStreamParseType need_parsing
AVCodecContext * parser_dec
FFRawDemuxerContext rawctx