aviriff.h 7.76 KB
Newer Older
1 2
/*
 * Copyright (C) 2003 Robert Shearman
3
 * Copyright (C) 2008 Maarten Lankhorst
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 19
 */

20 21 22
/* All definitions here are packed structures of on-disk formats */
#include <pshpack2.h>

23 24 25 26 27 28 29 30 31 32 33 34 35
typedef struct _riffchunk
{
    FOURCC fcc;
    DWORD cb;
} RIFFCHUNK, * LPRIFFCHUNK;

typedef struct _rifflist
{
    FOURCC fcc;
    DWORD cb;
    FOURCC fccListType;
} RIFFLIST, * LPRIFFLIST;

36 37 38 39
#define FCC( ch0, ch1, ch2, ch3 ) \
    ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) <<  8 ) | \
    ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) )

40 41 42 43 44 45 46 47 48 49 50
#define RIFFROUND(cb) ((cb) + ((cb)&1))
#define RIFFNEXT(pChunk) (LPRIFFCHUNK)((LPBYTE)(pChunk)+sizeof(RIFFCHUNK)+RIFFROUND(((LPRIFFCHUNK)pChunk)->cb))

/* flags for dwFlags member of AVIMAINHEADER */
#define AVIF_HASINDEX       0x00000010
#define AVIF_MUSTUSEINDEX   0x00000020
#define AVIF_ISINTERLEAVED  0x00000100
#define AVIF_TRUSTCKTYPE    0x00000800
#define AVIF_WASCAPTUREFILE 0x00010000
#define AVIF_COPYRIGHTED    0x00020000

51
#define ckidMAINAVIHEADER FCC('a','v','i','h')
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
typedef struct _avimainheader
{
    FOURCC fcc;
    DWORD cb;
    DWORD dwMicroSecPerFrame;
    DWORD dwMaxBytesPerSec;
    DWORD dwPaddingGranularity;
    DWORD dwFlags;
    DWORD dwTotalFrames;
    DWORD dwInitialFrames;
    DWORD dwStreams;
    DWORD dwSuggestedBufferSize;
    DWORD dwWidth;
    DWORD dwHeight;
    DWORD dwReserved[4];
} AVIMAINHEADER;

69 70
#define ckidODML FCC('o','d','m','l')
#define ckidAVIEXTHEADER  FCC('d','m','l','h')
71 72 73 74 75 76 77 78
typedef struct _aviextheader
{
    FOURCC fcc;
    DWORD cb;
    DWORD dwGrandFrames;
    DWORD dwFuture[61];
} AVIEXTHEADER;

79
#define ckidSTREAMLIST FCC('s','t','r','l')
80 81 82 83 84

/* flags for dwFlags member of AVISTREAMHEADER */
#define AVISF_DISABLED         0x00000001
#define AVISF_VIDEO_PALCHANGES 0x00010000

85 86 87 88 89 90 91 92 93 94 95
#ifndef ckidSTREAMHEADER
#define ckidSTREAMHEADER FCC('s','t','r','h')
#endif

#ifndef streamtypeVIDEO
#define streamtypeVIDEO FCC('v','i','d','s')
#define streamtypeAUDIO FCC('a','u','d','s')
#define streamtypeMIDI FCC('m','i','d','s')
#define streamtypeTEXT FCC('t','x','t','s')
#endif

96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
typedef struct _avistreamheader
{
    FOURCC fcc;
    DWORD cb;
    FOURCC fccType;
    FOURCC fccHandler;
    DWORD dwFlags;
    WORD wPriority;
    WORD wLanguage;
    DWORD dwInitialFrames;
    DWORD dwScale;
    DWORD dwRate;
    DWORD dwStart;
    DWORD dwLength;
    DWORD dwSuggestedBufferSize;
    DWORD dwQuality;
    DWORD dwSampleSize;
    struct
    {
        short int left;
        short int top;
        short int right;
        short int bottom;
    } rcFrame;
} AVISTREAMHEADER;

122 123 124 125 126
#ifndef ckidSTREAMFORMAT
#define ckidSTREAMFORMAT FCC('s','t','r','f')
#endif
#define ckidAVIOLDINDEX FCC('i','d','x','1')

127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
/* flags for dwFlags member of _avioldindex_entry */
#define AVIIF_LIST       0x00000001
#define AVIIF_KEYFRAME   0x00000010
#define AVIIF_NO_TIME    0x00000100
#define AVIIF_COMPRESSOR 0x0FFF0000

typedef struct _avioldindex
{
    FOURCC fcc;
    DWORD cb;
    struct _avioldindex_entry
    {
        DWORD dwChunkId;
        DWORD dwFlags;
        DWORD dwOffset;
        DWORD dwSize;
143
    } aIndex[ANYSIZE_ARRAY];
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
} AVIOLDINDEX;

typedef union _timecode
{
    struct
    {
        WORD wFrameRate;
        WORD wFrameFract;
        LONG cFrames;
    } DUMMYSTRUCTNAME;
    DWORDLONG qw;
} TIMECODE;

#define TIMECODE_RATE_30DROP 0

/* flags for dwSMPTEflags member of TIMECODEDATA */
#define TIMECODE_SMPTE_BINARY_GROUP 0x07
#define TIMECODE_SMPTE_COLOR_FRAME  0x08

typedef struct _timecodedata
{
    TIMECODE time;
    DWORD dwSMPTEflags;
    DWORD dwUser;
} TIMECODEDATA;

#define AVI_INDEX_OF_INDEXES      0x00
#define AVI_INDEX_OF_CHUNKS       0x01
#define AVI_INDEX_OF_TIMED_CHUNKS 0x02
#define AVI_INDEX_OF_SUB_2FIELD   0x03
#define AVI_INDEX_IS_DATA         0x80

#define AVI_INDEX_SUB_DEFAULT     0x00
#define AVI_INDEX_SUB_2FIELD      0x01

typedef struct _avimetaindex
{
    FOURCC fcc;
    UINT cb;
    WORD wLongsPerEntry;
    BYTE bIndexSubType;
    BYTE bIndexType;
    DWORD nEntriesInUse;
    DWORD dwChunkId;
    DWORD dwReserved[3];
189
    DWORD adwIndex[ANYSIZE_ARRAY];
190 191
} AVIMETAINDEX;

192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
#define ckidAVISUPERINDEX FCC('i','n','d','x')
typedef struct _avisuperindex {
    FOURCC fcc;
    UINT cb;
    WORD wLongsPerEntry;
    BYTE bIndexSubType;
    BYTE bIndexType;
    DWORD nEntriesInUse;
    DWORD dwChunkId;
    DWORD dwReserved[3];
    struct _avisuperindex_entry {
        DWORDLONG qwOffset;
        DWORD dwSize;
        DWORD dwDuration;
    } aIndex[ANYSIZE_ARRAY];
} AVISUPERINDEX;

#define AVISTDINDEX_DELTAFRAME (0x80000000)
#define AVISTDINDEX_SIZEMASK (~0x80000000)

typedef struct _avistdindex_entry {
    DWORD dwOffset;
    DWORD dwSize;
} AVISTDINDEX_ENTRY;

typedef struct _avistdindex {
    FOURCC fcc;
    UINT cb;
    WORD wLongsPerEntry;
    BYTE bIndexSubType;
    BYTE bIndexType;
    DWORD    nEntriesInUse;
    DWORD    dwChunkId;
    DWORDLONG qwBaseOffset;
    DWORD    dwReserved_3;
    AVISTDINDEX_ENTRY aIndex[ANYSIZE_ARRAY];
} AVISTDINDEX;

typedef struct _avitimedindex_entry {
    DWORD dwOffset;
    DWORD dwSize;
    DWORD dwDuration;
} AVITIMEDINDEX_ENTRY;

typedef struct _avitimedindex {
    FOURCC fcc;
    UINT cb;
    WORD wLongsPerEntry;
    BYTE bIndexSubType;
    BYTE bIndexType;
    DWORD nEntriesInUse;
    DWORD dwChunkId;
    DWORDLONG qwBaseOffset;
    DWORD dwReserved_3;
    AVITIMEDINDEX_ENTRY aIndex[ANYSIZE_ARRAY];
    /* DWORD adwTrailingFill[ANYSIZE_ARRAY]; */
} AVITIMEDINDEX;

typedef struct _avitimecodeindex {
    FOURCC fcc;
    UINT cb;
    WORD wLongsPerEntry;
    BYTE bIndexSubType;
    BYTE bIndexType;
    DWORD nEntriesInUse;
    DWORD dwChunkId;
    DWORD dwReserved[3];
    TIMECODEDATA aIndex[ANYSIZE_ARRAY];
} AVITIMECODEINDEX;

typedef struct _avitcdlindex_entryA {
    DWORD dwTick;
    TIMECODE time;
    DWORD dwSMPTEflags;
    DWORD dwUser;
    CHAR szReelId[12];
} AVITCDLINDEX_ENTRYA;

typedef struct _avitcdlindex_entryW {
    DWORD dwTick;
    TIMECODE time;
    DWORD dwSMPTEflags;
    DWORD dwUser;
    WCHAR szReelId[12];
} AVITCDLINDEX_ENTRYW;

typedef struct _avitcdlindexA {
    FOURCC fcc;
    UINT cb;
    WORD wLongsPerEntry;
    BYTE bIndexSubType;
    BYTE bIndexType;
    DWORD nEntriesInUse;
    DWORD dwChunkId;
    DWORD dwReserved[3];
    AVITCDLINDEX_ENTRYA aIndex[ANYSIZE_ARRAY];
    /* DWORD adwTrailingFill[ANYSIZE_ARRAY]; */
} AVITCDLINDEXA;

typedef struct _avitcdlindexW {
    FOURCC fcc;
    UINT cb;
    WORD wLongsPerEntry;
    BYTE bIndexSubType;
    BYTE bIndexType;
    DWORD nEntriesInUse;
    DWORD dwChunkId;
    DWORD dwReserved[3];
    AVITCDLINDEX_ENTRYW aIndex[ANYSIZE_ARRAY];
    /* DWORD adwTrailingFill[ANYSIZE_ARRAY]; */
} AVITCDLINDEXW;

#define AVITCDLINDEX_ENTRY WINELIB_NAME_AW(AVITCDLINDEX_ENTRY)
#define AVITCDLINDEX WINELIB_NAME_AW(AVITCDLINDEX)

typedef struct _avifieldindex_chunk {
    FOURCC fcc;
    DWORD cb;
    WORD wLongsPerEntry;
    BYTE bIndexSubType;
    BYTE bIndexType;
    DWORD nEntriesInUse;
    DWORD dwChunkId;
    DWORDLONG qwBaseOffset;
    DWORD dwReserved3;
    struct _avifieldindex_entry {
        DWORD dwOffset;
        DWORD dwSize;
        DWORD dwOffsetField2;
    } aIndex[ANYSIZE_ARRAY];
} AVIFIELDINDEX, * PAVIFIELDINDEX;
323 324

#include <poppack.h>