Mercurial > mplayer.hg
annotate libmpdemux/aviheader.h @ 21527:9b228834e07b
Half-properly set up OpenAL position stuff
author | reimar |
---|---|
date | Sat, 09 Dec 2006 11:45:41 +0000 |
parents | fa99b3d31d13 |
children | a90aa203186c |
rev | line source |
---|---|
1343 | 1 #ifndef _aviheader_h |
2 #define _aviheader_h | |
3 | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
4 //#include "config.h" /* get correct definition WORDS_BIGENDIAN */ |
21372 | 5 #include "libavutil/common.h" |
21507
fa99b3d31d13
Hack around libavutil/bswap.h compilation problems due to always_inline undefined.
reimar
parents:
21372
diff
changeset
|
6 #include "mpbswap.h" |
1343 | 7 |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
8 #ifndef MIN |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
9 #define MIN(a,b) (((a)<(b))?(a):(b)) |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
10 #endif |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
11 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
12 #ifndef min |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
13 #define min(a,b) (((a)<(b))?(a):(b)) |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
14 #endif |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
15 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
16 #ifndef max |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
17 #define max(a,b) (((a)>(b))?(a):(b)) |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
18 #endif |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
19 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
20 #ifndef mmioFOURCC |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
21 #define mmioFOURCC( ch0, ch1, ch2, ch3 ) \ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
22 ( (uint32_t)(uint8_t)(ch0) | ( (uint32_t)(uint8_t)(ch1) << 8 ) | \ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
23 ( (uint32_t)(uint8_t)(ch2) << 16 ) | ( (uint32_t)(uint8_t)(ch3) << 24 ) ) |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
24 #endif |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
25 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
26 /* Macro to make a TWOCC out of two characters */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
27 #ifndef aviTWOCC |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
28 #define aviTWOCC(ch0, ch1) ((uint16_t)(uint8_t)(ch0) | ((uint16_t)(uint8_t)(ch1) << 8)) |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
29 #endif |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
30 |
12356
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
12345
diff
changeset
|
31 //typedef uint16_t TWOCC; |
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
12345
diff
changeset
|
32 //typedef uint32_t FOURCC; |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
33 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
34 /* form types, list types, and chunk types */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
35 #define formtypeAVI mmioFOURCC('A', 'V', 'I', ' ') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
36 #define listtypeAVIHEADER mmioFOURCC('h', 'd', 'r', 'l') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
37 #define ckidAVIMAINHDR mmioFOURCC('a', 'v', 'i', 'h') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
38 #define listtypeSTREAMHEADER mmioFOURCC('s', 't', 'r', 'l') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
39 #define ckidSTREAMHEADER mmioFOURCC('s', 't', 'r', 'h') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
40 #define ckidSTREAMFORMAT mmioFOURCC('s', 't', 'r', 'f') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
41 #define ckidSTREAMHANDLERDATA mmioFOURCC('s', 't', 'r', 'd') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
42 #define ckidSTREAMNAME mmioFOURCC('s', 't', 'r', 'n') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
43 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
44 #define listtypeAVIMOVIE mmioFOURCC('m', 'o', 'v', 'i') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
45 #define listtypeAVIRECORD mmioFOURCC('r', 'e', 'c', ' ') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
46 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
47 #define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
48 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
49 /* |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
50 ** Stream types for the <fccType> field of the stream header. |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
51 */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
52 #define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
53 #define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
54 #define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
55 #define streamtypeTEXT mmioFOURCC('t', 'x', 't', 's') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
56 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
57 /* Basic chunk types */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
58 #define cktypeDIBbits aviTWOCC('d', 'b') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
59 #define cktypeDIBcompressed aviTWOCC('d', 'c') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
60 #define cktypePALchange aviTWOCC('p', 'c') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
61 #define cktypeWAVEbytes aviTWOCC('w', 'b') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
62 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
63 /* Chunk id to use for extra chunks for padding. */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
64 #define ckidAVIPADDING mmioFOURCC('J', 'U', 'N', 'K') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
65 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
66 /* flags for use in <dwFlags> in AVIFileHdr */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
67 #define AVIF_HASINDEX 0x00000010 // Index at end of file? |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
68 #define AVIF_MUSTUSEINDEX 0x00000020 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
69 #define AVIF_ISINTERLEAVED 0x00000100 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
70 #define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames? |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
71 #define AVIF_WASCAPTUREFILE 0x00010000 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
72 #define AVIF_COPYRIGHTED 0x00020000 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
73 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
74 typedef struct |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
75 { |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
76 uint32_t dwMicroSecPerFrame; // frame display rate (or 0L) |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
77 uint32_t dwMaxBytesPerSec; // max. transfer rate |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
78 uint32_t dwPaddingGranularity; // pad to multiples of this |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
79 // size; normally 2K. |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
80 uint32_t dwFlags; // the ever-present flags |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
81 uint32_t dwTotalFrames; // # frames in file |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
82 uint32_t dwInitialFrames; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
83 uint32_t dwStreams; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
84 uint32_t dwSuggestedBufferSize; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
85 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
86 uint32_t dwWidth; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
87 uint32_t dwHeight; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
88 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
89 uint32_t dwReserved[4]; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
90 } MainAVIHeader; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
91 |
12345 | 92 typedef struct rectangle_t { |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
93 short left; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
94 short top; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
95 short right; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
96 short bottom; |
12345 | 97 } rectangle_t; |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
98 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
99 typedef struct { |
12356
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
12345
diff
changeset
|
100 uint32_t fccType; |
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
12345
diff
changeset
|
101 uint32_t fccHandler; |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
102 uint32_t dwFlags; /* Contains AVITF_* flags */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
103 uint16_t wPriority; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
104 uint16_t wLanguage; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
105 uint32_t dwInitialFrames; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
106 uint32_t dwScale; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
107 uint32_t dwRate; /* dwRate / dwScale == samples/second */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
108 uint32_t dwStart; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
109 uint32_t dwLength; /* In units above... */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
110 uint32_t dwSuggestedBufferSize; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
111 uint32_t dwQuality; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
112 uint32_t dwSampleSize; |
12345 | 113 rectangle_t rcFrame; |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
114 } AVIStreamHeader; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
115 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
116 /* Flags for index */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
117 #define AVIIF_LIST 0x00000001L // chunk is a 'LIST' |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
118 #define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame. |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
119 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
120 #define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
121 #define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
122 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
123 #define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
124 #define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T') |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
125 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
126 typedef struct |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
127 { |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
128 uint32_t ckid; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
129 uint32_t dwFlags; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
130 uint32_t dwChunkOffset; // Position of chunk |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
131 uint32_t dwChunkLength; // Length of chunk |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
132 } AVIINDEXENTRY; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
133 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
134 |
12036 | 135 typedef struct _avisuperindex_entry { |
136 uint64_t qwOffset; // absolute file offset | |
137 uint32_t dwSize; // size of index chunk at this offset | |
138 uint32_t dwDuration; // time span in stream ticks | |
139 } avisuperindex_entry; | |
140 | |
141 typedef struct _avistdindex_entry { | |
142 uint32_t dwOffset; // qwBaseOffset + this is absolute file offset | |
143 uint32_t dwSize; // bit 31 is set if this is NOT a keyframe | |
144 } avistdindex_entry; | |
145 | |
146 // Standard index | |
15905 | 147 typedef struct __attribute__((packed)) _avistdindex_chunk { |
12036 | 148 char fcc[4]; // ix## |
149 uint32_t dwSize; // size of this chunk | |
150 uint16_t wLongsPerEntry; // must be sizeof(aIndex[0])/sizeof(DWORD) | |
151 uint8_t bIndexSubType; // must be 0 | |
152 uint8_t bIndexType; // must be AVI_INDEX_OF_CHUNKS | |
153 uint32_t nEntriesInUse; // first unused entry | |
154 char dwChunkId[4]; // '##dc' or '##db' or '##wb' etc.. | |
155 uint64_t qwBaseOffset; // all dwOffsets in aIndex array are relative to this | |
156 uint32_t dwReserved3; // must be 0 | |
157 avistdindex_entry *aIndex; // the actual frames | |
158 } avistdindex_chunk; | |
159 | |
160 | |
161 // Base Index Form 'indx' | |
162 typedef struct _avisuperindex_chunk { | |
163 char fcc[4]; | |
164 uint32_t dwSize; // size of this chunk | |
165 uint16_t wLongsPerEntry; // size of each entry in aIndex array (must be 4*4 for us) | |
166 uint8_t bIndexSubType; // future use. must be 0 | |
167 uint8_t bIndexType; // one of AVI_INDEX_* codes | |
168 uint32_t nEntriesInUse; // index of first unused member in aIndex array | |
169 char dwChunkId[4]; // fcc of what is indexed | |
170 uint32_t dwReserved[3]; // meaning differs for each index type/subtype. | |
171 // 0 if unused | |
172 avisuperindex_entry *aIndex; // position of ix## chunks | |
173 avistdindex_chunk *stdidx; // the actual std indices | |
174 } avisuperindex_chunk; | |
175 | |
176 typedef struct { | |
177 uint32_t CompressedBMHeight; | |
178 uint32_t CompressedBMWidth; | |
179 uint32_t ValidBMHeight; | |
180 uint32_t ValidBMWidth; | |
181 uint32_t ValidBMXOffset; | |
182 uint32_t ValidBMYOffset; | |
183 uint32_t VideoXOffsetInT; | |
184 uint32_t VideoYValidStartLine; | |
185 } VIDEO_FIELD_DESC; | |
186 | |
187 typedef struct { | |
188 uint32_t VideoFormatToken; | |
189 uint32_t VideoStandard; | |
190 uint32_t dwVerticalRefreshRate; | |
191 uint32_t dwHTotalInT; | |
192 uint32_t dwVTotalInLines; | |
193 uint32_t dwFrameAspectRatio; | |
194 uint32_t dwFrameWidthInPixels; | |
195 uint32_t dwFrameHeightInLines; | |
196 uint32_t nbFieldPerFrame; | |
197 VIDEO_FIELD_DESC FieldInfo[2]; | |
198 } VideoPropHeader; | |
199 | |
12357 | 200 typedef enum { |
12036 | 201 FORMAT_UNKNOWN, |
202 FORMAT_PAL_SQUARE, | |
203 FORMAT_PAL_CCIR_601, | |
204 FORMAT_NTSC_SQUARE, | |
205 FORMAT_NTSC_CCIR_601, | |
206 } VIDEO_FORMAT; | |
207 | |
12357 | 208 typedef enum { |
12036 | 209 STANDARD_UNKNOWN, |
210 STANDARD_PAL, | |
211 STANDARD_NTSC, | |
212 STANDARD_SECAM | |
213 } VIDEO_STANDARD; | |
214 | |
215 #define MAKE_AVI_ASPECT(a, b) (((a)<<16)|(b)) | |
216 #define GET_AVI_ASPECT(a) ((float)((a)>>16)/(float)((a)&0xffff)) | |
217 | |
1343 | 218 /* |
219 * Some macros to swap little endian structures read from an AVI file | |
220 * into machine endian format | |
221 */ | |
222 #ifdef WORDS_BIGENDIAN | |
223 #define le2me_MainAVIHeader(h) { \ | |
224 (h)->dwMicroSecPerFrame = le2me_32((h)->dwMicroSecPerFrame); \ | |
225 (h)->dwMaxBytesPerSec = le2me_32((h)->dwMaxBytesPerSec); \ | |
226 (h)->dwPaddingGranularity = le2me_32((h)->dwPaddingGranularity); \ | |
227 (h)->dwFlags = le2me_32((h)->dwFlags); \ | |
228 (h)->dwTotalFrames = le2me_32((h)->dwTotalFrames); \ | |
229 (h)->dwInitialFrames = le2me_32((h)->dwInitialFrames); \ | |
230 (h)->dwStreams = le2me_32((h)->dwStreams); \ | |
231 (h)->dwSuggestedBufferSize = le2me_32((h)->dwSuggestedBufferSize); \ | |
232 (h)->dwWidth = le2me_32((h)->dwWidth); \ | |
233 (h)->dwHeight = le2me_32((h)->dwHeight); \ | |
234 } | |
235 | |
236 #define le2me_AVIStreamHeader(h) { \ | |
237 (h)->fccType = le2me_32((h)->fccType); \ | |
238 (h)->fccHandler = le2me_32((h)->fccHandler); \ | |
239 (h)->dwFlags = le2me_32((h)->dwFlags); \ | |
240 (h)->wPriority = le2me_16((h)->wPriority); \ | |
241 (h)->wLanguage = le2me_16((h)->wLanguage); \ | |
242 (h)->dwInitialFrames = le2me_32((h)->dwInitialFrames); \ | |
243 (h)->dwScale = le2me_32((h)->dwScale); \ | |
244 (h)->dwRate = le2me_32((h)->dwRate); \ | |
245 (h)->dwStart = le2me_32((h)->dwStart); \ | |
246 (h)->dwLength = le2me_32((h)->dwLength); \ | |
247 (h)->dwSuggestedBufferSize = le2me_32((h)->dwSuggestedBufferSize); \ | |
248 (h)->dwQuality = le2me_32((h)->dwQuality); \ | |
249 (h)->dwSampleSize = le2me_32((h)->dwSampleSize); \ | |
250 le2me_RECT(&(h)->rcFrame); \ | |
251 } | |
252 #define le2me_RECT(h) { \ | |
253 (h)->left = le2me_16((h)->left); \ | |
254 (h)->top = le2me_16((h)->top); \ | |
255 (h)->right = le2me_16((h)->right); \ | |
256 (h)->bottom = le2me_16((h)->bottom); \ | |
257 } | |
258 #define le2me_BITMAPINFOHEADER(h) { \ | |
259 (h)->biSize = le2me_32((h)->biSize); \ | |
260 (h)->biWidth = le2me_32((h)->biWidth); \ | |
261 (h)->biHeight = le2me_32((h)->biHeight); \ | |
262 (h)->biPlanes = le2me_16((h)->biPlanes); \ | |
263 (h)->biBitCount = le2me_16((h)->biBitCount); \ | |
264 (h)->biCompression = le2me_32((h)->biCompression); \ | |
265 (h)->biSizeImage = le2me_32((h)->biSizeImage); \ | |
266 (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter); \ | |
267 (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter); \ | |
268 (h)->biClrUsed = le2me_32((h)->biClrUsed); \ | |
269 (h)->biClrImportant = le2me_32((h)->biClrImportant); \ | |
270 } | |
271 #define le2me_WAVEFORMATEX(h) { \ | |
272 (h)->wFormatTag = le2me_16((h)->wFormatTag); \ | |
273 (h)->nChannels = le2me_16((h)->nChannels); \ | |
274 (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec); \ | |
275 (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec); \ | |
276 (h)->nBlockAlign = le2me_16((h)->nBlockAlign); \ | |
277 (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample); \ | |
278 (h)->cbSize = le2me_16((h)->cbSize); \ | |
279 } | |
280 #define le2me_AVIINDEXENTRY(h) { \ | |
281 (h)->ckid = le2me_32((h)->ckid); \ | |
282 (h)->dwFlags = le2me_32((h)->dwFlags); \ | |
283 (h)->dwChunkOffset = le2me_32((h)->dwChunkOffset); \ | |
284 (h)->dwChunkLength = le2me_32((h)->dwChunkLength); \ | |
285 } | |
12036 | 286 #define le2me_AVISTDIDXCHUNK(h) {\ |
287 char c; \ | |
288 c = (h)->fcc[0]; (h)->fcc[0] = (h)->fcc[3]; (h)->fcc[3] = c; \ | |
289 c = (h)->fcc[1]; (h)->fcc[1] = (h)->fcc[2]; (h)->fcc[2] = c; \ | |
290 (h)->dwSize = le2me_32((h)->dwSize); \ | |
291 (h)->wLongsPerEntry = le2me_16((h)->wLongsPerEntry); \ | |
292 (h)->nEntriesInUse = le2me_32((h)->nEntriesInUse); \ | |
293 c = (h)->dwChunkId[0]; (h)->dwChunkId[0] = (h)->dwChunkId[3]; (h)->dwChunkId[3] = c; \ | |
294 c = (h)->dwChunkId[1]; (h)->dwChunkId[1] = (h)->dwChunkId[2]; (h)->dwChunkId[2] = c; \ | |
295 (h)->qwBaseOffset = le2me_64((h)->qwBaseOffset); \ | |
296 (h)->dwReserved3 = le2me_32((h)->dwReserved3); \ | |
297 } | |
298 #define le2me_AVISTDIDXENTRY(h) {\ | |
299 (h)->dwOffset = le2me_32((h)->dwOffset); \ | |
300 (h)->dwSize = le2me_32((h)->dwSize); \ | |
301 } | |
302 #define le2me_VideoPropHeader(h) { \ | |
12046 | 303 (h)->VideoFormatToken = le2me_32((h)->VideoFormatToken); \ |
304 (h)->VideoStandard = le2me_32((h)->VideoStandard); \ | |
305 (h)->dwVerticalRefreshRate = le2me_32((h)->dwVerticalRefreshRate); \ | |
306 (h)->dwHTotalInT = le2me_32((h)->dwHTotalInT); \ | |
307 (h)->dwVTotalInLines = le2me_32((h)->dwVTotalInLines); \ | |
308 (h)->dwFrameAspectRatio = le2me_32((h)->dwFrameAspectRatio); \ | |
309 (h)->dwFrameWidthInPixels = le2me_32((h)->dwFrameWidthInPixels); \ | |
310 (h)->dwFrameHeightInLines = le2me_32((h)->dwFrameHeightInLines); \ | |
311 (h)->nbFieldPerFrame = le2me_32((h)->nbFieldPerFrame); \ | |
12036 | 312 } |
313 #define le2me_VIDEO_FIELD_DESC(h) { \ | |
12046 | 314 (h)->CompressedBMHeight = le2me_32((h)->CompressedBMHeight); \ |
315 (h)->CompressedBMWidth = le2me_32((h)->CompressedBMWidth); \ | |
316 (h)->ValidBMHeight = le2me_32((h)->ValidBMHeight); \ | |
317 (h)->ValidBMWidth = le2me_32((h)->ValidBMWidth); \ | |
318 (h)->ValidBMXOffset = le2me_32((h)->ValidBMXOffset); \ | |
319 (h)->ValidBMYOffset = le2me_32((h)->ValidBMYOffset); \ | |
320 (h)->VideoXOffsetInT = le2me_32((h)->VideoXOffsetInT); \ | |
321 (h)->VideoYValidStartLine = le2me_32((h)->VideoYValidStartLine); \ | |
12036 | 322 } |
323 | |
1343 | 324 #else |
325 #define le2me_MainAVIHeader(h) /**/ | |
326 #define le2me_AVIStreamHeader(h) /**/ | |
327 #define le2me_RECT(h) /**/ | |
328 #define le2me_BITMAPINFOHEADER(h) /**/ | |
329 #define le2me_WAVEFORMATEX(h) /**/ | |
330 #define le2me_AVIINDEXENTRY(h) /**/ | |
12036 | 331 #define le2me_AVISTDIDXCHUNK(h) /**/ |
332 #define le2me_AVISTDIDXENTRY(h) /**/ | |
333 #define le2me_VideoPropHeader(h) /**/ | |
334 #define le2me_VIDEO_FIELD_DESC(h) /**/ | |
1343 | 335 #endif |
336 | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
337 typedef struct { |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
338 // index stuff: |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
339 void* idx; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
340 int idx_size; |
6056
f980563afdbc
big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents:
2330
diff
changeset
|
341 off_t idx_pos; |
f980563afdbc
big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents:
2330
diff
changeset
|
342 off_t idx_pos_a; |
f980563afdbc
big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents:
2330
diff
changeset
|
343 off_t idx_pos_v; |
f980563afdbc
big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents:
2330
diff
changeset
|
344 off_t idx_offset; // ennyit kell hozzaadni az index offset ertekekhez |
8030
2b39ff3860b7
cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents:
6056
diff
changeset
|
345 // bps-based PTS stuff: |
2b39ff3860b7
cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents:
6056
diff
changeset
|
346 int video_pack_no; |
2b39ff3860b7
cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents:
6056
diff
changeset
|
347 int audio_block_size; |
2b39ff3860b7
cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents:
6056
diff
changeset
|
348 off_t audio_block_no; |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
349 // interleaved PTS stuff: |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
350 int skip_video_frames; |
2330 | 351 int audio_streams; |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
352 float avi_audio_pts; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
353 float avi_video_pts; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
354 float pts_correction; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
355 unsigned int pts_corr_bytes; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
356 unsigned char pts_corrected; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
357 unsigned char pts_has_video; |
8208
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8030
diff
changeset
|
358 unsigned int numberofframes; |
12036 | 359 avisuperindex_chunk *suidx; |
360 int suidx_size; | |
361 int isodml; | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
362 } avi_priv_t; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
363 |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
364 #define AVI_PRIV ((avi_priv_t*)(demuxer->priv)) |
12036 | 365 |
366 #define AVI_IDX_OFFSET(x) ((((uint64_t)(x)->dwFlags&0xffff0000)<<16)+(x)->dwChunkOffset) | |
367 | |
368 #endif /* _aviheader_h */ |