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)
134 if ((
unsigned)track >= UINT_MAX /
sizeof(
AudioTrack) - 1) {
196 unsigned int fourcc_tag;
200 unsigned char *header;
212 header_size = size - 4;
213 if (fourcc_tag !=
HEAD_TAG || header_size < 0)
220 if (
avio_read(pb, header, header_size) != header_size) {
226 for (i = 0; i < header_size - 8; i++) {
227 fourcc_tag =
AV_RL32(&header[i]);
228 size =
AV_RL32(&header[i + 4]);
229 if (size > header_size - i - 8 && (fourcc_tag ==
vtrk_TAG || fourcc_tag ==
strk_TAG)) {
230 av_log(s,
AV_LOG_ERROR,
"chunk larger than array %d>%d\n", size, header_size - i - 8);
235 if (header_size - i < 16) {
241 }
else if (fourcc_tag ==
vtrk_TAG) {
242 if ((ret =
parse_vtrk(s, fourxm, header + i, size,
243 header_size - i)) < 0)
247 }
else if (fourcc_tag ==
strk_TAG) {
248 if ((ret =
parse_strk(s, fourxm, header + i, size,
249 header_size - i)) < 0)
279 unsigned int fourcc_tag;
282 unsigned int track_number;
284 unsigned char header[8];
287 while (!packet_read) {
290 fourcc_tag =
AV_RL32(&header[0]);
294 switch (fourcc_tag) {
316 memcpy(pkt->
data, header, 8);
330 if (track_number < fourxm->track_count &&
341 audio_frame_count =
size;
346 audio_frame_count *= 2;