RIFF.h
/***************************************************************************
* *
* libgig - C++ cross-platform Gigasampler format file access library *
* *
* Copyright (C) 2003-2025 by Christian Schoenebeck *
* <cuse@users.sourceforge.net> *
* *
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
* MA 02111-1307 USA *
***************************************************************************/
#ifndef __RIFF_H__
#define __RIFF_H__
#if __cplusplus < 201103L
# warning C++11 or higher required for libgig
#endif
#include <string>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <iostream>
#include <stdarg.h>
#include <thread>
#include <mutex>
#include <stdio.h>
#include "sysdef.h"
#if WORDS_BIGENDIAN
# define CHUNK_ID_RIFF 0x52494646
# define CHUNK_ID_RIFX 0x52494658
# define CHUNK_ID_LIST 0x4C495354
# define LIST_TYPE_INFO 0x494E464F
# define CHUNK_ID_ICMT 0x49434D54
# define CHUNK_ID_ICOP 0x49434F50
# define CHUNK_ID_ICRD 0x49435244
# define CHUNK_ID_IENG 0x49454E47
# define CHUNK_ID_INAM 0x494E414D
# define CHUNK_ID_IPRD 0x49505244
# define CHUNK_ID_ISFT 0x49534654
# define CHUNK_ID_SMPL 0x736D706C
#else // little endian
# define CHUNK_ID_RIFF 0x46464952
# define CHUNK_ID_RIFX 0x58464952
# define CHUNK_ID_LIST 0x5453494C
# define LIST_TYPE_INFO 0x4F464E49
# define CHUNK_ID_ICMT 0x544D4349
# define CHUNK_ID_ICOP 0x504F4349
# define CHUNK_ID_ICRD 0x44524349
# define CHUNK_ID_IENG 0x474E4549
# define CHUNK_ID_INAM 0x4D414E49
# define CHUNK_ID_IPRD 0x44525049
# define CHUNK_ID_ISFT 0x54465349
# define CHUNK_ID_SMPL 0x6C706D73
#endif // WORDS_BIGENDIAN
#define CHUNK_HEADER_SIZE(fileOffsetSize) (4 + fileOffsetSize)
#define LIST_HEADER_SIZE(fileOffsetSize) (8 + fileOffsetSize)
#define RIFF_HEADER_SIZE(fileOffsetSize) (8 + fileOffsetSize)
namespace RIFF {
/* just symbol prototyping */
class Chunk;
class List;
class File;
typedef std::string String;
typedef uint64_t file_offset_t;
enum stream_mode_t {
stream_mode_read = 0,
stream_mode_read_write = 1,
stream_mode_closed = 2
};
enum stream_state_t {
stream_ready = 0,
stream_end_reached = 1,
stream_closed = 2
};
enum stream_whence_t {
stream_start = 0,
stream_curpos = 1,
stream_backward = 2,
stream_end = 3
};
enum endian_t {
endian_little = 0,
endian_big = 1,
endian_native = 2
};
enum layout_t {
layout_standard = 0,
layout_flat = 1
};
enum offset_size_t {
offset_size_auto = 0,
offset_size_32bit = 4,
offset_size_64bit = 8
};
struct progress_t {
void (*callback)(progress_t*);
float factor;
void* custom;
const char* activity;
float __range_min;
float __range_max;
void* __private;
progress_t();
virtual ~progress_t();
std::vector<progress_t> subdivide(int iSubtasks) const;
std::vector<progress_t> subdivide(std::vector<float> vSubTaskPortions) const;
};
class Chunk {
public:
Chunk(File* pFile, file_offset_t StartPos, List* Parent);
String GetChunkIDString() const;
uint32_t GetChunkID() const { return ChunkID; }
File* GetFile() const { return pFile; }
List* GetParent() const { return pParent; }
file_offset_t GetSize() const { return ullCurrentChunkSize; }
file_offset_t GetNewSize() const { return ullNewChunkSize; }
file_offset_t GetPos() const;
file_offset_t GetFilePos() const;
file_offset_t SetPos(file_offset_t Where, stream_whence_t Whence = stream_start);
file_offset_t RemainingBytes() const;
stream_state_t GetState() const;
file_offset_t Read(void* pData, file_offset_t WordCount, file_offset_t WordSize);
file_offset_t ReadInt8(int8_t* pData, file_offset_t WordCount = 1);
file_offset_t ReadUint8(uint8_t* pData, file_offset_t WordCount = 1);
file_offset_t ReadInt16(int16_t* pData, file_offset_t WordCount = 1);
file_offset_t ReadUint16(uint16_t* pData, file_offset_t WordCount = 1);
file_offset_t ReadInt32(int32_t* pData, file_offset_t WordCount = 1);
file_offset_t ReadUint32(uint32_t* pData, file_offset_t WordCount = 1);
int8_t ReadInt8();
uint8_t ReadUint8();
int16_t ReadInt16();
uint16_t ReadUint16();
int32_t ReadInt32();
uint32_t ReadUint32();
void ReadString(String& s, int size);
file_offset_t Write(void* pData, file_offset_t WordCount, file_offset_t WordSize);
file_offset_t WriteInt8(int8_t* pData, file_offset_t WordCount = 1);
file_offset_t WriteUint8(uint8_t* pData, file_offset_t WordCount = 1);
file_offset_t WriteInt16(int16_t* pData, file_offset_t WordCount = 1);
file_offset_t WriteUint16(uint16_t* pData, file_offset_t WordCount = 1);
file_offset_t WriteInt32(int32_t* pData, file_offset_t WordCount = 1);
file_offset_t WriteUint32(uint32_t* pData, file_offset_t WordCount = 1);
void* LoadChunkData();
void ReleaseChunkData();
void Resize(file_offset_t NewSize);
virtual ~Chunk();
protected:
uint32_t ChunkID;
file_offset_t ullCurrentChunkSize; /* in bytes */
file_offset_t ullNewChunkSize; /* in bytes (if chunk was scheduled to be resized) */
List* pParent;
File* pFile;
file_offset_t ullStartPos; /* actual position in file where chunk data (without header) starts */
uint8_t* pChunkData;
file_offset_t ullChunkDataSize;
struct ChunkPos { /* current read/write position as # of bytes from ulStartPos */
file_offset_t ullPos; /* used if File::IsIOPerThread() is false (default) */
mutable std::map<std::thread::id,file_offset_t> byThread; /* used if File::IsIOPerThread() is true */
mutable std::mutex mutex; /* for protecting concurrent changes on byThread map itself */
} chunkPos;
Chunk(File* pFile);
Chunk(File* pFile, List* pParent, uint32_t uiChunkID, file_offset_t ullBodySize);
void ReadHeader(file_offset_t filePos);
void WriteHeader(file_offset_t filePos);
file_offset_t ReadSceptical(void* pData, file_offset_t WordCount, file_offset_t WordSize);
inline static String convertToString(uint32_t word) {
return String((const char*)&word, sizeof(word));
}
virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize);
virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t* pProgress = NULL);
virtual void __resetPos();
friend class List;
private:
file_offset_t& GetPosUnsafeRef();
};
class List : public Chunk {
public:
List(File* pFile, file_offset_t StartPos, List* Parent);
String GetListTypeString() const;
uint32_t GetListType() const { return ListType; }
Chunk* GetSubChunkAt(size_t pos);
Chunk* GetSubChunk(uint32_t ChunkID);
List* GetSubListAt(size_t pos);
List* GetSubList(uint32_t ListType);
Chunk* GetFirstSubChunk() LIBGIG_DEPRECATED_API("Use GetSubChunkAt() instead.");
Chunk* GetNextSubChunk() LIBGIG_DEPRECATED_API("Use GetSubChunkAt() instead.");
List* GetFirstSubList() LIBGIG_DEPRECATED_API("Use GetSubListAt() instead.");
List* GetNextSubList() LIBGIG_DEPRECATED_API("Use GetSubListAt() instead.");
size_t CountSubChunks();
size_t CountSubChunks(uint32_t ChunkID);
size_t CountSubLists();
size_t CountSubLists(uint32_t ListType);
Chunk* AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize);
List* AddSubList(uint32_t uiListType);
void DeleteSubChunk(Chunk* pSubChunk);
void MoveSubChunk(Chunk* pSrc, Chunk* pDst); // read API doc comments !!!
void MoveSubChunk(Chunk* pSrc, List* pNewParent);
virtual ~List();
protected:
typedef std::map<uint32_t, RIFF::Chunk*> ChunkMap;
typedef std::vector<Chunk*> ChunkList;
typedef std::set<Chunk*> ChunkSet;
uint32_t ListType;
ChunkList* pSubChunks;
ChunkMap* pSubChunksMap;
ChunkList::iterator ChunksIterator;
ChunkList::iterator ListIterator;
List(File* pFile);
List(File* pFile, List* pParent, uint32_t uiListID);
void ReadHeader(file_offset_t filePos);
void WriteHeader(file_offset_t filePos);
void LoadSubChunks(progress_t* pProgress = NULL);
void LoadSubChunksRecursively(progress_t* pProgress = NULL);
virtual file_offset_t RequiredPhysicalSize(int fileOffsetSize);
virtual file_offset_t WriteChunk(file_offset_t ullWritePos, file_offset_t ullCurrentDataOffset, progress_t* pProgress = NULL);
virtual void __resetPos();
void DeleteChunkList();
};
class File : public List {
public:
#if POSIX
typedef int Handle;
#elif defined(WIN32)
typedef HANDLE Handle;
#else
typedef FILE* Handle;
#endif
File(uint32_t FileType);
File(const String& path);
File(const String& path, uint32_t FileType, endian_t Endian, layout_t layout, offset_size_t fileOffsetSize = offset_size_auto);
stream_mode_t GetMode() const;
bool SetMode(stream_mode_t NewMode);
void SetByteOrder(endian_t Endian);
String GetFileName() const;
void SetFileName(const String& path);
Handle FileHandle() const;
bool IsNew() const;
layout_t GetLayout() const;
file_offset_t GetCurrentFileSize() const;
file_offset_t GetRequiredFileSize();
file_offset_t GetRequiredFileSize(offset_size_t fileOffsetSize);
int GetFileOffsetSize() const;
int GetRequiredFileOffsetSize();
bool IsIOPerThread() const;
void SetIOPerThread(bool enable);
size_t totalDataChunkCount() const;
size_t totalListChunkCount() const;
size_t totalChunkCount() const;
virtual void Save(progress_t* pProgress = NULL);
virtual void Save(const String& path, progress_t* pProgress = NULL);
virtual ~File();
protected:
struct HandlePair {
Handle hRead;
Handle hWrite;
stream_mode_t Mode;
};
struct IO : HandlePair {
bool isPerThread;
mutable std::map<std::thread::id,HandlePair> byThread;
mutable std::mutex mutex;
} io;
String Filename;
bool bEndianNative;
bool bIsNewFile;
layout_t Layout;
offset_size_t FileOffsetPreference;
int FileOffsetSize;
size_t nDataChunkCount;
size_t nListChunkCount;
Handle FileWriteHandle() const;
HandlePair FileHandlePair() const;
friend class Chunk;
friend class List;
private:
void __openExistingFile(const String& path, uint32_t* FileType = NULL);
void ResizeFile(file_offset_t ullNewSize);
#if POSIX
file_offset_t __GetFileSize(int hFile) const;
#elif defined(WIN32)
file_offset_t __GetFileSize(HANDLE hFile) const;
#else
file_offset_t __GetFileSize(FILE* hFile) const;
#endif
int FileOffsetSizeFor(file_offset_t fileSize) const;
void Cleanup();
HandlePair& FileHandlePairUnsafeRef();
bool SetModeInternal(stream_mode_t NewMode, bool* pResetPos);
};
class Exception {
public:
String Message;
Exception(String format, ...);
Exception(String format, va_list arg);
void PrintMessage() const;
virtual ~Exception();
protected:
Exception();
static String assemble(String format, va_list arg);
};
String libraryName();
String libraryVersion();
} // namespace RIFF
#endif // __RIFF_H__
RIFF::Chunk
Ordinary RIFF Chunk.
Definition RIFF.h:186
RIFF::Chunk::GetFile
File * GetFile() const
Returns pointer to the chunk's File object.
Definition RIFF.h:191
RIFF::Chunk::GetParent
List * GetParent() const
Returns pointer to the chunk's parent list chunk.
Definition RIFF.h:192
RIFF::Chunk::WriteInt16
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
RIFF::Chunk::__resetPos
virtual void __resetPos()
Sets Chunk's read/write position to zero.
Definition RIFF.cpp:1186
RIFF::Chunk::Resize
void Resize(file_offset_t NewSize)
Resize chunk.
Definition RIFF.cpp:1058
RIFF::Chunk::ReadInt8
int8_t ReadInt8()
Reads one 8 Bit signed integer word and increments the position within the chunk.
Definition RIFF.cpp:864
RIFF::Chunk::ReadUint32
uint32_t ReadUint32()
Reads one 32 Bit unsigned integer word and increments the position within the chunk.
Definition RIFF.cpp:953
RIFF::Chunk::GetState
stream_state_t GetState() const
Returns the current state of the chunk object.
Definition RIFF.cpp:434
RIFF::Chunk::SetPos
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
RIFF::Chunk::GetFilePos
file_offset_t GetFilePos() const
Current, actual offset in file of current chunk data body read/write position.
Definition RIFF.cpp:348
RIFF::Chunk::ReleaseChunkData
void ReleaseChunkData()
Free loaded chunk body from RAM.
Definition RIFF.cpp:1033
RIFF::Chunk::Write
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
RIFF::Chunk::RemainingBytes
file_offset_t RemainingBytes() const
Returns the number of bytes left to read in the chunk body.
Definition RIFF.cpp:400
RIFF::Chunk::ReadInt16
int16_t ReadInt16()
Reads one 16 Bit signed integer word and increments the position within the chunk.
Definition RIFF.cpp:899
RIFF::Chunk::WriteChunk
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
RIFF::Chunk::GetPos
file_offset_t GetPos() const
Current read/write position within the chunk data body (starting with 0).
Definition RIFF.cpp:335
RIFF::Chunk::WriteInt32
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
RIFF::Chunk::ReadSceptical
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
RIFF::Chunk::RequiredPhysicalSize
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
RIFF::Chunk::Read
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
RIFF::Chunk::GetChunkID
uint32_t GetChunkID() const
Chunk ID in unsigned integer representation.
Definition RIFF.h:190
RIFF::Chunk::LoadChunkData
void * LoadChunkData()
Load chunk body into RAM.
Definition RIFF.cpp:984
RIFF::Chunk::GetChunkIDString
String GetChunkIDString() const
Returns the String representation of the chunk's ID (e.g.
Definition RIFF.cpp:312
RIFF::Chunk::ReadUint8
uint8_t ReadUint8()
Reads one 8 Bit unsigned integer word and increments the position within the chunk.
Definition RIFF.cpp:881
RIFF::Chunk::WriteInt8
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
RIFF::Chunk::WriteUint16
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
RIFF::Chunk::WriteUint32
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
RIFF::Chunk::ReadString
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
RIFF::Chunk::ReadUint16
uint16_t ReadUint16()
Reads one 16 Bit unsigned integer word and increments the position within the chunk.
Definition RIFF.cpp:917
RIFF::Chunk::GetSize
file_offset_t GetSize() const
Chunk size in bytes (without header, thus the chunk data body).
Definition RIFF.h:193
RIFF::Chunk::ReadInt32
int32_t ReadInt32()
Reads one 32 Bit signed integer word and increments the position within the chunk.
Definition RIFF.cpp:935
RIFF::Chunk::WriteUint8
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
RIFF::Chunk::GetNewSize
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
RIFF File.
Definition RIFF.h:314
RIFF::File::FileWriteHandle
Handle FileWriteHandle() const
Returns the OS dependent file I/O write handle intended to be used by the calling thread.
Definition RIFF.cpp:2056
RIFF::File::FileHandlePair
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
RIFF::File::SetMode
bool SetMode(stream_mode_t NewMode)
Change file access mode.
Definition RIFF.cpp:2086
RIFF::File::GetRequiredFileOffsetSize
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
RIFF::File::GetFileOffsetSize
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
RIFF::File::File
File(uint32_t FileType)
Create new RIFF file.
Definition RIFF.cpp:1833
RIFF::File::GetCurrentFileSize
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
RIFF::File::SetByteOrder
void SetByteOrder(endian_t Endian)
Set the byte order to be used when saving.
Definition RIFF.cpp:2191
RIFF::File::IsNew
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
RIFF::File::GetRequiredFileSize
file_offset_t GetRequiredFileSize()
Returns the required size (in bytes) for this RIFF File to be saved to disk.
Definition RIFF.cpp:2529
RIFF::File::totalDataChunkCount
size_t totalDataChunkCount() const
File's total amount of ordinary (data) chunks.
Definition RIFF.cpp:2696
RIFF::File::FileHandle
Handle FileHandle() const
Returns the OS dependent file I/O read handle intended to be used by the calling thread.
Definition RIFF.cpp:2046
RIFF::File::IsIOPerThread
bool IsIOPerThread() const
Whether file streams are independent for each thread.
Definition RIFF.cpp:2637
RIFF::File::totalChunkCount
size_t totalChunkCount() const
File's total amount of data chunks and list chunks.
Definition RIFF.cpp:2724
RIFF::File::GetMode
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
RIFF::File::totalListChunkCount
size_t totalListChunkCount() const
File's total amount of list chunks.
Definition RIFF.cpp:2708
RIFF::File::Save
virtual void Save(progress_t *pProgress=NULL)
Save changes to same file.
Definition RIFF.cpp:2209
RIFF::File::Layout
layout_t Layout
An ordinary RIFF file is always set to layout_standard.
Definition RIFF.h:367
RIFF::File::Handle
int Handle
OS dependent type serving as file handle / descriptor for OS dependent file I/O operations.
Definition RIFF.h:321
RIFF::File::FileOffsetSize
int FileOffsetSize
Size of file offsets (in bytes) when this file was opened (or saved the last time).
Definition RIFF.h:369
RIFF::File::SetIOPerThread
void SetIOPerThread(bool enable)
Enable/disable file streams being independent for each thread.
Definition RIFF.cpp:2666
RIFF::List
RIFF List Chunk.
Definition RIFF.h:262
RIFF::List::CountSubLists
size_t CountSubLists()
Returns number of sublists within the list.
Definition RIFF.cpp:1449
RIFF::List::GetSubChunk
Chunk * GetSubChunk(uint32_t ChunkID)
Returns subchunk with chunk ID ChunkID within this chunk list.
Definition RIFF.cpp:1273
RIFF::List::RequiredPhysicalSize
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
RIFF::List::MoveSubChunk
void MoveSubChunk(Chunk *pSrc, Chunk *pDst)
Moves a sub chunk witin this list.
Definition RIFF.cpp:1511
RIFF::List::GetFirstSubList
List * GetFirstSubList()
Returns the first sublist within the list (that is a subchunk with chunk ID "LIST").
Definition RIFF.cpp:1381
RIFF::List::AddSubList
List * AddSubList(uint32_t uiListType)
Creates a new list sub chunk.
Definition RIFF.cpp:1568
RIFF::List::GetFirstSubChunk
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
RIFF::List::WriteChunk
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
RIFF::List::DeleteSubChunk
void DeleteSubChunk(Chunk *pSubChunk)
Removes a sub chunk.
Definition RIFF.cpp:1591
RIFF::List::GetSubListAt
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
RIFF::List::CountSubChunks
size_t CountSubChunks()
Returns number of subchunks within the list (including list chunks).
Definition RIFF.cpp:1423
RIFF::List::GetSubList
List * GetSubList(uint32_t ListType)
Returns sublist chunk with list type ListType within this chunk list.
Definition RIFF.cpp:1314
RIFF::List::GetNextSubChunk
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
RIFF::List::GetListType
uint32_t GetListType() const
Returns unsigned integer representation of the list's ID.
Definition RIFF.h:266
RIFF::List::GetListTypeString
String GetListTypeString() const
Returns string representation of the lists's id.
Definition RIFF.cpp:1810
RIFF::List::GetNextSubList
List * GetNextSubList()
Returns the next sublist (that is a subchunk with chunk ID "LIST") within the list.
Definition RIFF.cpp:1405
RIFF::List::AddSubChunk
Chunk * AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize)
Creates a new sub chunk.
Definition RIFF.cpp:1485
RIFF::List::__resetPos
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
RIFF::List::GetSubChunkAt
Chunk * GetSubChunkAt(size_t pos)
Returns subchunk at supplied pos position within this chunk list.
Definition RIFF.cpp:1256
RIFF
RIFF specific classes and definitions.
Definition RIFF.h:101
RIFF::libraryVersion
String libraryVersion()
Returns version of this C++ library.
Definition RIFF.cpp:2803
RIFF::stream_whence_t
stream_whence_t
File stream position dependent to these relations.
Definition RIFF.h:128
RIFF::stream_state_t
stream_state_t
Current state of the file stream.
Definition RIFF.h:121
RIFF::libraryName
String libraryName()
Returns the name of this C++ library.
Definition RIFF.cpp:2795
RIFF::offset_size_t
offset_size_t
Size of RIFF file offsets used in all RIFF chunks' headers.
Definition RIFF.h:149
RIFF::offset_size_64bit
@ offset_size_64bit
Always use 64 bit offsets (even for files smaller than 4 GB).
Definition RIFF.h:152
RIFF::offset_size_auto
@ 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
RIFF::offset_size_32bit
@ offset_size_32bit
Always use 32 bit offsets (even for files larger than 4 GB).
Definition RIFF.h:151
RIFF::stream_mode_t
stream_mode_t
Whether file stream is open in read or in read/write mode.
Definition RIFF.h:114
RIFF::layout_t
layout_t
General RIFF chunk structure of a RIFF file.
Definition RIFF.h:143
RIFF::layout_standard
@ 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
RIFF::layout_flat
@ layout_flat
Not a "real" RIFF file: First chunk in file is an ordinary data chunk, not a List chunk,...
Definition RIFF.h:145
RIFF::endian_t
endian_t
Alignment of data bytes in memory (system dependant).
Definition RIFF.h:136
RIFF::file_offset_t
uint64_t file_offset_t
Type used by libgig for handling file positioning during file I/O tasks.
Definition RIFF.h:111
RIFF::progress_t
Used for indicating the progress of a certain task.
Definition RIFF.h:167
RIFF::progress_t::__range_min
float __range_min
Only for internal usage, do not modify!
Definition RIFF.h:172
RIFF::progress_t::__private
void * __private
Only for internal usage, do not modify!
Definition RIFF.h:174
RIFF::progress_t::callback
void(* callback)(progress_t *)
Callback function pointer which has to be assigned to a function for progress notification.
Definition RIFF.h:168
RIFF::progress_t::factor
float factor
Reflects current progress as value between 0.0 and 1.0.
Definition RIFF.h:169
RIFF::progress_t::custom
void * custom
This pointer can be used for arbitrary data.
Definition RIFF.h:170
RIFF::progress_t::activity
const char * activity
Text which describes current ongoing action (e.g. to be displayed along a progress bar).
Definition RIFF.h:171
RIFF::progress_t::subdivide
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
RIFF::progress_t::__range_max
float __range_max
Only for internal usage, do not modify!
Definition RIFF.h:173