diff -r 1cbb0d5bf7f2 -r b6dbf97aba93 mmplugins/lib3gp/impl/inc/filewriter.h --- a/mmplugins/lib3gp/impl/inc/filewriter.h Thu Sep 16 18:39:58 2010 +0100 +++ b/mmplugins/lib3gp/impl/inc/filewriter.h Thu Sep 16 18:57:38 2010 +0100 @@ -21,10 +21,10 @@ #include "mp4atom.h" // CONSTANTS -const TInt KFileWriterBufferSizeSmall = 2048; -const TInt KFileWriterBufferSizeLarge = (2*65536); -const TInt KFileWriterSoftBufLimit = 10; -const TInt KFileWriterHardBufLimit = 15; +const TInt KFileWriterBufferSizeSmall = 65536; +const TInt KFileWriterBufferSizeLarge = (4*65536); +const TInt KFileWriterSoftBufLimit = 12; +const TInt KFileWriterHardBufLimit = 16; const TInt KFileWriterMinBufferCount = 4; // shouldn't be less than 4 // FORWARD DECLARATIONS @@ -50,7 +50,7 @@ /** * Two-phased constructor. */ - static CFileWriter* NewL( RFile64& aFile ); + static CFileWriter* NewL( RFile64& aFile, TInt aInitSetSize = 0, TInt aOutputBufferSizeSmall = KFileWriterBufferSizeSmall, TInt aOutputBufferSizeLarge = KFileWriterBufferSizeLarge ); /** * Destructor. @@ -89,7 +89,12 @@ * @since 3.0 * @param aHandle MP4Handle. */ - void SetOutputBufferCount( MP4Handle aHandle ); + void SetOutputBufferCount( MP4Handle aHandle ); + + inline TInt64 OutputFileSize() const + { + return iOutputFileSize; + } protected: // Functions from base classes @@ -108,7 +113,7 @@ /** * C++ default constructor. */ - CFileWriter(); + CFileWriter( TInt aInitSetSize, TInt aOutputBufferSizeSmall, TInt aOutputBufferSizeLarge ); /** * By default Symbian 2nd phase constructor is private. @@ -128,6 +133,12 @@ * @since 2.6 */ void AllocateBuffersL(); + + /** + * Updates output file size and reserves extra space for following writing if iSetSize is set. + * Takes into account if the position in the file was changed. + */ + void UpdateOutputFileSize(); private: // Whether we are flushing after async write. @@ -139,16 +150,24 @@ // Flag whether init has been done TBool iMemReadyForWriting; - // Write error code. - TInt iError; + // Write error code. + TInt iError; + + // Current set file size + TInt64 iSetSize; + // Current output file size + TInt64 iOutputFileSize; + + TInt iOutputBufferSizeSmall; + TInt iOutputBufferSizeLarge; + // Output buffer size. TInt iOutputBufferSize; // Hard limit for max output buffers TInt iMaxOutputBufHardLimit; // Soft limit for max output buffers TInt iMaxOutputBufSoftLimit; - // Current output file size - TInt64 iOutputFileSize; + // Output file for writes. RFile64* iOutputFile;