libgig 4.5.0
RIFF.h
1/***************************************************************************
2 * *
3 * libgig - C++ cross-platform Gigasampler format file access library *
4 * *
5 * Copyright (C) 2003-2025 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#if __cplusplus < 201103L
28# warning C++11 or higher required for libgig
29#endif
30
31#include <string>
32#include <list>
33#include <map>
34#include <set>
35#include <vector>
36#include <iostream>
37#include <stdarg.h>
38#include <thread>
39#include <mutex>
40#include <stdio.h>
41
42#include "sysdef.h"
43
44#if WORDS_BIGENDIAN
45# define CHUNK_ID_RIFF 0x52494646
46# define CHUNK_ID_RIFX 0x52494658
47# define CHUNK_ID_LIST 0x4C495354
48
49# define LIST_TYPE_INFO 0x494E464F
50# define CHUNK_ID_ICMT 0x49434D54
51# define CHUNK_ID_ICOP 0x49434F50
52# define CHUNK_ID_ICRD 0x49435244
53# define CHUNK_ID_IENG 0x49454E47
54# define CHUNK_ID_INAM 0x494E414D
55# define CHUNK_ID_IPRD 0x49505244
56# define CHUNK_ID_ISFT 0x49534654
57
58# define CHUNK_ID_SMPL 0x736D706C
59
60#else // little endian
61# define CHUNK_ID_RIFF 0x46464952
62# define CHUNK_ID_RIFX 0x58464952
63# define CHUNK_ID_LIST 0x5453494C
64
65# define LIST_TYPE_INFO 0x4F464E49
66# define CHUNK_ID_ICMT 0x544D4349
67# define CHUNK_ID_ICOP 0x504F4349
68# define CHUNK_ID_ICRD 0x44524349
69# define CHUNK_ID_IENG 0x474E4549
70# define CHUNK_ID_INAM 0x4D414E49
71# define CHUNK_ID_IPRD 0x44525049
72# define CHUNK_ID_ISFT 0x54465349
73
74# define CHUNK_ID_SMPL 0x6C706D73
75
76#endif // WORDS_BIGENDIAN
77
78#define CHUNK_HEADER_SIZE(fileOffsetSize) (4 + fileOffsetSize)
79#define LIST_HEADER_SIZE(fileOffsetSize) (8 + fileOffsetSize)
80#define RIFF_HEADER_SIZE(fileOffsetSize) (8 + fileOffsetSize)
81
101namespace RIFF {
102
103 /* just symbol prototyping */
104 class Chunk;
105 class List;
106 class File;
107
108 typedef std::string String;
109
111 typedef uint64_t file_offset_t;
112
115 stream_mode_read = 0,
116 stream_mode_read_write = 1,
117 stream_mode_closed = 2
118 };
119
122 stream_ready = 0,
123 stream_end_reached = 1,
124 stream_closed = 2
125 };
126
129 stream_start = 0,
130 stream_curpos = 1,
131 stream_backward = 2,
132 stream_end = 3
133 };
134
136 enum endian_t {
137 endian_little = 0,
138 endian_big = 1,
139 endian_native = 2
140 };
141
147
154
167 struct progress_t {
168 void (*callback)(progress_t*);
169 float factor;
170 void* custom;
171 const char* activity;
174 void* __private;
175 progress_t();
176 virtual ~progress_t();
177 std::vector<progress_t> subdivide(int iSubtasks) const;
178 std::vector<progress_t> subdivide(std::vector<float> vSubTaskPortions) const;
179 };
180
186 class Chunk {
187 public:
188 Chunk(File* pFile, file_offset_t StartPos, List* Parent);
189 String GetChunkIDString() const;
190 uint32_t GetChunkID() const { return ChunkID; }
191 File* GetFile() const { return pFile; }
192 List* GetParent() const { return pParent; }
193 file_offset_t GetSize() const { return ullCurrentChunkSize; }
194 file_offset_t GetNewSize() const { return ullNewChunkSize; }
195 file_offset_t GetPos() const;
197 file_offset_t SetPos(file_offset_t Where, stream_whence_t Whence = stream_start);
199 stream_state_t GetState() const;
200 file_offset_t Read(void* pData, file_offset_t WordCount, file_offset_t WordSize);
201 file_offset_t ReadInt8(int8_t* pData, file_offset_t WordCount = 1);
202 file_offset_t ReadUint8(uint8_t* pData, file_offset_t WordCount = 1);
203 file_offset_t ReadInt16(int16_t* pData, file_offset_t WordCount = 1);
204 file_offset_t ReadUint16(uint16_t* pData, file_offset_t WordCount = 1);
205 file_offset_t ReadInt32(int32_t* pData, file_offset_t WordCount = 1);
206 file_offset_t ReadUint32(uint32_t* pData, file_offset_t WordCount = 1);
207 int8_t ReadInt8();
208 uint8_t ReadUint8();
209 int16_t ReadInt16();
210 uint16_t ReadUint16();
211 int32_t ReadInt32();
212 uint32_t ReadUint32();
213 void ReadString(String& s, int size);
214 file_offset_t Write(void* pData, file_offset_t WordCount, file_offset_t WordSize);
215 file_offset_t WriteInt8(int8_t* pData, file_offset_t WordCount = 1);
216 file_offset_t WriteUint8(uint8_t* pData, file_offset_t WordCount = 1);
217 file_offset_t WriteInt16(int16_t* pData, file_offset_t WordCount = 1);
218 file_offset_t WriteUint16(uint16_t* pData, file_offset_t WordCount = 1);
219 file_offset_t WriteInt32(int32_t* pData, file_offset_t WordCount = 1);
220 file_offset_t WriteUint32(uint32_t* pData, file_offset_t WordCount = 1);
221 void* LoadChunkData();
222 void ReleaseChunkData();
223 void Resize(file_offset_t NewSize);
224 virtual ~Chunk();
225 protected:
226 uint32_t ChunkID;
227 file_offset_t ullCurrentChunkSize; /* in bytes */
228 file_offset_t ullNewChunkSize; /* in bytes (if chunk was scheduled to be resized) */
229 List* pParent;
230 File* pFile;
231 file_offset_t ullStartPos; /* actual position in file where chunk data (without header) starts */
232 uint8_t* pChunkData;
233 file_offset_t ullChunkDataSize;
234 struct ChunkPos { /* current read/write position as # of bytes from ulStartPos */
235 file_offset_t ullPos; /* used if File::IsIOPerThread() is false (default) */
236 mutable std::map<std::thread::id,file_offset_t> byThread; /* used if File::IsIOPerThread() is true */
237 mutable std::mutex mutex; /* for protecting concurrent changes on byThread map itself */
238 } chunkPos;
239
240 Chunk(File* pFile);
241 Chunk(File* pFile, List* pParent, uint32_t uiChunkID, file_offset_t ullBodySize);
242 void ReadHeader(file_offset_t filePos);
243 void WriteHeader(file_offset_t filePos);
244 file_offset_t ReadSceptical(void* pData, file_offset_t WordCount, file_offset_t WordSize);
245 inline static String convertToString(uint32_t word) {
246 return String((const char*)&word, sizeof(word));
247 }
248 virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize);
249 virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t* pProgress = NULL);
250 virtual void __resetPos();
251
252 friend class List;
253 private:
254 file_offset_t& GetPosUnsafeRef();
255 };
256
262 class List : public Chunk {
263 public:
264 List(File* pFile, file_offset_t StartPos, List* Parent);
265 String GetListTypeString() const;
266 uint32_t GetListType() const { return ListType; }
267 Chunk* GetSubChunkAt(size_t pos);
268 Chunk* GetSubChunk(uint32_t ChunkID);
269 List* GetSubListAt(size_t pos);
270 List* GetSubList(uint32_t ListType);
271 Chunk* GetFirstSubChunk() LIBGIG_DEPRECATED_API("Use GetSubChunkAt() instead.");
272 Chunk* GetNextSubChunk() LIBGIG_DEPRECATED_API("Use GetSubChunkAt() instead.");
273 List* GetFirstSubList() LIBGIG_DEPRECATED_API("Use GetSubListAt() instead.");
274 List* GetNextSubList() LIBGIG_DEPRECATED_API("Use GetSubListAt() instead.");
275 size_t CountSubChunks();
276 size_t CountSubChunks(uint32_t ChunkID);
277 size_t CountSubLists();
278 size_t CountSubLists(uint32_t ListType);
279 Chunk* AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize);
280 List* AddSubList(uint32_t uiListType);
281 void DeleteSubChunk(Chunk* pSubChunk);
282 void MoveSubChunk(Chunk* pSrc, Chunk* pDst); // read API doc comments !!!
283 void MoveSubChunk(Chunk* pSrc, List* pNewParent);
284 virtual ~List();
285 protected:
286 typedef std::map<uint32_t, RIFF::Chunk*> ChunkMap;
287 typedef std::vector<Chunk*> ChunkList;
288 typedef std::set<Chunk*> ChunkSet;
289
290 uint32_t ListType;
291 ChunkList* pSubChunks;
292 ChunkMap* pSubChunksMap;
293 ChunkList::iterator ChunksIterator;
294 ChunkList::iterator ListIterator;
295
296 List(File* pFile);
297 List(File* pFile, List* pParent, uint32_t uiListID);
298 void ReadHeader(file_offset_t filePos);
299 void WriteHeader(file_offset_t filePos);
300 void LoadSubChunks(progress_t* pProgress = NULL);
301 void LoadSubChunksRecursively(progress_t* pProgress = NULL);
302 virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize);
303 virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t* pProgress = NULL);
304 virtual void __resetPos();
305 void DeleteChunkList();
306 };
307
314 class File : public List {
315 public:
320 #if POSIX
321 typedef int Handle;
322 #elif defined(WIN32)
323 typedef HANDLE Handle;
324 #else
325 typedef FILE* Handle;
326 #endif
327
328 File(uint32_t FileType);
329 File(const String& path);
330 File(const String& path, uint32_t FileType, endian_t Endian, layout_t layout, offset_size_t fileOffsetSize = offset_size_auto);
331 stream_mode_t GetMode() const;
332 bool SetMode(stream_mode_t NewMode);
333 void SetByteOrder(endian_t Endian);
334 String GetFileName() const;
335 void SetFileName(const String& path);
336 Handle FileHandle() const;
337 bool IsNew() const;
338 layout_t GetLayout() const;
342 int GetFileOffsetSize() const;
344 bool IsIOPerThread() const;
345 void SetIOPerThread(bool enable);
346 size_t totalDataChunkCount() const;
347 size_t totalListChunkCount() const;
348 size_t totalChunkCount() const;
349
350 virtual void Save(progress_t* pProgress = NULL);
351 virtual void Save(const String& path, progress_t* pProgress = NULL);
352 virtual ~File();
353 protected:
354 struct HandlePair {
355 Handle hRead;
356 Handle hWrite;
357 stream_mode_t Mode;
358 };
359 struct IO : HandlePair {
360 bool isPerThread;
361 mutable std::map<std::thread::id,HandlePair> byThread;
362 mutable std::mutex mutex;
363 } io;
364 String Filename;
365 bool bEndianNative;
366 bool bIsNewFile;
368 offset_size_t FileOffsetPreference;
370 size_t nDataChunkCount;
371 size_t nListChunkCount;
372
373 Handle FileWriteHandle() const;
374 HandlePair FileHandlePair() const;
375
376 friend class Chunk;
377 friend class List;
378 private:
379 void __openExistingFile(const String& path, uint32_t* FileType = NULL);
380 void ResizeFile(file_offset_t ullNewSize);
381 #if POSIX
382 file_offset_t __GetFileSize(int hFile) const;
383 #elif defined(WIN32)
384 file_offset_t __GetFileSize(HANDLE hFile) const;
385 #else
386 file_offset_t __GetFileSize(FILE* hFile) const;
387 #endif
388 int FileOffsetSizeFor(file_offset_t fileSize) const;
389 void Cleanup();
390 HandlePair& FileHandlePairUnsafeRef();
391 bool SetModeInternal(stream_mode_t NewMode, bool* pResetPos);
392 };
393
397 class Exception {
398 public:
399 String Message;
400
401 Exception(String format, ...);
402 Exception(String format, va_list arg);
403 void PrintMessage() const;
404 virtual ~Exception();
405
406 protected:
407 Exception();
408 static String assemble(String format, va_list arg);
409 };
410
411 String libraryName();
412 String libraryVersion();
413
414} // namespace RIFF
415#endif // __RIFF_H__
Ordinary RIFF Chunk.
Definition RIFF.h:186
File * GetFile() const
Returns pointer to the chunk's File object.
Definition RIFF.h:191
List * GetParent() const
Returns pointer to the chunk's parent list chunk.
Definition RIFF.h:192
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'...
Definition RIFF.cpp:717
virtual void __resetPos()
Sets Chunk's read/write position to zero.
Definition RIFF.cpp:1186
void Resize(file_offset_t NewSize)
Resize chunk.
Definition RIFF.cpp:1058
int8_t ReadInt8()
Reads one 8 Bit signed integer word and increments the position within the chunk.
Definition RIFF.cpp:864
uint32_t ReadUint32()
Reads one 32 Bit unsigned integer word and increments the position within the chunk.
Definition RIFF.cpp:953
stream_state_t GetState() const
Returns the current state of the chunk object.
Definition RIFF.cpp:434
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:365
file_offset_t GetFilePos() const
Current, actual offset in file of current chunk data body read/write position.
Definition RIFF.cpp:348
void ReleaseChunkData()
Free loaded chunk body from RAM.
Definition RIFF.cpp:1033
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:541
file_offset_t RemainingBytes() const
Returns the number of bytes left to read in the chunk body.
Definition RIFF.cpp:400
int16_t ReadInt16()
Reads one 16 Bit signed integer word and increments the position within the chunk.
Definition RIFF.cpp:899
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:1081
file_offset_t GetPos() const
Current read/write position within the chunk data body (starting with 0).
Definition RIFF.cpp:335
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'...
Definition RIFF.cpp:795
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:599
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:415
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:465
uint32_t GetChunkID() const
Chunk ID in unsigned integer representation.
Definition RIFF.h:190
void * LoadChunkData()
Load chunk body into RAM.
Definition RIFF.cpp:984
String GetChunkIDString() const
Returns the String representation of the chunk's ID (e.g.
Definition RIFF.cpp:312
uint8_t ReadUint8()
Reads one 8 Bit unsigned integer word and increments the position within the chunk.
Definition RIFF.cpp:881
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's...
Definition RIFF.cpp:639
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:756
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:852
void ReadString(String &s, int size)
Reads a null-padded string of size characters and copies it into the string s.
Definition RIFF.cpp:830
uint16_t ReadUint16()
Reads one 16 Bit unsigned integer word and increments the position within the chunk.
Definition RIFF.cpp:917
file_offset_t GetSize() const
Chunk size in bytes (without header, thus the chunk data body)
Definition RIFF.h:193
int32_t ReadInt32()
Reads one 32 Bit signed integer word and increments the position within the chunk.
Definition RIFF.cpp:935
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:678
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:194
RIFF File.
Definition RIFF.h:314
Handle FileWriteHandle() const
Returns the OS dependent file I/O write handle intended to be used by the calling thread.
Definition RIFF.cpp:2056
HandlePair FileHandlePair() const
Returns the OS dependent file I/O read and write handles intended to be used by the calling thread.
Definition RIFF.cpp:2025
bool SetMode(stream_mode_t NewMode)
Change file access mode.
Definition RIFF.cpp:2086
int GetRequiredFileOffsetSize()
Returns the required size (in bytes) of file offsets stored in the headers of all chunks of this file...
Definition RIFF.cpp:2607
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:2593
File(uint32_t FileType)
Create new RIFF file.
Definition RIFF.cpp:1833
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:2499
void SetByteOrder(endian_t Endian)
Set the byte order to be used when saving.
Definition RIFF.cpp:2191
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:2477
file_offset_t GetRequiredFileSize()
Returns the required size (in bytes) for this RIFF File to be saved to disk.
Definition RIFF.cpp:2529
size_t totalDataChunkCount() const
File's total amount of ordinary (data) chunks.
Definition RIFF.cpp:2696
Handle FileHandle() const
Returns the OS dependent file I/O read handle intended to be used by the calling thread.
Definition RIFF.cpp:2046
bool IsIOPerThread() const
Whether file streams are independent for each thread.
Definition RIFF.cpp:2637
size_t totalChunkCount() const
File's total amount of data chunks and list chunks.
Definition RIFF.cpp:2724
stream_mode_t GetMode() const
Returns the file I/O mode currently being available for the calling thread for this RIFF file (either...
Definition RIFF.cpp:2066
size_t totalListChunkCount() const
File's total amount of list chunks.
Definition RIFF.cpp:2708
virtual void Save(progress_t *pProgress=NULL)
Save changes to same file.
Definition RIFF.cpp:2209
layout_t Layout
An ordinary RIFF file is always set to layout_standard.
Definition RIFF.h:367
int Handle
OS dependent type serving as file handle / descriptor for OS dependent file I/O operations.
Definition RIFF.h:321
int FileOffsetSize
Size of file offsets (in bytes) when this file was opened (or saved the last time).
Definition RIFF.h:369
void SetIOPerThread(bool enable)
Enable/disable file streams being independent for each thread.
Definition RIFF.cpp:2666
RIFF List Chunk.
Definition RIFF.h:262
size_t CountSubLists()
Returns number of sublists within the list.
Definition RIFF.cpp:1449
Chunk * GetSubChunk(uint32_t ChunkID)
Returns subchunk with chunk ID ChunkID within this chunk list.
Definition RIFF.cpp:1273
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:1625
void MoveSubChunk(Chunk *pSrc, Chunk *pDst)
Moves a sub chunk witin this list.
Definition RIFF.cpp:1511
List * GetFirstSubList()
Returns the first sublist within the list (that is a subchunk with chunk ID "LIST").
Definition RIFF.cpp:1381
List * AddSubList(uint32_t uiListType)
Creates a new list sub chunk.
Definition RIFF.cpp:1568
Chunk * GetFirstSubChunk()
Returns the first subchunk within the list (which may be an ordinary chunk as well as a list chunk).
Definition RIFF.cpp:1342
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:1768
void DeleteSubChunk(Chunk *pSubChunk)
Removes a sub chunk.
Definition RIFF.cpp:1591
List * GetSubListAt(size_t pos)
Returns sublist chunk with list type ListType at supplied pos position among all subchunks of type Li...
Definition RIFF.cpp:1291
size_t CountSubChunks()
Returns number of subchunks within the list (including list chunks).
Definition RIFF.cpp:1423
List * GetSubList(uint32_t ListType)
Returns sublist chunk with list type ListType within this chunk list.
Definition RIFF.cpp:1314
Chunk * GetNextSubChunk()
Returns the next subchunk within the list (which may be an ordinary chunk as well as a list chunk).
Definition RIFF.cpp:1361
uint32_t GetListType() const
Returns unsigned integer representation of the list's ID.
Definition RIFF.h:266
String GetListTypeString() const
Returns string representation of the lists's id.
Definition RIFF.cpp:1810
List * GetNextSubList()
Returns the next sublist (that is a subchunk with chunk ID "LIST") within the list.
Definition RIFF.cpp:1405
Chunk * AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize)
Creates a new sub chunk.
Definition RIFF.cpp:1485
virtual void __resetPos()
Sets List Chunk's read/write position to zero and causes all sub chunks to do the same.
Definition RIFF.cpp:1798
Chunk * GetSubChunkAt(size_t pos)
Returns subchunk at supplied pos position within this chunk list.
Definition RIFF.cpp:1256
RIFF specific classes and definitions.
Definition RIFF.h:101
String libraryVersion()
Returns version of this C++ library.
Definition RIFF.cpp:2803
stream_whence_t
File stream position dependent to these relations.
Definition RIFF.h:128
stream_state_t
Current state of the file stream.
Definition RIFF.h:121
String libraryName()
Returns the name of this C++ library.
Definition RIFF.cpp:2795
offset_size_t
Size of RIFF file offsets used in all RIFF chunks' headers.
Definition RIFF.h:149
@ offset_size_64bit
Always use 64 bit offsets (even for files smaller than 4 GB).
Definition RIFF.h:152
@ offset_size_auto
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:150
@ offset_size_32bit
Always use 32 bit offsets (even for files larger than 4 GB).
Definition RIFF.h:151
stream_mode_t
Whether file stream is open in read or in read/write mode.
Definition RIFF.h:114
layout_t
General RIFF chunk structure of a RIFF file.
Definition RIFF.h:143
@ layout_standard
Standard RIFF file layout: First chunk in file is a List chunk which contains all other chunks and th...
Definition RIFF.h:144
@ layout_flat
Not a "real" RIFF file: First chunk in file is an ordinary data chunk, not a List chunk,...
Definition RIFF.h:145
endian_t
Alignment of data bytes in memory (system dependant).
Definition RIFF.h:136
uint64_t file_offset_t
Type used by libgig for handling file positioning during file I/O tasks.
Definition RIFF.h:111
Used for indicating the progress of a certain task.
Definition RIFF.h:167
float __range_min
Only for internal usage, do not modify!
Definition RIFF.h:172
void * __private
Only for internal usage, do not modify!
Definition RIFF.h:174
void(* callback)(progress_t *)
Callback function pointer which has to be assigned to a function for progress notification.
Definition RIFF.h:168
float factor
Reflects current progress as value between 0.0 and 1.0.
Definition RIFF.h:169
void * custom
This pointer can be used for arbitrary data.
Definition RIFF.h:170
const char * activity
Text which describes current ongoing action (e.g. to be displayed along a progress bar).
Definition RIFF.h:171
std::vector< progress_t > subdivide(int iSubtasks) const
Divides this progress task into the requested amount of equal weighted sub-progress tasks and returns...
Definition RIFF.cpp:102
float __range_max
Only for internal usage, do not modify!
Definition RIFF.h:173