/[svn]/libgig/trunk/src/RIFF.h
ViewVC logotype

Diff of /libgig/trunk/src/RIFF.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1095 by schoenebeck, Mon Mar 12 18:16:55 2007 UTC revision 3198 by schoenebeck, Sun May 21 12:46:05 2017 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file access library    *   *   libgig - C++ cross-platform Gigasampler format file access library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003-2007 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2017 by Christian Schoenebeck                      *
6   *                              <cuse@users.sourceforge.net>               *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
# Line 39  Line 39 
39  #include <string>  #include <string>
40  #include <list>  #include <list>
41  #include <map>  #include <map>
42    #include <set>
43  #include <iostream>  #include <iostream>
44    #include <stdarg.h>
45    
46  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
47  # include <config.h>  # include <config.h>
# Line 52  Line 54 
54  # include <unistd.h>  # include <unistd.h>
55  #endif // POSIX  #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>  #include <stdint.h>
69    #endif
70    
71  #ifdef WIN32  #ifdef WIN32
72  # include "../win32/libgig_private.h" // like config.h, automatically generated by Dev-C++  # 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>  # include <windows.h>
76    typedef unsigned int   uint;    typedef unsigned int   uint;
   typedef unsigned char  uint8_t;  
   typedef unsigned short uint16_t;  
   typedef unsigned int   uint32_t;  
 # define PACKAGE "libgig"  
 # define VERSION VER_STRING // VER_STRING defined in libgig_private.h  
77  #endif // WIN32  #endif // WIN32
78    
79  #include <stdio.h>  #include <stdio.h>
# Line 71  Line 82 
82  # define CHUNK_ID_RIFF  0x52494646  # define CHUNK_ID_RIFF  0x52494646
83  # define CHUNK_ID_RIFX  0x52494658  # define CHUNK_ID_RIFX  0x52494658
84  # define CHUNK_ID_LIST  0x4C495354  # 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  #else  // little endian
98  # define CHUNK_ID_RIFF  0x46464952  # define CHUNK_ID_RIFF  0x46464952
99  # define CHUNK_ID_RIFX  0x58464952  # define CHUNK_ID_RIFX  0x58464952
100  # define CHUNK_ID_LIST  0x5453494C  # define CHUNK_ID_LIST  0x5453494C
 #endif // WORDS_BIGENDIAN  
101    
102  #define CHUNK_HEADER_SIZE       8  # define LIST_TYPE_INFO 0x4F464E49
103  #define LIST_HEADER_SIZE        12  # define CHUNK_ID_ICMT  0x544D4349
104  #define RIFF_HEADER_SIZE        12  # 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  /** RIFF specific classes and definitions */  #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    
119    /**
120     * @brief RIFF specific classes and definitions
121     *
122     * The Resource Interchange File Format (RIFF) is a generic tree-structured
123     * meta-format which stores data in so called "chunks". It can be compared
124     * to XML, but in contrast to XML, RIFF is entirely binary encoded, that is
125     * not ASCII based. RIFF is used as basis for many file formats like AVI,
126     * WAV, DLS and of course the Gigasampler file format. ;-)
127     *
128     * RIFF chunks can be seen as containers for data. There are two distinct
129     * types of chunks:
130     *
131     * - @e ordinary @e chunks are the leafs of the data tree which encapsulate
132     *   the actual data of the file (i.e. the sample data of a .wav file)
133     *
134     * - @e list @e chunks are the nodes of the data tree which hold an
135     *   arbitrary amount of subchunks (can be both, list chunks and/or ordinary
136     *   chunks)
137     */
138  namespace RIFF {  namespace RIFF {
139    
140      /* just symbol prototyping */      /* just symbol prototyping */
# Line 92  namespace RIFF { Line 144  namespace RIFF {
144    
145      typedef std::string String;      typedef std::string String;
146    
147        /** Type used by libgig for handling file positioning during file I/O tasks. */
148        typedef uint64_t file_offset_t;
149    
150      /** Whether file stream is open in read or in read/write mode. */      /** Whether file stream is open in read or in read/write mode. */
151      typedef enum {      typedef enum {
152          stream_mode_read       = 0,          stream_mode_read       = 0,
# Line 114  namespace RIFF { Line 169  namespace RIFF {
169          stream_end      = 3          stream_end      = 3
170      } stream_whence_t;      } stream_whence_t;
171    
172      /** Provides convenient methods to access data of RIFF chunks in general. */      /** Alignment of data bytes in memory (system dependant). */
173        typedef enum {
174            endian_little = 0,
175            endian_big    = 1,
176            endian_native = 2
177        } endian_t;
178    
179        /** General RIFF chunk structure of a RIFF file. */
180        enum layout_t {
181            layout_standard = 0, ///< Standard RIFF file layout: First chunk in file is a List chunk which contains all other chunks and there are no chunks outside the scope of that very first (List) chunk.
182            layout_flat     = 1  ///< Not a "real" RIFF file: First chunk in file is an ordinary data chunk, not a List chunk, and there might be other chunks after that first chunk.
183        };
184    
185        /** Size of RIFF file offsets used in all RIFF chunks' headers. @see File::GetFileOffsetSize() */
186        enum offset_size_t {
187            offset_size_auto  = 0, ///< Use 32 bit offsets for files smaller than 4 GB, use 64 bit offsets for files equal or larger than 4 GB.
188            offset_size_32bit = 4, ///< Always use 32 bit offsets (even for files larger than 4 GB).
189            offset_size_64bit = 8  ///< Always use 64 bit offsets (even for files smaller than 4 GB).
190        };
191    
192        /**
193         * @brief Used for indicating the progress of a certain task.
194         *
195         * The function pointer argument has to be supplied with a valid
196         * function of the given signature which will then be called on
197         * progress changes. An equivalent progress_t structure will be passed
198         * back as argument to the callback function on each progress change.
199         * The factor field of the supplied progress_t structure will then
200         * reflect the current progress as value between 0.0 and 1.0. You might
201         * want to use the custom field for data needed in your callback
202         * function.
203         */
204        struct progress_t {
205            void (*callback)(progress_t*); ///< Callback function pointer which has to be assigned to a function for progress notification.
206            float factor;                  ///< Reflects current progress as value between 0.0 and 1.0.
207            void* custom;                  ///< This pointer can be used for arbitrary data.
208            float __range_min;             ///< Only for internal usage, do not modify!
209            float __range_max;             ///< Only for internal usage, do not modify!
210            progress_t();
211        };
212    
213        /** @brief Ordinary RIFF Chunk
214         *
215         * Provides convenient methods to access data of ordinary RIFF chunks
216         * in general.
217         */
218      class Chunk {      class Chunk {
219          public:          public:
220              Chunk(File* pFile, unsigned long StartPos, List* Parent);              Chunk(File* pFile, file_offset_t StartPos, List* Parent);
221              String         GetChunkIDString();              String         GetChunkIDString() const;
222              uint32_t       GetChunkID() { return ChunkID; };            ///< Chunk ID in unsigned integer representation.              uint32_t       GetChunkID() const { return ChunkID; }       ///< Chunk ID in unsigned integer representation.
223              List*          GetParent()  { return pParent; };            ///< Returns pointer to the chunk's parent list chunk.              File*          GetFile() const    { return pFile;   }       ///< Returns pointer to the chunk's File object.
224              unsigned long  GetSize()    { return CurrentChunkSize; };   ///< Chunk size in bytes (without header, thus the chunk data body)              List*          GetParent() const  { return pParent; }       ///< Returns pointer to the chunk's parent list chunk.
225              unsigned long  GetNewSize() { return NewChunkSize;     };   ///< New chunk size if it was modified with Resize().              file_offset_t  GetSize() const { return ullCurrentChunkSize; } ///< Chunk size in bytes (without header, thus the chunk data body)
226              unsigned long  GetPos()     { return ulPos; };              ///< Position within the chunk data body              file_offset_t  GetNewSize() const { return ullNewChunkSize; } ///< New chunk size if it was modified with Resize(), otherwise value returned will be equal to GetSize().
227              unsigned long  GetFilePos() { return ulStartPos + ulPos; }; ///< Current, actual offset in file.              file_offset_t  GetPos() const { return ullPos; }            ///< Position within the chunk data body (starting with 0).
228              unsigned long  SetPos(unsigned long Where, stream_whence_t Whence = stream_start);              file_offset_t  GetFilePos() const { return ullStartPos + ullPos; } ///< Current, actual offset of chunk data body start in file.
229              unsigned long  RemainingBytes();              file_offset_t  SetPos(file_offset_t Where, stream_whence_t Whence = stream_start);
230              stream_state_t GetState();              file_offset_t  RemainingBytes() const;
231              unsigned long  Read(void* pData, unsigned long WordCount, unsigned long WordSize);              stream_state_t GetState() const;
232              unsigned long  ReadInt8(int8_t* pData,     unsigned long WordCount = 1);              file_offset_t  Read(void* pData, file_offset_t WordCount, file_offset_t WordSize);
233              unsigned long  ReadUint8(uint8_t* pData,   unsigned long WordCount = 1);              file_offset_t  ReadInt8(int8_t* pData,     file_offset_t WordCount = 1);
234              unsigned long  ReadInt16(int16_t* pData,   unsigned long WordCount = 1);              file_offset_t  ReadUint8(uint8_t* pData,   file_offset_t WordCount = 1);
235              unsigned long  ReadUint16(uint16_t* pData, unsigned long WordCount = 1);              file_offset_t  ReadInt16(int16_t* pData,   file_offset_t WordCount = 1);
236              unsigned long  ReadInt32(int32_t* pData,   unsigned long WordCount = 1);              file_offset_t  ReadUint16(uint16_t* pData, file_offset_t WordCount = 1);
237              unsigned long  ReadUint32(uint32_t* pData, unsigned long WordCount = 1);              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();              int8_t         ReadInt8();
240              uint8_t        ReadUint8();              uint8_t        ReadUint8();
241              int16_t        ReadInt16();              int16_t        ReadInt16();
242              uint16_t       ReadUint16();              uint16_t       ReadUint16();
243              int32_t        ReadInt32();              int32_t        ReadInt32();
244              uint32_t       ReadUint32();              uint32_t       ReadUint32();
245              unsigned long  Write(void* pData, unsigned long WordCount, unsigned long WordSize);              void           ReadString(String& s, int size);
246              unsigned long  WriteInt8(int8_t* pData,     unsigned long WordCount = 1);              file_offset_t  Write(void* pData, file_offset_t WordCount, file_offset_t WordSize);
247              unsigned long  WriteUint8(uint8_t* pData,   unsigned long WordCount = 1);              file_offset_t  WriteInt8(int8_t* pData,     file_offset_t WordCount = 1);
248              unsigned long  WriteInt16(int16_t* pData,   unsigned long WordCount = 1);              file_offset_t  WriteUint8(uint8_t* pData,   file_offset_t WordCount = 1);
249              unsigned long  WriteUint16(uint16_t* pData, unsigned long WordCount = 1);              file_offset_t  WriteInt16(int16_t* pData,   file_offset_t WordCount = 1);
250              unsigned long  WriteInt32(int32_t* pData,   unsigned long WordCount = 1);              file_offset_t  WriteUint16(uint16_t* pData, file_offset_t WordCount = 1);
251              unsigned long  WriteUint32(uint32_t* pData, unsigned long WordCount = 1);              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();              void*          LoadChunkData();
254              void           ReleaseChunkData();              void           ReleaseChunkData();
255              void           Resize(int iNewSize);              void           Resize(file_offset_t NewSize);
256              virtual ~Chunk();              virtual ~Chunk();
257          protected:          protected:
258              uint32_t      ChunkID;              uint32_t      ChunkID;
259              uint32_t      CurrentChunkSize;             /* in bytes */              file_offset_t ullCurrentChunkSize;          /* in bytes */
260              uint32_t      NewChunkSize;                 /* in bytes (if chunk was scheduled to be resized) */              file_offset_t ullNewChunkSize;                      /* in bytes (if chunk was scheduled to be resized) */
261              List*         pParent;              List*         pParent;
262              File*         pFile;              File*         pFile;
263              unsigned long ulStartPos;           /* actual position in file where chunk (without header) starts */              file_offset_t ullStartPos;  /* actual position in file where chunk data (without header) starts */
264              unsigned long ulPos;                /* # of bytes from ulStartPos */              file_offset_t ullPos;       /* # of bytes from ulStartPos */
265              uint8_t*      pChunkData;              uint8_t*      pChunkData;
266              unsigned long ulChunkDataSize;              file_offset_t ullChunkDataSize;
267    
268              Chunk(File* pFile);              Chunk(File* pFile);
269              Chunk(File* pFile, List* pParent, uint32_t uiChunkID, uint uiBodySize);              Chunk(File* pFile, List* pParent, uint32_t uiChunkID, file_offset_t ullBodySize);
270              void          ReadHeader(unsigned long fPos);              void ReadHeader(file_offset_t filePos);
271              void          WriteHeader(unsigned long fPos);              void WriteHeader(file_offset_t filePos);
272              unsigned long ReadSceptical(void* pData, unsigned long WordCount, unsigned long WordSize);              file_offset_t ReadSceptical(void* pData, file_offset_t WordCount, file_offset_t WordSize);
273              inline void   swapBytes_16(void* Word) {              inline static String convertToString(uint32_t word) {
                 uint8_t byteCache = *((uint8_t*) Word);  
                 *((uint8_t*) Word)     = *((uint8_t*) Word + 1);  
                 *((uint8_t*) Word + 1) = byteCache;  
             }  
             inline void   swapBytes_32(void* Word) {  
                 uint8_t byteCache = *((uint8_t*) Word);  
                 *((uint8_t*) Word)     = *((uint8_t*) Word + 3);  
                 *((uint8_t*) Word + 3) = byteCache;  
                 byteCache = *((uint8_t*) Word + 1);  
                 *((uint8_t*) Word + 1) = *((uint8_t*) Word + 2);  
                 *((uint8_t*) Word + 2) = byteCache;  
             }  
             inline void   swapBytes(void* Word, unsigned long WordSize) {  
                 uint8_t byteCache;  
                 unsigned long lo = 0, hi = WordSize - 1;  
                 for (; lo < hi; hi--, lo++) {  
                     byteCache = *((uint8_t*) Word + lo);  
                     *((uint8_t*) Word + lo) = *((uint8_t*) Word + hi);  
                     *((uint8_t*) Word + hi) = byteCache;  
                 }  
             }  
             inline String convertToString(uint32_t word) {  
274                  String result;                  String result;
275                  for (int i = 0; i < 4; i++) {                  for (int i = 0; i < 4; i++) {
276                      uint8_t byte = *((uint8_t*)(&word) + i);                      uint8_t byte = *((uint8_t*)(&word) + i);
# Line 199  namespace RIFF { Line 279  namespace RIFF {
279                  }                  }
280                  return result;                  return result;
281              }              }
282              virtual unsigned long WriteChunk(unsigned long ulWritePos, unsigned long ulCurrentDataOffset);              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(); ///< Sets Chunk's read/write position to zero.              virtual void __resetPos(); ///< Sets Chunk's read/write position to zero.
285    
286              friend class List;              friend class List;
287      };      };
288    
289      /** Provides convenient methods to access data of RIFF list chunks and their subchunks. */      /** @brief RIFF List Chunk
290         *
291         * Provides convenient methods to access data of RIFF list chunks and
292         * their subchunks.
293         */
294      class List : public Chunk {      class List : public Chunk {
295          public:          public:
296              List(File* pFile, unsigned long StartPos, List* Parent);              List(File* pFile, file_offset_t StartPos, List* Parent);
297              String       GetListTypeString();              String       GetListTypeString() const;
298              uint32_t     GetListType() { return ListType; }   ///< Returns unsigned integer representation of the list's ID              uint32_t     GetListType() const { return ListType; } ///< Returns unsigned integer representation of the list's ID
299              Chunk*       GetSubChunk(uint32_t ChunkID);              Chunk*       GetSubChunk(uint32_t ChunkID);
300              List*        GetSubList(uint32_t ListType);              List*        GetSubList(uint32_t ListType);
301              Chunk*       GetFirstSubChunk();              Chunk*       GetFirstSubChunk();
302              Chunk*       GetNextSubChunk();              Chunk*       GetNextSubChunk();
303              List*        GetFirstSubList();              List*        GetFirstSubList();
304              List*        GetNextSubList();              List*        GetNextSubList();
305              unsigned int CountSubChunks();              size_t       CountSubChunks();
306              unsigned int CountSubChunks(uint32_t ChunkID);              size_t       CountSubChunks(uint32_t ChunkID);
307              unsigned int CountSubLists();              size_t       CountSubLists();
308              unsigned int CountSubLists(uint32_t ListType);              size_t       CountSubLists(uint32_t ListType);
309              Chunk*       AddSubChunk(uint32_t uiChunkID, uint uiBodySize);              Chunk*       AddSubChunk(uint32_t uiChunkID, file_offset_t ullBodySize);
310              List*        AddSubList(uint32_t uiListType);              List*        AddSubList(uint32_t uiListType);
311              void         DeleteSubChunk(Chunk* pSubChunk);              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();              virtual ~List();
315          protected:          protected:
316              typedef std::map<uint32_t, RIFF::Chunk*>  ChunkMap;              typedef std::map<uint32_t, RIFF::Chunk*>  ChunkMap;
317              typedef std::list<Chunk*>                 ChunkList;              typedef std::list<Chunk*>                 ChunkList;
318                typedef std::set<Chunk*>                  ChunkSet;
319    
320              uint32_t   ListType;              uint32_t   ListType;
321              ChunkList* pSubChunks;              ChunkList* pSubChunks;
# Line 237  namespace RIFF { Line 325  namespace RIFF {
325    
326              List(File* pFile);              List(File* pFile);
327              List(File* pFile, List* pParent, uint32_t uiListID);              List(File* pFile, List* pParent, uint32_t uiListID);
328              void ReadHeader(unsigned long fPos);              void ReadHeader(file_offset_t filePos);
329              void WriteHeader(unsigned long fPos);              void WriteHeader(file_offset_t filePos);
330              void LoadSubChunks();              void LoadSubChunks(progress_t* pProgress = NULL);
331              void LoadSubChunksRecursively();              void LoadSubChunksRecursively(progress_t* pProgress = NULL);
332              virtual unsigned long WriteChunk(unsigned long ulWritePos, unsigned long ulCurrentDataOffset);              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(); ///< Sets List Chunk's read/write position to zero and causes all sub chunks to do the same.              virtual void __resetPos(); ///< Sets List Chunk's read/write position to zero and causes all sub chunks to do the same.
335                void DeleteChunkList();
336      };      };
337    
338      /** Parses arbitrary RIFF files and provides together with it's base classes convenient methods to walk through the RIFF tree. */      /** @brief RIFF File
339         *
340         * Handles arbitrary RIFF files and provides together with its base
341         * classes convenient methods to walk through, read and modify the
342         * file's RIFF tree.
343         */
344      class File : public List {      class File : public List {
345          public:          public:
346              File(uint32_t FileType);              File(uint32_t FileType);
347              File(const String& path);              File(const String& path);
348              stream_mode_t GetMode();              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);              bool          SetMode(stream_mode_t NewMode);
351              String GetFileName();              void SetByteOrder(endian_t Endian);
352              virtual void Save();              String GetFileName() const;
353              virtual void Save(const String& path);              void SetFileName(const String& path);
354                bool IsNew() const;
355                layout_t GetLayout() const;
356                file_offset_t GetCurrentFileSize() const;
357                file_offset_t GetRequiredFileSize();
358                file_offset_t GetRequiredFileSize(offset_size_t fileOffsetSize);
359                int GetFileOffsetSize() const;
360                int GetRequiredFileOffsetSize();
361    
362                virtual void Save(progress_t* pProgress = NULL);
363                virtual void Save(const String& path, progress_t* pProgress = NULL);
364              virtual ~File();              virtual ~File();
365          protected:          protected:
366              #if POSIX              #if POSIX
# Line 269  namespace RIFF { Line 375  namespace RIFF {
375              #endif // POSIX              #endif // POSIX
376              String Filename;              String Filename;
377              bool   bEndianNative;              bool   bEndianNative;
378                bool   bIsNewFile;
379                layout_t Layout; ///< An ordinary RIFF file is always set to layout_standard.
380                offset_size_t FileOffsetPreference;
381                int FileOffsetSize; ///< Size of file offsets (in bytes) when this file was opened (or saved the last time).
382    
             void LogAsResized(Chunk* pResizedChunk);  
             void UnlogResized(Chunk* pResizedChunk);  
383              friend class Chunk;              friend class Chunk;
384              friend class List;              friend class List;
385          private:          private:
386              stream_mode_t  Mode;              stream_mode_t  Mode;
             ChunkList      ResizedChunks; ///< All chunks which have been resized (enlarged / shortened).  
387    
388              unsigned long GetFileSize();              void __openExistingFile(const String& path, uint32_t* FileType = NULL);
389              void ResizeFile(unsigned long ulNewSize);              void ResizeFile(file_offset_t ullNewSize);
390              #if POSIX              #if POSIX
391              unsigned long __GetFileSize(int hFile);              file_offset_t __GetFileSize(int hFile) const;
392              #elif defined(WIN32)              #elif defined(WIN32)
393              unsigned long __GetFileSize(HANDLE hFile);              file_offset_t __GetFileSize(HANDLE hFile) const;
394              #else              #else
395              unsigned long __GetFileSize(FILE* hFile);              file_offset_t __GetFileSize(FILE* hFile) const;
396              #endif              #endif
397                int FileOffsetSizeFor(file_offset_t fileSize) const;
398                void Cleanup();
399      };      };
400    
401      /** Will be thrown whenever an error occurs while parsing a RIFF file. */      /**
402         * Will be thrown whenever an error occurs while handling a RIFF file.
403         */
404      class Exception {      class Exception {
405          public:          public:
406              String Message;              String Message;
407    
408              Exception(String Message) { Exception::Message = Message; };              Exception(String format, ...);
409                Exception(String format, va_list arg);
410              void PrintMessage();              void PrintMessage();
411              virtual ~Exception() {};              virtual ~Exception() {}
412    
413            protected:
414                Exception();
415                static String assemble(String format, va_list arg);
416      };      };
417    
418      String libraryName();      String libraryName();

Legend:
Removed from v.1095  
changed lines
  Added in v.3198

  ViewVC Help
Powered by ViewVC