36 #define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
37 #define FOURXMV_TAG MKTAG('4', 'X', 'M', 'V')
38 #define LIST_TAG MKTAG('L', 'I', 'S', 'T')
39 #define HEAD_TAG MKTAG('H', 'E', 'A', 'D')
40 #define TRK__TAG MKTAG('T', 'R', 'K', '_')
41 #define MOVI_TAG MKTAG('M', 'O', 'V', 'I')
42 #define VTRK_TAG MKTAG('V', 'T', 'R', 'K')
43 #define STRK_TAG MKTAG('S', 'T', 'R', 'K')
44 #define std__TAG MKTAG('s', 't', 'd', '_')
45 #define name_TAG MKTAG('n', 'a', 'm', 'e')
46 #define vtrk_TAG MKTAG('v', 't', 'r', 'k')
47 #define strk_TAG MKTAG('s', 't', 'r', 'k')
48 #define ifrm_TAG MKTAG('i', 'f', 'r', 'm')
49 #define pfrm_TAG MKTAG('p', 'f', 'r', 'm')
50 #define cfrm_TAG MKTAG('c', 'f', 'r', 'm')
51 #define ifr2_TAG MKTAG('i', 'f', 'r', '2')
52 #define pfr2_TAG MKTAG('p', 'f', 'r', '2')
53 #define cfr2_TAG MKTAG('c', 'f', 'r', '2')
54 #define snd__TAG MKTAG('s', 'n', 'd', '_')
56 #define vtrk_SIZE 0x44
57 #define strk_SIZE 0x28
59 #define GET_LIST_HEADER() \
60 fourcc_tag = avio_rl32(pb); \
61 size = avio_rl32(pb); \
62 if (fourcc_tag != LIST_TAG) \
63 return AVERROR_INVALIDDATA; \
64 fourcc_tag = avio_rl32(pb);
99 if (size !=
vtrk_SIZE || left < size + 8) {
134 if (size !=
strk_SIZE || left < size + 8)
138 if ((
unsigned)track >= UINT_MAX /
sizeof(
AudioTrack) - 1) {
209 unsigned int fourcc_tag;
225 header_size = size - 4;
226 if (fourcc_tag !=
HEAD_TAG || header_size < 0)
233 if (
avio_read(pb, header, header_size) != header_size) {
239 for (i = 0; i < header_size - 8; i++) {
240 fourcc_tag =
AV_RL32(&header[i]);
241 size =
AV_RL32(&header[i + 4]);
242 if (size > header_size - i - 8 && (fourcc_tag ==
vtrk_TAG || fourcc_tag ==
strk_TAG)) {
243 av_log(s,
AV_LOG_ERROR,
"chunk larger than array %d>%d\n", size, header_size - i - 8);
248 if (header_size - i < 16) {
254 }
else if (fourcc_tag ==
vtrk_TAG) {
255 if ((ret =
parse_vtrk(s, fourxm, header + i, size,
256 header_size - i)) < 0)
260 }
else if (fourcc_tag ==
strk_TAG) {
261 if ((ret =
parse_strk(s, fourxm, header + i, size,
262 header_size - i)) < 0)
292 unsigned int fourcc_tag;
295 unsigned int track_number;
300 while (!packet_read) {
303 fourcc_tag =
AV_RL32(&header[0]);
307 switch (fourcc_tag) {
329 memcpy(pkt->
data, header, 8);
345 if (track_number < fourxm->track_count &&
356 audio_frame_count =
size;
361 audio_frame_count *= 2;
#define FF_SANE_NB_CHANNELS
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int64_t pos
byte position in stream, -1 if unknown
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int index
stream index in AVFormatContext
static int audio_frame_count
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int id
Format-specific stream ID.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
static const uint8_t header[24]
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVMediaType codec_type
General type of the encoded data.
int extradata_size
Size of the extradata content in bytes.
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int block_align
Audio only.
static int read_header(FFV1Context *f)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Rational number (pair of numerator and denominator).
This structure contains the data a format has to probe a file.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
int sample_rate
Audio only.
common internal api header.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
void * priv_data
Format private data.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
AVCodecParameters * codecpar
int avio_feof(AVIOContext *s)
feof() equivalent for AVIOContext.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...