19 // INCLUDES |
19 // INCLUDES |
20 #include <e32base.h> |
20 #include <e32base.h> |
21 #include "mp4atom.h" |
21 #include "mp4atom.h" |
22 |
22 |
23 // CONSTANTS |
23 // CONSTANTS |
24 const TInt KFileWriterBufferSizeSmall = 2048; |
24 const TInt KFileWriterBufferSizeSmall = 65536; |
25 const TInt KFileWriterBufferSizeLarge = (2*65536); |
25 const TInt KFileWriterBufferSizeLarge = (4*65536); |
26 const TInt KFileWriterSoftBufLimit = 10; |
26 const TInt KFileWriterSoftBufLimit = 12; |
27 const TInt KFileWriterHardBufLimit = 15; |
27 const TInt KFileWriterHardBufLimit = 16; |
28 const TInt KFileWriterMinBufferCount = 4; // shouldn't be less than 4 |
28 const TInt KFileWriterMinBufferCount = 4; // shouldn't be less than 4 |
29 |
29 |
30 // FORWARD DECLARATIONS |
30 // FORWARD DECLARATIONS |
31 class RFile64; |
31 class RFile64; |
32 |
32 |
87 /** |
87 /** |
88 * Set file output buffer count |
88 * Set file output buffer count |
89 * @since 3.0 |
89 * @since 3.0 |
90 * @param aHandle MP4Handle. |
90 * @param aHandle MP4Handle. |
91 */ |
91 */ |
92 void SetOutputBufferCount( MP4Handle aHandle ); |
92 void SetOutputBufferCount( MP4Handle aHandle ); |
|
93 |
|
94 inline TInt64 OutputFileSize() const |
|
95 { |
|
96 return iOutputFileSize; |
|
97 } |
93 |
98 |
94 protected: // Functions from base classes |
99 protected: // Functions from base classes |
95 |
100 |
96 /** |
101 /** |
97 * From CActive Cancels async request. |
102 * From CActive Cancels async request. |
126 /** |
131 /** |
127 * Allocates input and output buffers. |
132 * Allocates input and output buffers. |
128 * @since 2.6 |
133 * @since 2.6 |
129 */ |
134 */ |
130 void AllocateBuffersL(); |
135 void AllocateBuffersL(); |
|
136 |
|
137 /** |
|
138 * Updates output file size and reserves extra space for following writing if iSetSize is set. |
|
139 * Takes into account if the position in the file was changed. |
|
140 */ |
|
141 void UpdateOutputFileSize(); |
131 |
142 |
132 private: |
143 private: |
133 // Whether we are flushing after async write. |
144 // Whether we are flushing after async write. |
134 TBool iFlush; |
145 TBool iFlush; |
135 // Flag whether there is async writing going. |
146 // Flag whether there is async writing going. |
137 // Flag whether we have received any data. |
148 // Flag whether we have received any data. |
138 TBool iWritingStarted; |
149 TBool iWritingStarted; |
139 // Flag whether init has been done |
150 // Flag whether init has been done |
140 TBool iMemReadyForWriting; |
151 TBool iMemReadyForWriting; |
141 |
152 |
142 // Write error code. |
153 // Write error code. |
143 TInt iError; |
154 TInt iError; |
|
155 |
|
156 // Current set file size |
|
157 TInt64 iSetSize; |
|
158 // Current output file size |
|
159 TInt64 iOutputFileSize; |
|
160 |
|
161 TInt iOutputBufferSizeSmall; |
|
162 TInt iOutputBufferSizeLarge; |
|
163 |
144 // Output buffer size. |
164 // Output buffer size. |
145 TInt iOutputBufferSize; |
165 TInt iOutputBufferSize; |
146 // Hard limit for max output buffers |
166 // Hard limit for max output buffers |
147 TInt iMaxOutputBufHardLimit; |
167 TInt iMaxOutputBufHardLimit; |
148 // Soft limit for max output buffers |
168 // Soft limit for max output buffers |
149 TInt iMaxOutputBufSoftLimit; |
169 TInt iMaxOutputBufSoftLimit; |
150 // Current output file size |
170 |
151 TInt64 iOutputFileSize; |
|
152 |
171 |
153 // Output file for writes. |
172 // Output file for writes. |
154 RFile64* iOutputFile; |
173 RFile64* iOutputFile; |
155 // Queue of empty write buffers. |
174 // Queue of empty write buffers. |
156 RPointerArray<HBufC8> iEmptyBufferQueue; |
175 RPointerArray<HBufC8> iEmptyBufferQueue; |