39#define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
40#define FOURXMV_TAG MKTAG('4', 'X', 'M', 'V')
41#define LIST_TAG MKTAG('L', 'I', 'S', 'T')
42#define HEAD_TAG MKTAG('H', 'E', 'A', 'D')
43#define TRK__TAG MKTAG('T', 'R', 'K', '_')
44#define MOVI_TAG MKTAG('M', 'O', 'V', 'I')
45#define VTRK_TAG MKTAG('V', 'T', 'R', 'K')
46#define STRK_TAG MKTAG('S', 'T', 'R', 'K')
47#define std__TAG MKTAG('s', 't', 'd', '_')
48#define name_TAG MKTAG('n', 'a', 'm', 'e')
49#define vtrk_TAG MKTAG('v', 't', 'r', 'k')
50#define strk_TAG MKTAG('s', 't', 'r', 'k')
51#define ifrm_TAG MKTAG('i', 'f', 'r', 'm')
52#define pfrm_TAG MKTAG('p', 'f', 'r', 'm')
53#define cfrm_TAG MKTAG('c', 'f', 'r', 'm')
54#define ifr2_TAG MKTAG('i', 'f', 'r', '2')
55#define pfr2_TAG MKTAG('p', 'f', 'r', '2')
56#define cfr2_TAG MKTAG('c', 'f', 'r', '2')
57#define snd__TAG MKTAG('s', 'n', 'd', '_')
62#define GET_LIST_HEADER() \
63 fourcc_tag = avio_rl32(pb); \
64 size = avio_rl32(pb); \
65 if (fourcc_tag != LIST_TAG) { \
66 ret = AVERROR_INVALIDDATA; \
69 fourcc_tag = avio_rl32(pb);
143 if ((
unsigned)track >= UINT_MAX /
sizeof(
AudioTrack) - 1 ||
144 track >=
s->max_streams) {
218 unsigned int fourcc_tag;
235 header_size =
size - 4;
236 if (fourcc_tag !=
HEAD_TAG || header_size < 0)
250 for (
i = 0;
i < header_size - 8;
i++) {
260 if (header_size -
i < 16) {
266 }
else if (fourcc_tag ==
vtrk_TAG) {
268 header_size -
i)) < 0)
272 }
else if (fourcc_tag ==
strk_TAG) {
274 header_size -
i)) < 0)
303 unsigned int fourcc_tag;
306 unsigned int track_number;
311 while (!packet_read) {
318 switch (fourcc_tag) {
360 if (track_number < fourxm->track_count &&
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 int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
#define i(width, name, range_min, range_max)
static int read_probe(const AVProbeData *p)
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
static int audio_frame_count
static int read_header(FFV1Context *f, RangeCoder *c)
#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.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
common internal api header.
#define FF_SANE_NB_CHANNELS
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
Memory handling functions.
static const uint8_t header[24]
int nb_channels
Number of channels in this layout.
int extradata_size
Size of the extradata content in bytes.
int height
The height of the video frame in pixels.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
int block_align
The number of bytes per coded audio frame, required by some formats.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
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).
int sample_rate
The number of audio samples per second.
This structure stores compressed data.
This structure contains the data a format has to probe a file.
Rational number (pair of numerator and denominator).
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int id
Format-specific stream ID.
int index
stream index in AVFormatContext