32 #include "libavutil/intreadwrite.h"
33 #include "libavutil/intfloat.h"
34 #include "libavutil/dict.h"
115 if (skip < 0 || !st->codec->extradata ||
122 #define ALAC_PREAMBLE 12
123 #define ALAC_HEADER 36
124 #define ALAC_NEW_KUKI 24
140 if (!memcmp(&preamble[4],
"frmaalac", 8)) {
171 int64_t pos = 0, ccount, num_packets;
177 if (num_packets < 0 || INT32_MAX /
sizeof(
AVIndexEntry) < num_packets)
185 for (i = 0; i < num_packets; i++) {
207 for (i = 0; i < nb_entries; i++) {
260 caf->
data_size = size < 0 ? -1 : size - 4;
288 #define _(x) ((x) >= ' ' ? (x) : ' ')
290 tag,
_(tag>>24),
_((tag>>16)&0xFF),
_((tag>>8)&0xFF),
_(tag&0xFF), size);
299 if (pos > INT64_MAX - size)
316 "block size or frame size are variable.\n");
330 #define CAF_MAX_PKT_SIZE 4096
337 int res, pkt_size = 0, pkt_frames = 0;
355 if (pkt_size > 0 && pkt_frames == 1) {
357 pkt_size =
FFMIN(pkt_size, left);
371 if (pkt_size == 0 || pkt_frames == 0 || pkt_size > left)
389 int64_t timestamp,
int flags)
393 int64_t pos, packet_cnt, frame_cnt;
395 timestamp =
FFMAX(timestamp, 0);
static int read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t data_size
raw data size, in bytes
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.
#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...
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static int read_header(AVFormatContext *s)
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
int64_t data_start
data start position, in bytes
static int read_kuki_chunk(AVFormatContext *s, int64_t size)
Read magic cookie chunk.
int64_t num_bytes
total number of bytes in stream
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
int ff_mp4_read_descr_len(AVIOContext *pb)
void * priv_data
Format private data.
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int bit_rate
the average bitrate
AVInputFormat ff_caf_demuxer
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int64_t size)
Read 'chan' tag from the input stream.
int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom)
enum AVMediaType codec_type
int sample_rate
samples per second
int bytes_per_packet
bytes in a packet, or 0 if variable
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
AVIOContext * pb
I/O context.
int64_t packet_cnt
packet counter
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 MKTAG(a, b, c, d)
static void read_info_chunk(AVFormatContext *s, int64_t size)
Read information chunk.
This structure contains the data a format has to probe a file.
#define MKBETAG(a, b, c, d)
static int read_pakt_chunk(AVFormatContext *s, int64_t size)
Read packet table chunk.
static int probe(AVProbeData *p)
int64_t duration
Decoding: duration of the stream, in stream time base.
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
int64_t nb_frames
number of frames in this stream if known or 0
#define AVERROR_INVALIDDATA
int channels
number of audio channels
enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
Compute codec id for 'lpcm' tag.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
int64_t frame_cnt
frame counter
static int read_desc_chunk(AVFormatContext *s)
Read audio description chunk.
const AVCodecTag ff_codec_caf_tags[]
Known codec tags for CAF.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int frames_per_packet
frames in a packet, or 0 if variable