Bug 853360 - Implement the coneGain part of the AudioPannerNode. r=roc
[gecko.git] / netwerk / streamconv / src / nsAppleFileDecoder.h
blobd9774b7a36d9e918952bc2d8a17644dba6d4fa18
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsAppleFileDecoder_h__
7 #define nsAppleFileDecoder_h__
9 #include "nsIAppleFileDecoder.h"
10 #include "nsILocalFileMac.h"
13 ** applefile definitions used
15 #if PRAGMA_STRUCT_ALIGN
16 #pragma options align=mac68k
17 #endif
19 #define APPLESINGLE_MAGIC 0x00051600L
20 #define APPLEDOUBLE_MAGIC 0x00051607L
21 #define VERSION 0x00020000
23 #define NUM_ENTRIES 6
25 #define ENT_DFORK 1L
26 #define ENT_RFORK 2L
27 #define ENT_NAME 3L
28 #define ENT_COMMENT 4L
29 #define ENT_DATES 8L
30 #define ENT_FINFO 9L
32 #define CONVERT_TIME 1265437696L
35 ** data type used in the header decoder.
37 typedef struct ap_header
39 int32_t magic;
40 int32_t version;
41 int32_t fill[4];
42 int16_t entriesCount;
44 } ap_header;
46 typedef struct ap_entry
48 int32_t id;
49 int32_t offset;
50 int32_t length;
52 } ap_entry;
54 typedef struct ap_dates
56 int32_t create, modify, backup, access;
58 } ap_dates;
60 #if PRAGMA_STRUCT_ALIGN
61 #pragma options align=reset
62 #endif
65 **Error codes
67 enum {
68 errADNotEnoughData = -12099,
69 errADNotSupported,
70 errADBadVersion
74 class nsAppleFileDecoder : public nsIAppleFileDecoder
76 public:
77 NS_DECL_ISUPPORTS
78 NS_DECL_NSIOUTPUTSTREAM
79 NS_DECL_NSIAPPLEFILEDECODER
81 nsAppleFileDecoder();
82 virtual ~nsAppleFileDecoder();
84 private:
85 #define MAX_BUFFERSIZE 1024
86 enum ParserState {parseHeaders, parseEntries, parseLookupPart, parsePart, parseSkipPart,
87 parseDataFork, parseResourceFork, parseWriteThrough};
89 nsCOMPtr<nsIOutputStream> m_output;
90 FSSpec m_fsFileSpec;
91 SInt16 m_rfRefNum;
93 unsigned char * m_dataBuffer;
94 int32_t m_dataBufferLength;
95 ParserState m_state;
96 ap_header m_headers;
97 ap_entry * m_entries;
98 int32_t m_offset;
99 int32_t m_dataForkOffset;
100 int32_t m_totalDataForkWritten;
101 int32_t m_totalResourceForkWritten;
102 bool m_headerOk;
104 int32_t m_currentPartID;
105 int32_t m_currentPartLength;
106 int32_t m_currentPartCount;
108 Str255 m_comment;
109 ap_dates m_dates;
110 FInfo m_finderInfo;
111 FXInfo m_finderExtraInfo;
114 #endif