libgig  4.1.0.svn8
RIFF.h
1 /***************************************************************************
2  * *
3  * libgig - C++ cross-platform Gigasampler format file access library *
4  * *
5  * Copyright (C) 2003-2017 by Christian Schoenebeck *
6  * <cuse@users.sourceforge.net> *
7  * *
8  * This library is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This library is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this library; if not, write to the Free Software *
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21  * MA 02111-1307 USA *
22  ***************************************************************************/
23 
24 #ifndef __RIFF_H__
25 #define __RIFF_H__
26 
27 #ifdef WIN32
28 # define POSIX 0
29 #endif
30 
31 #ifndef POSIX
32 # define POSIX 1
33 #endif
34 
35 #ifndef DEBUG
36 # define DEBUG 0
37 #endif
38 
39 #include <string>
40 #include <list>
41 #include <map>
42 #include <set>
43 #include <iostream>
44 #include <stdarg.h>
45 
46 #ifdef HAVE_CONFIG_H
47 # include <config.h>
48 #endif
49 
50 #if POSIX
51 # include <sys/types.h>
52 # include <sys/stat.h>
53 # include <fcntl.h>
54 # include <unistd.h>
55 #endif // POSIX
56 
57 #ifdef _MSC_VER
58 // Visual C++ 2008 doesn't have stdint.h
59 typedef __int8 int8_t;
60 typedef __int16 int16_t;
61 typedef __int32 int32_t;
62 typedef __int64 int64_t;
63 typedef unsigned __int8 uint8_t;
64 typedef unsigned __int16 uint16_t;
65 typedef unsigned __int32 uint32_t;
66 typedef unsigned __int64 uint64_t;
67 #else
68 #include <stdint.h>
69 #endif
70 
71 #ifdef WIN32
72 # if (_WIN32 && !_WIN64) || (__GNUC__ && !(__x86_64__ || __ppc64__)) /* if 32 bit windows compilation */
73 # define _WIN32_WINNT 0x0501 /* Win XP (no service pack): required for 32 bit compilation for GetFileSizeEx() to be declared by windows.h */
74 # endif
75 # include <windows.h>
76  typedef unsigned int uint;
77 #endif // WIN32
78 
79 #include <stdio.h>
80 
81 #if WORDS_BIGENDIAN
82 # define CHUNK_ID_RIFF 0x52494646
83 # define CHUNK_ID_RIFX 0x52494658
84 # define CHUNK_ID_LIST 0x4C495354
85 
86 # define LIST_TYPE_INFO 0x494E464F
87 # define CHUNK_ID_ICMT 0x49434D54
88 # define CHUNK_ID_ICOP 0x49434F50
89 # define CHUNK_ID_ICRD 0x49435244
90 # define CHUNK_ID_IENG 0x49454E47
91 # define CHUNK_ID_INAM 0x494E414D
92 # define CHUNK_ID_IPRD 0x49505244
93 # define CHUNK_ID_ISFT 0x49534654
94 
95 # define CHUNK_ID_SMPL 0x736D706C
96 
97 #else // little endian
98 # define CHUNK_ID_RIFF 0x46464952
99 # define CHUNK_ID_RIFX 0x58464952
100 # define CHUNK_ID_LIST 0x5453494C
101 
102 # define LIST_TYPE_INFO 0x4F464E49
103 # define CHUNK_ID_ICMT 0x544D4349
104 # define CHUNK_ID_ICOP 0x504F4349
105 # define CHUNK_ID_ICRD 0x44524349
106 # define CHUNK_ID_IENG 0x474E4549
107 # define CHUNK_ID_INAM 0x4D414E49
108 # define CHUNK_ID_IPRD 0x44525049
109 # define CHUNK_ID_ISFT 0x54465349
110 
111 # define CHUNK_ID_SMPL 0x6C706D73
112 
113 #endif // WORDS_BIGENDIAN
114 
115 #define CHUNK_HEADER_SIZE(fileOffsetSize) (4 + fileOffsetSize)
116 #define LIST_HEADER_SIZE(fileOffsetSize) (8 + fileOffsetSize)
117 #define RIFF_HEADER_SIZE(fileOffsetSize) (8 + fileOffsetSize)
118 
138 namespace RIFF {
139 
140  /* just symbol prototyping */
141  class Chunk;
142  class List;
143  class File;
144 
145  typedef std::string String;
146 
148  typedef uint64_t file_offset_t;
149 
152  stream_mode_read = 0,
153  stream_mode_read_write = 1,
154  stream_mode_closed = 2
155  };
156 
159  stream_ready = 0,
160  stream_end_reached = 1,
161  stream_closed = 2
162  };
163 
166  stream_start = 0,
167  stream_curpos = 1,
168  stream_backward = 2,
169  stream_end = 3
170  };
171 
173  enum endian_t {
174  endian_little = 0,
175  endian_big = 1,
176  endian_native = 2
177  };
178 
180  enum layout_t {
183  };
184 
190  };
191 
204  struct progress_t {
205  void (*callback)(progress_t*);
206  float factor;
207  void* custom;
208  float __range_min;
209  float __range_max;
210  progress_t();
211  };
212 
218  class Chunk {
219  public:
220  Chunk(File* pFile, file_offset_t StartPos, List* Parent);
221  String GetChunkIDString() const;
222  uint32_t GetChunkID() const { return ChunkID; }
223  File* GetFile() const { return pFile; }
224  List* GetParent() const { return pParent; }
225  file_offset_t GetSize() const { return ullCurrentChunkSize; }
226  file_offset_t GetNewSize() const { return ullNewChunkSize; }
227  file_offset_t GetPos() const { return ullPos; }
228  file_offset_t GetFilePos() const { return ullStartPos + ullPos; }
229  file_offset_t SetPos(file_offset_t Where, stream_whence_t Whence = stream_start);
231  stream_state_t GetState() const;
232  file_offset_t Read(void* pData, file_offset_t WordCount, file_offset_t WordSize);
233  file_offset_t ReadInt8(int8_t* pData, file_offset_t WordCount = 1);
234  file_offset_t ReadUint8(uint8_t* pData, file_offset_t WordCount = 1);
235  file_offset_t ReadInt16(int16_t* pData, file_offset_t WordCount = 1);
236  file_offset_t ReadUint16(uint16_t* pData, file_offset_t WordCount = 1);
237  file_offset_t ReadInt32(int32_t* pData, file_offset_t WordCount = 1);
238  file_offset_t ReadUint32(uint32_t* pData, file_offset_t WordCount = 1);
239  int8_t ReadInt8();
240  uint8_t ReadUint8();
241  int16_t ReadInt16();
242  uint16_t ReadUint16();
243  int32_t ReadInt32();
244  uint32_t ReadUint32();
245  void ReadString(String& s, int size);
246  file_offset_t Write(void* pData, file_offset_t WordCount, file_offset_t WordSize);
247  file_offset_t WriteInt8(int8_t* pData, file_offset_t WordCount = 1);
248  file_offset_t WriteUint8(uint8_t* pData, file_offset_t WordCount = 1);
249  file_offset_t WriteInt16(int16_t* pData, file_offset_t WordCount = 1);
250  file_offset_t WriteUint16(uint16_t* pData, file_offset_t WordCount = 1);
251  file_offset_t WriteInt32(int32_t* pData, file_offset_t WordCount = 1);
252  file_offset_t WriteUint32(uint32_t* pData, file_offset_t WordCount = 1);
253  void* LoadChunkData();
254  void ReleaseChunkData();
255  void Resize(file_offset_t NewSize);
256  virtual ~Chunk();
257  protected:
258  uint32_t ChunkID;
259  file_offset_t ullCurrentChunkSize; /* in bytes */
260  file_offset_t ullNewChunkSize; /* in bytes (if chunk was scheduled to be resized) */
261  List* pParent;
262  File* pFile;
263  file_offset_t ullStartPos; /* actual position in file where chunk data (without header) starts */
264  file_offset_t ullPos; /* # of bytes from ulStartPos */
265  uint8_t* pChunkData;
266  file_offset_t ullChunkDataSize;
267 
268  Chunk(File* pFile);
269  Chunk(File* pFile, List* pParent, uint32_t uiChunkID, file_offset_t ullBodySize);
270  void ReadHeader(file_offset_t filePos);
271  void WriteHeader(file_offset_t filePos);
272  file_offset_t ReadSceptical(void* pData, file_offset_t WordCount, file_offset_t WordSize);
273  inline static String convertToString(uint32_t word) {
274  String result;
275  for (int i = 0; i < 4; i++) {
276  uint8_t byte = *((uint8_t*)(&word) + i);
277  char c = byte;
278  result += c;
279  }
280  return result;
281  }
282  virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize);
283  virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t* pProgress = NULL);
284  virtual void __resetPos();
285 
286  friend class List;
287  };
288 
294  class List : public Chunk {
295  public:
296  List(File* pFile, file_offset_t StartPos, List* Parent);
297  String GetListTypeString() const;
298  uint32_t GetListType() const { return ListType; }
299  Chunk* GetSubChunk(uint32_t ChunkID);
300  List* GetSubList(uint32_t ListType);
304  List* GetNextSubList();
305  size_t CountSubChunks();
306  size_t CountSubChunks(uint32_t ChunkID);
307  size_t CountSubLists();
308  size_t CountSubLists(uint32_t ListType);
309  Chunk* AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize);
310  List* AddSubList(uint32_t uiListType);
311  void DeleteSubChunk(Chunk* pSubChunk);
312  void MoveSubChunk(Chunk* pSrc, Chunk* pDst); // read API doc comments !!!
313  void MoveSubChunk(Chunk* pSrc, List* pNewParent);
314  virtual ~List();
315  protected:
316  typedef std::map<uint32_t, RIFF::Chunk*> ChunkMap;
317  typedef std::list<Chunk*> ChunkList;
318  typedef std::set<Chunk*> ChunkSet;
319 
320  uint32_t ListType;
321  ChunkList* pSubChunks;
322  ChunkMap* pSubChunksMap;
323  ChunkList::iterator ChunksIterator;
324  ChunkList::iterator ListIterator;
325 
326  List(File* pFile);
327  List(File* pFile, List* pParent, uint32_t uiListID);
328  void ReadHeader(file_offset_t filePos);
329  void WriteHeader(file_offset_t filePos);
330  void LoadSubChunks(progress_t* pProgress = NULL);
331  void LoadSubChunksRecursively(progress_t* pProgress = NULL);
332  virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize);
333  virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t* pProgress = NULL);
334  virtual void __resetPos();
335  void DeleteChunkList();
336  };
337 
344  class File : public List {
345  public:
346  File(uint32_t FileType);
347  File(const String& path);
348  File(const String& path, uint32_t FileType, endian_t Endian, layout_t layout, offset_size_t fileOffsetSize = offset_size_auto);
349  stream_mode_t GetMode() const;
350  bool SetMode(stream_mode_t NewMode);
351  void SetByteOrder(endian_t Endian);
352  String GetFileName() const;
353  void SetFileName(const String& path);
354  bool IsNew() const;
355  layout_t GetLayout() const;
359  int GetFileOffsetSize() const;
361 
362  virtual void Save(progress_t* pProgress = NULL);
363  virtual void Save(const String& path, progress_t* pProgress = NULL);
364  virtual ~File();
365  protected:
366  #if POSIX
367  int hFileRead;
369  #elif defined(WIN32)
370  HANDLE hFileRead;
371  HANDLE hFileWrite;
372  #else
373  FILE* hFileRead;
374  FILE* hFileWrite;
375  #endif // POSIX
376  String Filename;
377  bool bEndianNative;
378  bool bIsNewFile;
380  offset_size_t FileOffsetPreference;
382 
383  friend class Chunk;
384  friend class List;
385  private:
386  stream_mode_t Mode;
387 
388  void __openExistingFile(const String& path, uint32_t* FileType = NULL);
389  void ResizeFile(file_offset_t ullNewSize);
390  #if POSIX
391  file_offset_t __GetFileSize(int hFile) const;
392  #elif defined(WIN32)
393  file_offset_t __GetFileSize(HANDLE hFile) const;
394  #else
395  file_offset_t __GetFileSize(FILE* hFile) const;
396  #endif
397  int FileOffsetSizeFor(file_offset_t fileSize) const;
398  void Cleanup();
399  };
400 
404  class Exception {
405  public:
406  String Message;
407 
408  Exception(String format, ...);
409  Exception(String format, va_list arg);
410  void PrintMessage();
411  virtual ~Exception() {}
412 
413  protected:
414  Exception();
415  static String assemble(String format, va_list arg);
416  };
417 
418  String libraryName();
419  String libraryVersion();
420 
421 } // namespace RIFF
422 #endif // __RIFF_H__
file_offset_t WriteUint32(uint32_t *pData, file_offset_t WordCount=1)
Writes WordCount number of 32 Bit unsigned integer words from the buffer pointed by pData to the chun...
Definition: RIFF.cpp:684
bool IsNew() const
Returns true if this file has been created new from scratch and has not been stored to disk yet...
Definition: RIFF.cpp:2094
int16_t ReadInt16()
Reads one 16 Bit signed integer word and increments the position within the chunk.
Definition: RIFF.cpp:728
virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize)
Returns the actual total size in bytes (including List chunk header and all subchunks) of this List C...
Definition: RIFF.cpp:1367
int FileOffsetSize
Size of file offsets (in bytes) when this file was opened (or saved the last time).
Definition: RIFF.h:381
file_offset_t WriteUint16(uint16_t *pData, file_offset_t WordCount=1)
Writes WordCount number of 16 Bit unsigned integer words from the buffer pointed by pData to the chun...
Definition: RIFF.cpp:593
size_t CountSubLists()
Returns number of sublists within the list.
Definition: RIFF.cpp:1217
stream_whence_t
File stream position dependent to these relations.
Definition: RIFF.h:165
Chunk * GetFirstSubChunk()
Returns the first subchunk within the list (which may be an ordinary chunk as well as a list chunk)...
Definition: RIFF.cpp:1116
String libraryName()
Returns the name of this C++ library.
Definition: RIFF.cpp:2291
File(uint32_t FileType)
Create new RIFF file.
Definition: RIFF.cpp:1558
file_offset_t WriteInt32(int32_t *pData, file_offset_t WordCount=1)
Writes WordCount number of 32 Bit signed integer words from the buffer pointed by pData to the chunk&#39;...
Definition: RIFF.cpp:630
file_offset_t GetSize() const
Chunk size in bytes (without header, thus the chunk data body)
Definition: RIFF.h:225
layout_t Layout
An ordinary RIFF file is always set to layout_standard.
Definition: RIFF.h:379
void(* callback)(progress_t *)
Callback function pointer which has to be assigned to a function for progress notification.
Definition: RIFF.h:205
stream_state_t
Current state of the file stream.
Definition: RIFF.h:158
void ReadString(String &s, int size)
Reads a null-padded string of size characters and copies it into the string s.
Definition: RIFF.cpp:663
String libraryVersion()
Returns version of this C++ library.
Definition: RIFF.cpp:2299
List * GetSubList(uint32_t ListType)
Returns sublist chunk with list type ListType within this chunk list.
Definition: RIFF.cpp:1090
void DeleteSubChunk(Chunk *pSubChunk)
Removes a sub chunk.
Definition: RIFF.cpp:1342
Use 32 bit offsets for files smaller than 4 GB, use 64 bit offsets for files equal or larger than 4 G...
Definition: RIFF.h:187
int hFileWrite
handle / descriptor for writing to (some) file
Definition: RIFF.h:368
List * GetFirstSubList()
Returns the first sublist within the list (that is a subchunk with chunk ID "LIST").
Definition: RIFF.cpp:1151
virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t *pProgress=NULL)
Write chunk persistently e.g.
Definition: RIFF.cpp:902
stream_mode_t
Whether file stream is open in read or in read/write mode.
Definition: RIFF.h:151
String GetListTypeString() const
Returns string representation of the lists&#39;s id.
Definition: RIFF.cpp:1535
List * GetParent() const
Returns pointer to the chunk&#39;s parent list chunk.
Definition: RIFF.h:224
void SetByteOrder(endian_t Endian)
Set the byte order to be used when saving.
Definition: RIFF.cpp:1844
RIFF List Chunk.
Definition: RIFF.h:294
file_offset_t WriteInt16(int16_t *pData, file_offset_t WordCount=1)
Writes WordCount number of 16 Bit signed integer words from the buffer pointed by pData to the chunk&#39;...
Definition: RIFF.cpp:556
file_offset_t ReadSceptical(void *pData, file_offset_t WordCount, file_offset_t WordSize)
Just an internal wrapper for the main Read() method with additional Exception throwing on errors...
Definition: RIFF.cpp:444
file_offset_t Read(void *pData, file_offset_t WordCount, file_offset_t WordSize)
Reads WordCount number of data words with given WordSize and copies it into a buffer pointed by pData...
Definition: RIFF.cpp:318
file_offset_t WriteInt8(int8_t *pData, file_offset_t WordCount=1)
Writes WordCount number of 8 Bit signed integer words from the buffer pointed by pData to the chunk&#39;s...
Definition: RIFF.cpp:482
file_offset_t SetPos(file_offset_t Where, stream_whence_t Whence=stream_start)
Sets the position within the chunk body, thus within the data portion of the chunk (in bytes)...
Definition: RIFF.cpp:224
int8_t ReadInt8()
Reads one 8 Bit signed integer word and increments the position within the chunk. ...
Definition: RIFF.cpp:695
virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t *pProgress=NULL)
Write list chunk persistently e.g.
Definition: RIFF.cpp:1491
offset_size_t
Size of RIFF file offsets used in all RIFF chunks&#39; headers.
Definition: RIFF.h:186
uint64_t file_offset_t
Type used by libgig for handling file positioning during file I/O tasks.
Definition: RIFF.h:148
float __range_min
Only for internal usage, do not modify!
Definition: RIFF.h:208
Chunk * GetSubChunk(uint32_t ChunkID)
Returns subchunk with chunk ID ChunkID within this chunk list.
Definition: RIFF.cpp:1071
Chunk * GetNextSubChunk()
Returns the next subchunk within the list (which may be an ordinary chunk as well as a list chunk)...
Definition: RIFF.cpp:1133
int32_t ReadInt32()
Reads one 32 Bit signed integer word and increments the position within the chunk.
Definition: RIFF.cpp:762
virtual void Save(progress_t *pProgress=NULL)
Save changes to same file.
Definition: RIFF.cpp:1861
layout_t
General RIFF chunk structure of a RIFF file.
Definition: RIFF.h:180
virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize)
Returns the actual total size in bytes (including header) of this Chunk if being stored to a file...
Definition: RIFF.cpp:270
Ordinary RIFF Chunk.
Definition: RIFF.h:218
file_offset_t GetRequiredFileSize()
Returns the required size (in bytes) for this RIFF File to be saved to disk.
Definition: RIFF.cpp:2145
uint32_t ReadUint32()
Reads one 32 Bit unsigned integer word and increments the position within the chunk.
Definition: RIFF.cpp:779
int GetFileOffsetSize() const
Returns the current size (in bytes) of file offsets stored in the headers of all chunks of this file...
Definition: RIFF.cpp:2209
uint32_t GetChunkID() const
Chunk ID in unsigned integer representation.
Definition: RIFF.h:222
void * custom
This pointer can be used for arbitrary data.
Definition: RIFF.h:207
file_offset_t RemainingBytes() const
Returns the number of bytes left to read in the chunk body.
Definition: RIFF.cpp:256
Used for indicating the progress of a certain task.
Definition: RIFF.h:204
file_offset_t Write(void *pData, file_offset_t WordCount, file_offset_t WordSize)
Writes WordCount number of data words with given WordSize from the buffer pointed by pData...
Definition: RIFF.cpp:388
int hFileRead
handle / descriptor for reading from file
Definition: RIFF.h:367
uint32_t GetListType() const
Returns unsigned integer representation of the list&#39;s ID.
Definition: RIFF.h:298
Not a "real" RIFF file: First chunk in file is an ordinary data chunk, not a List chunk...
Definition: RIFF.h:182
virtual void __resetPos()
Sets Chunk&#39;s read/write position to zero.
Definition: RIFF.cpp:1001
uint16_t ReadUint16()
Reads one 16 Bit unsigned integer word and increments the position within the chunk.
Definition: RIFF.cpp:745
virtual void __resetPos()
Sets List Chunk&#39;s read/write position to zero and causes all sub chunks to do the same...
Definition: RIFF.cpp:1523
endian_t
Alignment of data bytes in memory (system dependant).
Definition: RIFF.h:173
void * LoadChunkData()
Load chunk body into RAM.
Definition: RIFF.cpp:809
file_offset_t WriteUint8(uint8_t *pData, file_offset_t WordCount=1)
Writes WordCount number of 8 Bit unsigned integer words from the buffer pointed by pData to the chunk...
Definition: RIFF.cpp:519
Standard RIFF file layout: First chunk in file is a List chunk which contains all other chunks and th...
Definition: RIFF.h:181
void Resize(file_offset_t NewSize)
Resize chunk.
Definition: RIFF.cpp:880
RIFF File.
Definition: RIFF.h:344
List * AddSubList(uint32_t uiListType)
Creates a new list sub chunk.
Definition: RIFF.cpp:1323
RIFF specific classes and definitions.
Definition: RIFF.h:138
float factor
Reflects current progress as value between 0.0 and 1.0.
Definition: RIFF.h:206
file_offset_t GetNewSize() const
New chunk size if it was modified with Resize(), otherwise value returned will be equal to GetSize()...
Definition: RIFF.h:226
void MoveSubChunk(Chunk *pSrc, Chunk *pDst)
Moves a sub chunk witin this list.
Definition: RIFF.cpp:1275
Always use 32 bit offsets (even for files larger than 4 GB).
Definition: RIFF.h:188
File * GetFile() const
Returns pointer to the chunk&#39;s File object.
Definition: RIFF.h:223
size_t CountSubChunks()
Returns number of subchunks within the list (including list chunks).
Definition: RIFF.cpp:1191
stream_state_t GetState() const
Returns the current state of the chunk object.
Definition: RIFF.cpp:287
bool SetMode(stream_mode_t NewMode)
Change file access mode.
Definition: RIFF.cpp:1737
float __range_max
Only for internal usage, do not modify!
Definition: RIFF.h:209
String GetChunkIDString() const
Returns the String representation of the chunk&#39;s ID (e.g.
Definition: RIFF.cpp:208
int GetRequiredFileOffsetSize()
Returns the required size (in bytes) of file offsets stored in the headers of all chunks of this file...
Definition: RIFF.cpp:2223
Will be thrown whenever an error occurs while handling a RIFF file.
Definition: RIFF.h:404
file_offset_t GetFilePos() const
Current, actual offset of chunk data body start in file.
Definition: RIFF.h:228
Always use 64 bit offsets (even for files smaller than 4 GB).
Definition: RIFF.h:189
void ReleaseChunkData()
Free loaded chunk body from RAM.
Definition: RIFF.cpp:855
file_offset_t GetCurrentFileSize() const
Returns the current size of this file (in bytes) as it is currently yet stored on disk...
Definition: RIFF.cpp:2116
file_offset_t GetPos() const
Position within the chunk data body (starting with 0).
Definition: RIFF.h:227
List * GetNextSubList()
Returns the next sublist (that is a subchunk with chunk ID "LIST") within the list.
Definition: RIFF.cpp:1173
Chunk * AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize)
Creates a new sub chunk.
Definition: RIFF.cpp:1253
uint8_t ReadUint8()
Reads one 8 Bit unsigned integer word and increments the position within the chunk.
Definition: RIFF.cpp:711