Mercurial > mplayer.hg
annotate libmpdemux/aviheader.h @ 29838:ccb6a75dedf7
Fix length calculation for ASF, preroll is in ms, play time in 100 ns.
Based on patch by On2
author | reimar |
---|---|
date | Tue, 10 Nov 2009 16:19:44 +0000 |
parents | f01023c524c3 |
children | a90c7676bf0e |
rev | line source |
---|---|
29238
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
1 /* |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
2 * This file is part of MPlayer. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
3 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
7 * (at your option) any later version. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
8 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
12 * GNU General Public License for more details. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
13 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
17 */ |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27063
diff
changeset
|
18 |
26029 | 19 #ifndef MPLAYER_AVIHEADER_H |
20 #define MPLAYER_AVIHEADER_H | |
1343 | 21 |
27063
290ba4821dda
Add missing #includes that are required for things used in the header.
diego
parents:
26029
diff
changeset
|
22 #include <sys/types.h> |
290ba4821dda
Add missing #includes that are required for things used in the header.
diego
parents:
26029
diff
changeset
|
23 #include <stdint.h> |
29401
f01023c524c3
Replace WORDS_BIGENDIAN by HAVE_BIGENDIAN in all internal code.
diego
parents:
29263
diff
changeset
|
24 #include "config.h" /* get correct definition of HAVE_BIGENDIAN */ |
21372 | 25 #include "libavutil/common.h" |
21507
fa99b3d31d13
Hack around libavutil/bswap.h compilation problems due to always_inline undefined.
reimar
parents:
21372
diff
changeset
|
26 #include "mpbswap.h" |
1343 | 27 |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
28 #ifndef mmioFOURCC |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
29 #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
|
30 ( (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
|
31 ( (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
|
32 #endif |
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 /* 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
|
35 #ifndef aviTWOCC |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
36 #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
|
37 #endif |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
38 |
12356
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
12345
diff
changeset
|
39 //typedef uint16_t TWOCC; |
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
12345
diff
changeset
|
40 //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
|
41 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
42 /* 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
|
43 #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
|
44 #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
|
45 #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
|
46 #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
|
47 #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
|
48 #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
|
49 #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
|
50 #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
|
51 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
52 #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
|
53 #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
|
54 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
55 #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
|
56 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
57 /* |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
58 ** 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
|
59 */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
60 #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
|
61 #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
|
62 #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
|
63 #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
|
64 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
65 /* Basic chunk types */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
66 #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
|
67 #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
|
68 #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
|
69 #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
|
70 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
71 /* 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
|
72 #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
|
73 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
74 /* 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
|
75 #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
|
76 #define AVIF_MUSTUSEINDEX 0x00000020 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
77 #define AVIF_ISINTERLEAVED 0x00000100 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
78 #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
|
79 #define AVIF_WASCAPTUREFILE 0x00010000 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
80 #define AVIF_COPYRIGHTED 0x00020000 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
81 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
82 typedef struct |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
83 { |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 // size; normally 2K. |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
88 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
|
89 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
|
90 uint32_t dwInitialFrames; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
91 uint32_t dwStreams; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
92 uint32_t dwSuggestedBufferSize; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
93 |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
94 uint32_t dwWidth; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
95 uint32_t dwHeight; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
96 |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
97 uint32_t dwReserved[4]; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
98 } MainAVIHeader; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
99 |
12345 | 100 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
|
101 short left; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
102 short top; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
103 short right; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
104 short bottom; |
12345 | 105 } rectangle_t; |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
106 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
107 typedef struct { |
12356
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
12345
diff
changeset
|
108 uint32_t fccType; |
6a61d694f7d3
minimal fix for alex's 1000000000000l compile errors. imo the fix in
rfelker
parents:
12345
diff
changeset
|
109 uint32_t fccHandler; |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
110 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
|
111 uint16_t wPriority; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
112 uint16_t wLanguage; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
113 uint32_t dwInitialFrames; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
114 uint32_t dwScale; |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
115 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
|
116 uint32_t dwStart; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
117 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
|
118 uint32_t dwSuggestedBufferSize; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
119 uint32_t dwQuality; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
120 uint32_t dwSampleSize; |
12345 | 121 rectangle_t rcFrame; |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
122 } AVIStreamHeader; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
123 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
124 /* Flags for index */ |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
125 #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
|
126 #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
|
127 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
128 #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
|
129 #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
|
130 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
131 #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
|
132 #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
|
133 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
134 typedef struct |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
135 { |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
136 uint32_t ckid; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
137 uint32_t dwFlags; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
138 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
|
139 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
|
140 } AVIINDEXENTRY; |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
141 |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
12046
diff
changeset
|
142 |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
25545
diff
changeset
|
143 typedef struct avisuperindex_entry { |
12036 | 144 uint64_t qwOffset; // absolute file offset |
145 uint32_t dwSize; // size of index chunk at this offset | |
146 uint32_t dwDuration; // time span in stream ticks | |
147 } avisuperindex_entry; | |
148 | |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
25545
diff
changeset
|
149 typedef struct avistdindex_entry { |
12036 | 150 uint32_t dwOffset; // qwBaseOffset + this is absolute file offset |
151 uint32_t dwSize; // bit 31 is set if this is NOT a keyframe | |
152 } avistdindex_entry; | |
153 | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
154 // Standard index |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
25545
diff
changeset
|
155 typedef struct __attribute__((packed)) avistdindex_chunk { |
12036 | 156 char fcc[4]; // ix## |
157 uint32_t dwSize; // size of this chunk | |
158 uint16_t wLongsPerEntry; // must be sizeof(aIndex[0])/sizeof(DWORD) | |
159 uint8_t bIndexSubType; // must be 0 | |
160 uint8_t bIndexType; // must be AVI_INDEX_OF_CHUNKS | |
161 uint32_t nEntriesInUse; // first unused entry | |
162 char dwChunkId[4]; // '##dc' or '##db' or '##wb' etc.. | |
163 uint64_t qwBaseOffset; // all dwOffsets in aIndex array are relative to this | |
164 uint32_t dwReserved3; // must be 0 | |
165 avistdindex_entry *aIndex; // the actual frames | |
166 } avistdindex_chunk; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29238
diff
changeset
|
167 |
12036 | 168 |
169 // Base Index Form 'indx' | |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
25545
diff
changeset
|
170 typedef struct avisuperindex_chunk { |
12036 | 171 char fcc[4]; |
172 uint32_t dwSize; // size of this chunk | |
173 uint16_t wLongsPerEntry; // size of each entry in aIndex array (must be 4*4 for us) | |
174 uint8_t bIndexSubType; // future use. must be 0 | |
175 uint8_t bIndexType; // one of AVI_INDEX_* codes | |
176 uint32_t nEntriesInUse; // index of first unused member in aIndex array | |
177 char dwChunkId[4]; // fcc of what is indexed | |
178 uint32_t dwReserved[3]; // meaning differs for each index type/subtype. | |
179 // 0 if unused | |
180 avisuperindex_entry *aIndex; // position of ix## chunks | |
181 avistdindex_chunk *stdidx; // the actual std indices | |
182 } avisuperindex_chunk; | |
183 | |
184 typedef struct { | |
185 uint32_t CompressedBMHeight; | |
186 uint32_t CompressedBMWidth; | |
187 uint32_t ValidBMHeight; | |
188 uint32_t ValidBMWidth; | |
189 uint32_t ValidBMXOffset; | |
190 uint32_t ValidBMYOffset; | |
191 uint32_t VideoXOffsetInT; | |
192 uint32_t VideoYValidStartLine; | |
193 } VIDEO_FIELD_DESC; | |
194 | |
195 typedef struct { | |
196 uint32_t VideoFormatToken; | |
197 uint32_t VideoStandard; | |
198 uint32_t dwVerticalRefreshRate; | |
199 uint32_t dwHTotalInT; | |
200 uint32_t dwVTotalInLines; | |
201 uint32_t dwFrameAspectRatio; | |
202 uint32_t dwFrameWidthInPixels; | |
203 uint32_t dwFrameHeightInLines; | |
204 uint32_t nbFieldPerFrame; | |
205 VIDEO_FIELD_DESC FieldInfo[2]; | |
206 } VideoPropHeader; | |
207 | |
12357 | 208 typedef enum { |
12036 | 209 FORMAT_UNKNOWN, |
210 FORMAT_PAL_SQUARE, | |
211 FORMAT_PAL_CCIR_601, | |
212 FORMAT_NTSC_SQUARE, | |
213 FORMAT_NTSC_CCIR_601, | |
214 } VIDEO_FORMAT; | |
215 | |
12357 | 216 typedef enum { |
12036 | 217 STANDARD_UNKNOWN, |
218 STANDARD_PAL, | |
219 STANDARD_NTSC, | |
220 STANDARD_SECAM | |
221 } VIDEO_STANDARD; | |
222 | |
223 #define MAKE_AVI_ASPECT(a, b) (((a)<<16)|(b)) | |
224 #define GET_AVI_ASPECT(a) ((float)((a)>>16)/(float)((a)&0xffff)) | |
225 | |
1343 | 226 /* |
227 * Some macros to swap little endian structures read from an AVI file | |
228 * into machine endian format | |
229 */ | |
29401
f01023c524c3
Replace WORDS_BIGENDIAN by HAVE_BIGENDIAN in all internal code.
diego
parents:
29263
diff
changeset
|
230 #if HAVE_BIGENDIAN |
1343 | 231 #define le2me_MainAVIHeader(h) { \ |
232 (h)->dwMicroSecPerFrame = le2me_32((h)->dwMicroSecPerFrame); \ | |
233 (h)->dwMaxBytesPerSec = le2me_32((h)->dwMaxBytesPerSec); \ | |
234 (h)->dwPaddingGranularity = le2me_32((h)->dwPaddingGranularity); \ | |
235 (h)->dwFlags = le2me_32((h)->dwFlags); \ | |
236 (h)->dwTotalFrames = le2me_32((h)->dwTotalFrames); \ | |
237 (h)->dwInitialFrames = le2me_32((h)->dwInitialFrames); \ | |
238 (h)->dwStreams = le2me_32((h)->dwStreams); \ | |
239 (h)->dwSuggestedBufferSize = le2me_32((h)->dwSuggestedBufferSize); \ | |
240 (h)->dwWidth = le2me_32((h)->dwWidth); \ | |
241 (h)->dwHeight = le2me_32((h)->dwHeight); \ | |
242 } | |
243 | |
244 #define le2me_AVIStreamHeader(h) { \ | |
245 (h)->fccType = le2me_32((h)->fccType); \ | |
246 (h)->fccHandler = le2me_32((h)->fccHandler); \ | |
247 (h)->dwFlags = le2me_32((h)->dwFlags); \ | |
248 (h)->wPriority = le2me_16((h)->wPriority); \ | |
249 (h)->wLanguage = le2me_16((h)->wLanguage); \ | |
250 (h)->dwInitialFrames = le2me_32((h)->dwInitialFrames); \ | |
251 (h)->dwScale = le2me_32((h)->dwScale); \ | |
252 (h)->dwRate = le2me_32((h)->dwRate); \ | |
253 (h)->dwStart = le2me_32((h)->dwStart); \ | |
254 (h)->dwLength = le2me_32((h)->dwLength); \ | |
255 (h)->dwSuggestedBufferSize = le2me_32((h)->dwSuggestedBufferSize); \ | |
256 (h)->dwQuality = le2me_32((h)->dwQuality); \ | |
257 (h)->dwSampleSize = le2me_32((h)->dwSampleSize); \ | |
258 le2me_RECT(&(h)->rcFrame); \ | |
259 } | |
260 #define le2me_RECT(h) { \ | |
261 (h)->left = le2me_16((h)->left); \ | |
262 (h)->top = le2me_16((h)->top); \ | |
263 (h)->right = le2me_16((h)->right); \ | |
264 (h)->bottom = le2me_16((h)->bottom); \ | |
265 } | |
266 #define le2me_BITMAPINFOHEADER(h) { \ | |
267 (h)->biSize = le2me_32((h)->biSize); \ | |
268 (h)->biWidth = le2me_32((h)->biWidth); \ | |
269 (h)->biHeight = le2me_32((h)->biHeight); \ | |
270 (h)->biPlanes = le2me_16((h)->biPlanes); \ | |
271 (h)->biBitCount = le2me_16((h)->biBitCount); \ | |
272 (h)->biCompression = le2me_32((h)->biCompression); \ | |
273 (h)->biSizeImage = le2me_32((h)->biSizeImage); \ | |
274 (h)->biXPelsPerMeter = le2me_32((h)->biXPelsPerMeter); \ | |
275 (h)->biYPelsPerMeter = le2me_32((h)->biYPelsPerMeter); \ | |
276 (h)->biClrUsed = le2me_32((h)->biClrUsed); \ | |
277 (h)->biClrImportant = le2me_32((h)->biClrImportant); \ | |
278 } | |
279 #define le2me_WAVEFORMATEX(h) { \ | |
280 (h)->wFormatTag = le2me_16((h)->wFormatTag); \ | |
281 (h)->nChannels = le2me_16((h)->nChannels); \ | |
282 (h)->nSamplesPerSec = le2me_32((h)->nSamplesPerSec); \ | |
283 (h)->nAvgBytesPerSec = le2me_32((h)->nAvgBytesPerSec); \ | |
284 (h)->nBlockAlign = le2me_16((h)->nBlockAlign); \ | |
285 (h)->wBitsPerSample = le2me_16((h)->wBitsPerSample); \ | |
286 (h)->cbSize = le2me_16((h)->cbSize); \ | |
287 } | |
288 #define le2me_AVIINDEXENTRY(h) { \ | |
289 (h)->ckid = le2me_32((h)->ckid); \ | |
290 (h)->dwFlags = le2me_32((h)->dwFlags); \ | |
291 (h)->dwChunkOffset = le2me_32((h)->dwChunkOffset); \ | |
292 (h)->dwChunkLength = le2me_32((h)->dwChunkLength); \ | |
293 } | |
12036 | 294 #define le2me_AVISTDIDXCHUNK(h) {\ |
295 char c; \ | |
296 c = (h)->fcc[0]; (h)->fcc[0] = (h)->fcc[3]; (h)->fcc[3] = c; \ | |
297 c = (h)->fcc[1]; (h)->fcc[1] = (h)->fcc[2]; (h)->fcc[2] = c; \ | |
298 (h)->dwSize = le2me_32((h)->dwSize); \ | |
299 (h)->wLongsPerEntry = le2me_16((h)->wLongsPerEntry); \ | |
300 (h)->nEntriesInUse = le2me_32((h)->nEntriesInUse); \ | |
301 c = (h)->dwChunkId[0]; (h)->dwChunkId[0] = (h)->dwChunkId[3]; (h)->dwChunkId[3] = c; \ | |
302 c = (h)->dwChunkId[1]; (h)->dwChunkId[1] = (h)->dwChunkId[2]; (h)->dwChunkId[2] = c; \ | |
303 (h)->qwBaseOffset = le2me_64((h)->qwBaseOffset); \ | |
304 (h)->dwReserved3 = le2me_32((h)->dwReserved3); \ | |
305 } | |
306 #define le2me_AVISTDIDXENTRY(h) {\ | |
307 (h)->dwOffset = le2me_32((h)->dwOffset); \ | |
308 (h)->dwSize = le2me_32((h)->dwSize); \ | |
309 } | |
310 #define le2me_VideoPropHeader(h) { \ | |
12046 | 311 (h)->VideoFormatToken = le2me_32((h)->VideoFormatToken); \ |
312 (h)->VideoStandard = le2me_32((h)->VideoStandard); \ | |
313 (h)->dwVerticalRefreshRate = le2me_32((h)->dwVerticalRefreshRate); \ | |
314 (h)->dwHTotalInT = le2me_32((h)->dwHTotalInT); \ | |
315 (h)->dwVTotalInLines = le2me_32((h)->dwVTotalInLines); \ | |
316 (h)->dwFrameAspectRatio = le2me_32((h)->dwFrameAspectRatio); \ | |
317 (h)->dwFrameWidthInPixels = le2me_32((h)->dwFrameWidthInPixels); \ | |
318 (h)->dwFrameHeightInLines = le2me_32((h)->dwFrameHeightInLines); \ | |
319 (h)->nbFieldPerFrame = le2me_32((h)->nbFieldPerFrame); \ | |
12036 | 320 } |
321 #define le2me_VIDEO_FIELD_DESC(h) { \ | |
12046 | 322 (h)->CompressedBMHeight = le2me_32((h)->CompressedBMHeight); \ |
323 (h)->CompressedBMWidth = le2me_32((h)->CompressedBMWidth); \ | |
324 (h)->ValidBMHeight = le2me_32((h)->ValidBMHeight); \ | |
325 (h)->ValidBMWidth = le2me_32((h)->ValidBMWidth); \ | |
326 (h)->ValidBMXOffset = le2me_32((h)->ValidBMXOffset); \ | |
327 (h)->ValidBMYOffset = le2me_32((h)->ValidBMYOffset); \ | |
328 (h)->VideoXOffsetInT = le2me_32((h)->VideoXOffsetInT); \ | |
329 (h)->VideoYValidStartLine = le2me_32((h)->VideoYValidStartLine); \ | |
12036 | 330 } |
331 | |
1343 | 332 #else |
333 #define le2me_MainAVIHeader(h) /**/ | |
334 #define le2me_AVIStreamHeader(h) /**/ | |
335 #define le2me_RECT(h) /**/ | |
336 #define le2me_BITMAPINFOHEADER(h) /**/ | |
337 #define le2me_WAVEFORMATEX(h) /**/ | |
338 #define le2me_AVIINDEXENTRY(h) /**/ | |
12036 | 339 #define le2me_AVISTDIDXCHUNK(h) /**/ |
340 #define le2me_AVISTDIDXENTRY(h) /**/ | |
341 #define le2me_VideoPropHeader(h) /**/ | |
342 #define le2me_VIDEO_FIELD_DESC(h) /**/ | |
1343 | 343 #endif |
344 | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
345 typedef struct { |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
346 // index stuff: |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
347 void* idx; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
348 int idx_size; |
6056
f980563afdbc
big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents:
2330
diff
changeset
|
349 off_t idx_pos; |
f980563afdbc
big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents:
2330
diff
changeset
|
350 off_t idx_pos_a; |
f980563afdbc
big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents:
2330
diff
changeset
|
351 off_t idx_pos_v; |
f980563afdbc
big (>2GB) AVI files support - patch by Wolfram Gloger <wg@malloc.de>
arpi
parents:
2330
diff
changeset
|
352 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
|
353 // bps-based PTS stuff: |
2b39ff3860b7
cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents:
6056
diff
changeset
|
354 int video_pack_no; |
2b39ff3860b7
cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents:
6056
diff
changeset
|
355 int audio_block_size; |
2b39ff3860b7
cleanup of .AVI timestamp calculation (ugly hack from mplayer.c removed,
arpi
parents:
6056
diff
changeset
|
356 off_t audio_block_no; |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
357 // interleaved PTS stuff: |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
358 int skip_video_frames; |
2330 | 359 int audio_streams; |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
360 float avi_audio_pts; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
361 float avi_video_pts; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
362 float pts_correction; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
363 unsigned int pts_corr_bytes; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
364 unsigned char pts_corrected; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
365 unsigned char pts_has_video; |
8208
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8030
diff
changeset
|
366 unsigned int numberofframes; |
12036 | 367 avisuperindex_chunk *suidx; |
368 int suidx_size; | |
369 int isodml; | |
1485
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
370 } avi_priv_t; |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
371 |
b895f95e7657
AVI demuxer cleanups, fileformat-dependent stuff moved to priv_t
arpi
parents:
1343
diff
changeset
|
372 #define AVI_PRIV ((avi_priv_t*)(demuxer->priv)) |
12036 | 373 |
374 #define AVI_IDX_OFFSET(x) ((((uint64_t)(x)->dwFlags&0xffff0000)<<16)+(x)->dwChunkOffset) | |
375 | |
26029 | 376 #endif /* MPLAYER_AVIHEADER_H */ |