libgig  4.3.0
RIFF.h
1 /***************************************************************************
2  * *
3  * libgig - C++ cross-platform Gigasampler format file access library *
4  * *
5  * Copyright (C) 2003-2019 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 #ifndef OVERRIDE
40 # if defined(__cplusplus) && __cplusplus >= 201103L
41 # define OVERRIDE override
42 # else
43 # define OVERRIDE
44 # endif
45 #endif
46 
47 #include <string>
48 #include <list>
49 #include <map>
50 #include <set>
51 #include <vector>
52 #include <iostream>
53 #include <stdarg.h>
54 
55 #ifdef HAVE_CONFIG_H
56 # include <config.h>
57 #endif
58 
59 #if POSIX
60 # include <sys/types.h>
61 # include <sys/stat.h>
62 # include <fcntl.h>
63 # include <unistd.h>
64 #endif // POSIX
65 
66 #if defined _MSC_VER && _MSC_VER < 1600
67 // Visual C++ 2008 doesn't have stdint.h
68 typedef __int8 int8_t;
69 typedef __int16 int16_t;
70 typedef __int32 int32_t;
71 typedef __int64 int64_t;
72 typedef unsigned __int8 uint8_t;
73 typedef unsigned __int16 uint16_t;
74 typedef unsigned __int32 uint32_t;
75 typedef unsigned __int64 uint64_t;
76 #else
77 #include <stdint.h>
78 #endif
79 
80 #ifdef WIN32
81 # if (_WIN32 && !_WIN64) || (__GNUC__ && !(__x86_64__ || __ppc64__)) /* if 32 bit windows compilation */
82 # if _WIN32_WINNT < 0x0501
83 # undef _WIN32_WINNT
84 # define _WIN32_WINNT 0x0501 /* Win XP (no service pack): required for 32 bit compilation for GetFileSizeEx() to be declared by windows.h */
85 # endif
86 # endif
87 # include <windows.h>
88  typedef unsigned int uint;
89 #endif // WIN32
90 
91 #include <stdio.h>
92 
93 #if WORDS_BIGENDIAN
94 # define CHUNK_ID_RIFF 0x52494646
95 # define CHUNK_ID_RIFX 0x52494658
96 # define CHUNK_ID_LIST 0x4C495354
97 
98 # define LIST_TYPE_INFO 0x494E464F
99 # define CHUNK_ID_ICMT 0x49434D54
100 # define CHUNK_ID_ICOP 0x49434F50
101 # define CHUNK_ID_ICRD 0x49435244
102 # define CHUNK_ID_IENG 0x49454E47
103 # define CHUNK_ID_INAM 0x494E414D
104 # define CHUNK_ID_IPRD 0x49505244
105 # define CHUNK_ID_ISFT 0x49534654
106 
107 # define CHUNK_ID_SMPL 0x736D706C
108 
109 #else // little endian
110 # define CHUNK_ID_RIFF 0x46464952
111 # define CHUNK_ID_RIFX 0x58464952
112 # define CHUNK_ID_LIST 0x5453494C
113 
114 # define LIST_TYPE_INFO 0x4F464E49
115 # define CHUNK_ID_ICMT 0x544D4349
116 # define CHUNK_ID_ICOP 0x504F4349
117 # define CHUNK_ID_ICRD 0x44524349
118 # define CHUNK_ID_IENG 0x474E4549
119 # define CHUNK_ID_INAM 0x4D414E49
120 # define CHUNK_ID_IPRD 0x44525049
121 # define CHUNK_ID_ISFT 0x54465349
122 
123 # define CHUNK_ID_SMPL 0x6C706D73
124 
125 #endif // WORDS_BIGENDIAN
126 
127 #define CHUNK_HEADER_SIZE(fileOffsetSize) (4 + fileOffsetSize)
128 #define LIST_HEADER_SIZE(fileOffsetSize) (8 + fileOffsetSize)
129 #define RIFF_HEADER_SIZE(fileOffsetSize) (8 + fileOffsetSize)
130 
150 namespace RIFF {
151 
152  /* just symbol prototyping */
153  class Chunk;
154  class List;
155  class File;
156 
157  typedef std::string String;
158 
160  typedef uint64_t file_offset_t;
161 
164  stream_mode_read = 0,
165  stream_mode_read_write = 1,
166  stream_mode_closed = 2
167  };
168 
171  stream_ready = 0,
172  stream_end_reached = 1,
173  stream_closed = 2
174  };
175 
178  stream_start = 0,
179  stream_curpos = 1,
180  stream_backward = 2,
181  stream_end = 3
182  };
183 
185  enum endian_t {
186  endian_little = 0,
187  endian_big = 1,
188  endian_native = 2
189  };
190 
192  enum layout_t {
194  layout_flat = 1
195  };
196 
201  offset_size_64bit = 8
202  };
203 
216  struct progress_t {
217  void (*callback)(progress_t*);
218  float factor;
219  void* custom;
220  float __range_min;
221  float __range_max;
222  progress_t();
223  std::vector<progress_t> subdivide(int iSubtasks);
224  std::vector<progress_t> subdivide(std::vector<float> vSubTaskPortions);
225  };
226 
232  class Chunk {
233  public:
234  Chunk(File* pFile, file_offset_t StartPos, List* Parent);
235  String GetChunkIDString() const;
236  uint32_t GetChunkID() const { return ChunkID; }
237  File* GetFile() const { return pFile; }
238  List* GetParent() const { return pParent; }
239  file_offset_t GetSize() const { return ullCurrentChunkSize; }
240  file_offset_t GetNewSize() const { return ullNewChunkSize; }
241  file_offset_t GetPos() const { return ullPos; }
242  file_offset_t GetFilePos() const { return ullStartPos + ullPos; }
243  file_offset_t SetPos(file_offset_t Where, stream_whence_t Whence = stream_start);
245  stream_state_t GetState() const;
246  file_offset_t Read(void* pData, file_offset_t WordCount, file_offset_t WordSize);
247  file_offset_t ReadInt8(int8_t* pData, file_offset_t WordCount = 1);
248  file_offset_t ReadUint8(uint8_t* pData, file_offset_t WordCount = 1);
249  file_offset_t ReadInt16(int16_t* pData, file_offset_t WordCount = 1);
250  file_offset_t ReadUint16(uint16_t* pData, file_offset_t WordCount = 1);
251  file_offset_t ReadInt32(int32_t* pData, file_offset_t WordCount = 1);
252  file_offset_t ReadUint32(uint32_t* pData, file_offset_t WordCount = 1);
253  int8_t ReadInt8();
254  uint8_t ReadUint8();
255  int16_t ReadInt16();
256  uint16_t ReadUint16();
257  int32_t ReadInt32();
258  uint32_t ReadUint32();
259  void ReadString(String& s, int size);
260  file_offset_t Write(void* pData, file_offset_t WordCount, file_offset_t WordSize);
261  file_offset_t WriteInt8(int8_t* pData, file_offset_t WordCount = 1);
262  file_offset_t WriteUint8(uint8_t* pData, file_offset_t WordCount = 1);
263  file_offset_t WriteInt16(int16_t* pData, file_offset_t WordCount = 1);
264  file_offset_t WriteUint16(uint16_t* pData, file_offset_t WordCount = 1);
265  file_offset_t WriteInt32(int32_t* pData, file_offset_t WordCount = 1);
266  file_offset_t WriteUint32(uint32_t* pData, file_offset_t WordCount = 1);
267  void* LoadChunkData();
268  void ReleaseChunkData();
269  void Resize(file_offset_t NewSize);
270  virtual ~Chunk();
271  protected:
272  uint32_t ChunkID;
273  file_offset_t ullCurrentChunkSize; /* in bytes */
274  file_offset_t ullNewChunkSize; /* in bytes (if chunk was scheduled to be resized) */
275  List* pParent;
276  File* pFile;
277  file_offset_t ullStartPos; /* actual position in file where chunk data (without header) starts */
278  file_offset_t ullPos; /* # of bytes from ulStartPos */
279  uint8_t* pChunkData;
280  file_offset_t ullChunkDataSize;
281 
282  Chunk(File* pFile);
283  Chunk(File* pFile, List* pParent, uint32_t uiChunkID, file_offset_t ullBodySize);
284  void ReadHeader(file_offset_t filePos);
285  void WriteHeader(file_offset_t filePos);
286  file_offset_t ReadSceptical(void* pData, file_offset_t WordCount, file_offset_t WordSize);
287  inline static String convertToString(uint32_t word) {
288  String result;
289  for (int i = 0; i < 4; i++) {
290  uint8_t byte = *((uint8_t*)(&word) + i);
291  char c = byte;
292  result += c;
293  }
294  return result;
295  }
296  virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize);
297  virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t* pProgress = NULL);
298  virtual void __resetPos();
299 
300  friend class List;
301  };
302 
308  class List : public Chunk {
309  public:
310  List(File* pFile, file_offset_t StartPos, List* Parent);
311  String GetListTypeString() const;
312  uint32_t GetListType() const { return ListType; }
313  Chunk* GetSubChunk(uint32_t ChunkID);
314  List* GetSubList(uint32_t ListType);
318  List* GetNextSubList();
319  size_t CountSubChunks();
320  size_t CountSubChunks(uint32_t ChunkID);
321  size_t CountSubLists();
322  size_t CountSubLists(uint32_t ListType);
323  Chunk* AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize);
324  List* AddSubList(uint32_t uiListType);
325  void DeleteSubChunk(Chunk* pSubChunk);
326  void MoveSubChunk(Chunk* pSrc, Chunk* pDst); // read API doc comments !!!
327  void MoveSubChunk(Chunk* pSrc, List* pNewParent);
328  virtual ~List();
329  protected:
330  typedef std::map<uint32_t, RIFF::Chunk*> ChunkMap;
331  typedef std::list<Chunk*> ChunkList;
332  typedef std::set<Chunk*> ChunkSet;
333 
334  uint32_t ListType;
335  ChunkList* pSubChunks;
336  ChunkMap* pSubChunksMap;
337  ChunkList::iterator ChunksIterator;
338  ChunkList::iterator ListIterator;
339 
340  List(File* pFile);
341  List(File* pFile, List* pParent, uint32_t uiListID);
342  void ReadHeader(file_offset_t filePos);
343  void WriteHeader(file_offset_t filePos);
344  void LoadSubChunks(progress_t* pProgress = NULL);
345  void LoadSubChunksRecursively(progress_t* pProgress = NULL);
346  virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize);
347  virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t* pProgress = NULL);
348  virtual void __resetPos();
349  void DeleteChunkList();
350  };
351 
358  class File : public List {
359  public:
360  File(uint32_t FileType);
361  File(const String& path);
362  File(const String& path, uint32_t FileType, endian_t Endian, layout_t layout, offset_size_t fileOffsetSize = offset_size_auto);
363  stream_mode_t GetMode() const;
364  bool SetMode(stream_mode_t NewMode);
365  void SetByteOrder(endian_t Endian);
366  String GetFileName() const;
367  void SetFileName(const String& path);
368  bool IsNew() const;
369  layout_t GetLayout() const;
373  int GetFileOffsetSize() const;
375 
376  virtual void Save(progress_t* pProgress = NULL);
377  virtual void Save(const String& path, progress_t* pProgress = NULL);
378  virtual ~File();
379  protected:
380  #if POSIX
381  int hFileRead;
383  #elif defined(WIN32)
384  HANDLE hFileRead;
385  HANDLE hFileWrite;
386  #else
387  FILE* hFileRead;
388  FILE* hFileWrite;
389  #endif // POSIX
390  String Filename;
391  bool bEndianNative;
392  bool bIsNewFile;
394  offset_size_t FileOffsetPreference;
396 
397  friend class Chunk;
398  friend class List;
399  private:
400  stream_mode_t Mode;
401 
402  void __openExistingFile(const String& path, uint32_t* FileType = NULL);
403  void ResizeFile(file_offset_t ullNewSize);
404  #if POSIX
405  file_offset_t __GetFileSize(int hFile) const;
406  #elif defined(WIN32)
407  file_offset_t __GetFileSize(HANDLE hFile) const;
408  #else
409  file_offset_t __GetFileSize(FILE* hFile) const;
410  #endif
411  int FileOffsetSizeFor(file_offset_t fileSize) const;
412  void Cleanup();
413  };
414 
418  class Exception {
419  public:
420  String Message;
421 
422  Exception(String format, ...);
423  Exception(String format, va_list arg);
424  void PrintMessage();
425  virtual ~Exception() {}
426 
427  protected:
428  Exception();
429  static String assemble(String format, va_list arg);
430  };
431 
432  String libraryName();
433  String libraryVersion();
434 
435 } // namespace RIFF
436 #endif // __RIFF_H__
Ordinary RIFF Chunk.
Definition: RIFF.h:232
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:612
virtual void __resetPos()
Sets Chunk's read/write position to zero.
Definition: RIFF.cpp:1058
void Resize(file_offset_t NewSize)
Resize chunk.
Definition: RIFF.cpp:936
int8_t ReadInt8()
Reads one 8 Bit signed integer word and increments the position within the chunk.
Definition: RIFF.cpp:751
uint32_t ReadUint32()
Reads one 32 Bit unsigned integer word and increments the position within the chunk.
Definition: RIFF.cpp:835
stream_state_t GetState() const
Returns the current state of the chunk object.
Definition: RIFF.cpp:343
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:280
file_offset_t GetFilePos() const
Current, actual offset in file of current chunk data body read/write position.
Definition: RIFF.h:242
void ReleaseChunkData()
Free loaded chunk body from RAM.
Definition: RIFF.cpp:911
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:444
file_offset_t RemainingBytes() const
Returns the number of bytes left to read in the chunk body.
Definition: RIFF.cpp:312
int16_t ReadInt16()
Reads one 16 Bit signed integer word and increments the position within the chunk.
Definition: RIFF.cpp:784
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:958
file_offset_t GetPos() const
Position within the chunk data body (starting with 0).
Definition: RIFF.h:241
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:686
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:500
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:326
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:374
uint32_t GetChunkID() const
Chunk ID in unsigned integer representation.
Definition: RIFF.h:236
void * LoadChunkData()
Load chunk body into RAM.
Definition: RIFF.cpp:865
String GetChunkIDString() const
Returns the String representation of the chunk's ID (e.g.
Definition: RIFF.cpp:264
uint8_t ReadUint8()
Reads one 8 Bit unsigned integer word and increments the position within the chunk.
Definition: RIFF.cpp:767
List * GetParent() const
Returns pointer to the chunk's parent list chunk.
Definition: RIFF.h:238
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:538
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:649
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:740
void ReadString(String &s, int size)
Reads a null-padded string of size characters and copies it into the string s.
Definition: RIFF.cpp:719
uint16_t ReadUint16()
Reads one 16 Bit unsigned integer word and increments the position within the chunk.
Definition: RIFF.cpp:801
file_offset_t GetSize() const
Chunk size in bytes (without header, thus the chunk data body)
Definition: RIFF.h:239
File * GetFile() const
Returns pointer to the chunk's File object.
Definition: RIFF.h:237
int32_t ReadInt32()
Reads one 32 Bit signed integer word and increments the position within the chunk.
Definition: RIFF.cpp:818
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:575
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:240
Will be thrown whenever an error occurs while handling a RIFF file.
Definition: RIFF.h:418
RIFF File.
Definition: RIFF.h:358
bool SetMode(stream_mode_t NewMode)
Change file access mode.
Definition: RIFF.cpp:1803
int GetRequiredFileOffsetSize()
Returns the required size (in bytes) of file offsets stored in the headers of all chunks of this file...
Definition: RIFF.cpp:2299
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:2285
File(uint32_t FileType)
Create new RIFF file.
Definition: RIFF.cpp:1624
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:2192
void SetByteOrder(endian_t Endian)
Set the byte order to be used when saving.
Definition: RIFF.cpp:1910
int hFileRead
handle / descriptor for reading from file
Definition: RIFF.h:381
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:2170
file_offset_t GetRequiredFileSize()
Returns the required size (in bytes) for this RIFF File to be saved to disk.
Definition: RIFF.cpp:2221
int hFileWrite
handle / descriptor for writing to (some) file
Definition: RIFF.h:382
virtual void Save(progress_t *pProgress=NULL)
Save changes to same file.
Definition: RIFF.cpp:1927
layout_t Layout
An ordinary RIFF file is always set to layout_standard.
Definition: RIFF.h:393
int FileOffsetSize
Size of file offsets (in bytes) when this file was opened (or saved the last time).
Definition: RIFF.h:395
RIFF List Chunk.
Definition: RIFF.h:308
size_t CountSubLists()
Returns number of sublists within the list.
Definition: RIFF.cpp:1274
Chunk * GetSubChunk(uint32_t ChunkID)
Returns subchunk with chunk ID ChunkID within this chunk list.
Definition: RIFF.cpp:1128
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:1424
void MoveSubChunk(Chunk *pSrc, Chunk *pDst)
Moves a sub chunk witin this list.
Definition: RIFF.cpp:1332
List * GetFirstSubList()
Returns the first sublist within the list (that is a subchunk with chunk ID "LIST").
Definition: RIFF.cpp:1208
List * AddSubList(uint32_t uiListType)
Creates a new list sub chunk.
Definition: RIFF.cpp:1380
Chunk * GetFirstSubChunk()
Returns the first subchunk within the list (which may be an ordinary chunk as well as a list chunk).
Definition: RIFF.cpp:1173
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:1553
void DeleteSubChunk(Chunk *pSubChunk)
Removes a sub chunk.
Definition: RIFF.cpp:1399
size_t CountSubChunks()
Returns number of subchunks within the list (including list chunks).
Definition: RIFF.cpp:1248
List * GetSubList(uint32_t ListType)
Returns sublist chunk with list type ListType within this chunk list.
Definition: RIFF.cpp:1147
Chunk * GetNextSubChunk()
Returns the next subchunk within the list (which may be an ordinary chunk as well as a list chunk).
Definition: RIFF.cpp:1190
uint32_t GetListType() const
Returns unsigned integer representation of the list's ID.
Definition: RIFF.h:312
String GetListTypeString() const
Returns string representation of the lists's id.
Definition: RIFF.cpp:1601
List * GetNextSubList()
Returns the next sublist (that is a subchunk with chunk ID "LIST") within the list.
Definition: RIFF.cpp:1230
Chunk * AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize)
Creates a new sub chunk.
Definition: RIFF.cpp:1310
virtual void __resetPos()
Sets List Chunk's read/write position to zero and causes all sub chunks to do the same.
Definition: RIFF.cpp:1589
RIFF specific classes and definitions.
Definition: RIFF.h:150
String libraryVersion()
Returns version of this C++ library.
Definition: RIFF.cpp:2375
stream_whence_t
File stream position dependent to these relations.
Definition: RIFF.h:177
stream_state_t
Current state of the file stream.
Definition: RIFF.h:170
String libraryName()
Returns the name of this C++ library.
Definition: RIFF.cpp:2367
offset_size_t
Size of RIFF file offsets used in all RIFF chunks' headers.
Definition: RIFF.h:198
@ offset_size_64bit
Always use 64 bit offsets (even for files smaller than 4 GB).
Definition: RIFF.h:201
@ 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:199
@ offset_size_32bit
Always use 32 bit offsets (even for files larger than 4 GB).
Definition: RIFF.h:200
stream_mode_t
Whether file stream is open in read or in read/write mode.
Definition: RIFF.h:163
layout_t
General RIFF chunk structure of a RIFF file.
Definition: RIFF.h:192
@ layout_standard
Standard RIFF file layout: First chunk in file is a List chunk which contains all other chunks and th...
Definition: RIFF.h:193
@ layout_flat
Not a "real" RIFF file: First chunk in file is an ordinary data chunk, not a List chunk,...
Definition: RIFF.h:194
endian_t
Alignment of data bytes in memory (system dependant).
Definition: RIFF.h:185
uint64_t file_offset_t
Type used by libgig for handling file positioning during file I/O tasks.
Definition: RIFF.h:160
Used for indicating the progress of a certain task.
Definition: RIFF.h:216
float __range_min
Only for internal usage, do not modify!
Definition: RIFF.h:220
std::vector< progress_t > subdivide(int iSubtasks)
Divides this progress task into the requested amount of equal weighted sub-progress tasks and returns...
Definition: RIFF.cpp:74
void(* callback)(progress_t *)
Callback function pointer which has to be assigned to a function for progress notification.
Definition: RIFF.h:217
float factor
Reflects current progress as value between 0.0 and 1.0.
Definition: RIFF.h:218
void * custom
This pointer can be used for arbitrary data.
Definition: RIFF.h:219
float __range_max
Only for internal usage, do not modify!
Definition: RIFF.h:221