]> git.saurik.com Git - wxWidgets.git/blob - utils/wxMMedia/mmriff.h
fixed somebody's poorly done StreamSize-->GetSize transition
[wxWidgets.git] / utils / wxMMedia / mmriff.h
1 // /////////////////////////////////////////////////////////////////////////////
2 // Name: mmriff.h
3 // Purpose: wxMMedia
4 // Author: Guilhem Lavaux
5 // Created: 1998
6 // Updated:
7 // Copyright: (C) 1998, Guilhem Lavaux
8 // License: wxWindows license
9 // /////////////////////////////////////////////////////////////////////////////
10 /* Real -*- C++ -*- */
11 #ifndef __MM_riff_H__
12 #define __MM_riff_H__
13 #ifdef __GNUG__
14 #pragma interface
15 #endif
16
17 #include "mmtype.h"
18 #include "mmfile.h"
19
20 #define RIFF_READ 0
21 #define RIFF_WRITE 1
22 #define INVALID_CHUNK_LEN ((wxUint32)-1)
23
24 ///
25 class wxRiffCodec {
26 public:
27 ///
28 wxRiffCodec();
29 ///
30 wxRiffCodec(wxOutputStream& s);
31 ///
32 wxRiffCodec(wxInputStream& s);
33 ///
34 virtual ~wxRiffCodec();
35
36 ///
37 void SetFile(wxInputStream& s) { cout << "RIFF:SetFile(i)" << endl; riff_i_stream = &s; riff_o_stream = NULL; }
38 ///
39 void SetFile(wxOutputStream& s) { cout << "RIFF::SetFile(o)" << endl; riff_i_stream = NULL; riff_o_stream = &s; }
40
41 ///
42 bool Read32(wxUint32& i32);
43 ///
44 bool Read16(wxUint16& i16);
45 ///
46 bool ReadData(void *data, wxUint32 size);
47 ///
48 bool Skip(wxUint32 skip);
49
50 ///
51 bool Write32(wxUint32 i32);
52 ///
53 bool Write16(wxUint16 i16);
54 ///
55 bool WriteData(void *data, wxUint32 size);
56
57 ///
58 inline wxUint32 GetChunkLength() const { return chunk_length; }
59 ///
60 inline const wxString& GetChunkName() const { return m_chunk; }
61
62 ///
63 bool RiffReset(wxUint8 state);
64
65 ///
66 bool FindChunk(const wxString& name = "", bool from_here = FALSE);
67 ///
68 bool CreateChunk(const wxString& name, wxUint32 chunk_size);
69
70 ///
71 inline wxMMFileError GetError() const { return riff_error; }
72
73 protected:
74 wxInputStream *riff_i_stream;
75 wxOutputStream *riff_o_stream;
76 wxUint32 chunk_length;
77 wxMMFileError riff_error;
78 wxString m_chunk;
79 };
80
81 #endif