36#define SEEKPOINT_SIZE 18
54 0, 1764, 3528, 3840, 160, 320, 441, 480, 640, 882, 960, 1920, 0, 0, 0, 0
59 int ret, metadata_last=0, metadata_type, metadata_size, found_streaminfo=0;
74 if (marker !=
MKTAG(
'f',
'L',
'a',
'C')) {
75 const int sample_rate = 50 *
sr_table[(marker >> 16) & 0xF];
87 }
else if (ret != 4) {
93 switch (metadata_type) {
121 if (found_streaminfo) {
127 found_streaminfo = 1;
138 if (samplerate > 0) {
147 int i, chapters, track, ti;
148 if (metadata_size < 431)
151 chapters = bytestream_get_byte(&
offset) - 1;
154 for (
i = 0;
i < chapters;
i++) {
157 start = bytestream_get_be64(&
offset);
158 track = bytestream_get_byte(&
offset);
162 ti = bytestream_get_byte(&
offset);
176 const uint8_t *seekpoint =
buffer;
180 for(
i=0;
i<seek_point_count;
i++) {
181 int64_t timestamp = bytestream_get_be64(&seekpoint);
182 int64_t pos = bytestream_get_be64(&seekpoint);
184 bytestream_get_be16(&seekpoint);
193 if (!found_streaminfo) {
203 }
else if (ret > 0) {
208 chmask =
av_dict_get(
s->metadata,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
NULL, 0);
213 "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
238 if ((p->buf[2] & 0xF0) == 0)
240 if ((p->buf[2] & 0x0F) == 0x0F)
245 if ((p->buf[3] & 0x06) == 0x06)
247 if ((p->buf[3] & 0x01) == 0x01)
254 if ((
AV_RB16(p->buf) & 0xFFFE) == 0xFFF8)
258 if (p->buf_size >= 4 + 4 + 13) {
259 int type = p->buf[4] & 0x7f;
261 int min_block_size =
AV_RB16(p->buf + 8);
262 int max_block_size =
AV_RB16(p->buf + 10);
263 int sample_rate =
AV_RB24(p->buf + 18) >> 4;
265 if (memcmp(p->buf,
"fLaC", 4))
269 min_block_size >= 16 &&
270 max_block_size >= min_block_size &&
271 sample_rate && sample_rate <= 655350)
323 pkt->pts,
pkt->dts, *ppos);
378 .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