xref: /haiku/src/add-ons/media/plugins/ape_reader/MAClib/APEHeader.h (revision 17889a8c70dbb3d59c1412f6431968753c767bab)
1 #ifndef APE_HEADER_H
2 #define APE_HEADER_H
3 
4 /*****************************************************************************************
5 APE header that all APE files have in common (old and new)
6 *****************************************************************************************/
7 struct APE_COMMON_HEADER
8 {
9     char cID[4];                            // should equal 'MAC '
10     uint16 nVersion;                        // version number * 1000 (3.81 = 3810)
11 };
12 
13 /*****************************************************************************************
14 APE header structure for old APE files (3.97 and earlier)
15 *****************************************************************************************/
16 struct APE_HEADER_OLD
17 {
18     char cID[4];                            // should equal 'MAC '
19     uint16 nVersion;                        // version number * 1000 (3.81 = 3810)
20     uint16 nCompressionLevel;               // the compression level
21     uint16 nFormatFlags;                    // any format flags (for future use)
22     uint16 nChannels;                       // the number of channels (1 or 2)
23     uint32 nSampleRate;                     // the sample rate (typically 44100)
24     uint32 nHeaderBytes;                    // the bytes after the MAC header that compose the WAV header
25     uint32 nTerminatingBytes;               // the bytes after that raw data (for extended info)
26     uint32 nTotalFrames;                    // the number of frames in the file
27     uint32 nFinalFrameBlocks;               // the number of samples in the final frame
28 };
29 
30 struct APE_FILE_INFO;
31 class CIO;
32 
33 /*****************************************************************************************
34 CAPEHeader - makes managing APE headers a little smoother (and the format change as of 3.98)
35 *****************************************************************************************/
36 class CAPEHeader
37 {
38 
39 public:
40 
41     CAPEHeader(CIO * pIO);
42     ~CAPEHeader();
43 
44     int Analyze(APE_FILE_INFO * pInfo);
45 
46 protected:
47 
48     int AnalyzeCurrent(APE_FILE_INFO * pInfo);
49     int AnalyzeOld(APE_FILE_INFO * pInfo);
50 
51     int FindDescriptor(BOOL bSeek);
52 
53     CIO * m_pIO;
54 };
55 
56 #endif // #ifndef APE_HEADER_H
57 
58