35 #define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
36 #define FOURXMV_TAG MKTAG('4', 'X', 'M', 'V')
37 #define LIST_TAG MKTAG('L', 'I', 'S', 'T')
38 #define HEAD_TAG MKTAG('H', 'E', 'A', 'D')
39 #define TRK__TAG MKTAG('T', 'R', 'K', '_')
40 #define MOVI_TAG MKTAG('M', 'O', 'V', 'I')
41 #define VTRK_TAG MKTAG('V', 'T', 'R', 'K')
42 #define STRK_TAG MKTAG('S', 'T', 'R', 'K')
43 #define std__TAG MKTAG('s', 't', 'd', '_')
44 #define name_TAG MKTAG('n', 'a', 'm', 'e')
45 #define vtrk_TAG MKTAG('v', 't', 'r', 'k')
46 #define strk_TAG MKTAG('s', 't', 'r', 'k')
47 #define ifrm_TAG MKTAG('i', 'f', 'r', 'm')
48 #define pfrm_TAG MKTAG('p', 'f', 'r', 'm')
49 #define cfrm_TAG MKTAG('c', 'f', 'r', 'm')
50 #define ifr2_TAG MKTAG('i', 'f', 'r', '2')
51 #define pfr2_TAG MKTAG('p', 'f', 'r', '2')
52 #define cfr2_TAG MKTAG('c', 'f', 'r', '2')
53 #define snd__TAG MKTAG('s', 'n', 'd', '_')
55 #define vtrk_SIZE 0x44
56 #define strk_SIZE 0x28
58 #define GET_LIST_HEADER() \
59 fourcc_tag = avio_rl32(pb); \
60 size = avio_rl32(pb); \
61 if (fourcc_tag != LIST_TAG) \
62 return AVERROR_INVALIDDATA; \
63 fourcc_tag = avio_rl32(pb);
98 if (size !=
vtrk_SIZE || left < size + 8) {
130 if (size !=
strk_SIZE || left < size + 8)
135 if ((
unsigned)track >= UINT_MAX /
sizeof(
AudioTrack) - 1) {
197 unsigned int fourcc_tag;
201 unsigned char *header;
213 header_size = size - 4;
214 if (fourcc_tag !=
HEAD_TAG || header_size < 0)
221 if (
avio_read(pb, header, header_size) != header_size) {
227 for (i = 0; i < header_size - 8; i++) {
228 fourcc_tag =
AV_RL32(&header[i]);
229 size =
AV_RL32(&header[i + 4]);
232 if (header_size - i < 16) {
237 }
else if (fourcc_tag ==
vtrk_TAG) {
238 if ((ret =
parse_vtrk(s, fourxm, header + i, size,
239 header_size - i)) < 0)
243 }
else if (fourcc_tag ==
strk_TAG) {
244 if ((ret =
parse_strk(s, fourxm, header + i, size,
245 header_size - i)) < 0)
275 unsigned int fourcc_tag;
278 unsigned int track_number;
280 unsigned char header[8];
281 int audio_frame_count;
283 while (!packet_read) {
286 fourcc_tag =
AV_RL32(&header[0]);
290 switch (fourcc_tag) {
312 memcpy(pkt->
data, header, 8);
326 if (track_number < fourxm->track_count &&
337 audio_frame_count =
size;
342 audio_frame_count *= 2;
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
void av_free_packet(AVPacket *pkt)
Free a packet.
int64_t pos
byte position in stream, -1 if unknown
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
int index
stream index in AVFormatContext
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
int id
Format-specific stream ID.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
AVCodecContext * codec
Codec context associated with this stream.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int bit_rate
the average bitrate
int width
picture width / height.
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static int read_header(FFV1Context *f)
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
This structure contains the data a format has to probe a file.
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
#define AVERROR_INVALIDDATA
#define AVPROBE_SCORE_MAX
int eof_reached
true if eof reached
int channels
number of audio channels
void * priv_data
Format private data.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...