1 #ifndef APE_APECOMPRESS_H 2 #define APE_APECOMPRESS_H 3 4 #include "MACLib.h" 5 class CAPECompressCreate; 6 7 /************************************************************************************************* 8 CAPECompress - uses the CAPECompressHub to provide a simpler compression interface (with buffering, etc) 9 *************************************************************************************************/ 10 class CAPECompress : public IAPECompress 11 { 12 public: 13 14 CAPECompress(); 15 ~CAPECompress(); 16 17 // start encoding 18 int Start(const char* pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION); 19 int StartEx(CIO * pioOutput, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION); 20 21 // add data / compress data 22 23 // allows linear, immediate access to the buffer (fast) 24 int GetBufferBytesAvailable(); 25 int UnlockBuffer(int nBytesAdded, BOOL bProcess = TRUE); 26 unsigned char * LockBuffer(int * pBytesAvailable); 27 28 // slower, but easier than locking and unlocking (copies data) 29 int AddData(unsigned char * pData, int nBytes); 30 31 // use a CIO (input source) to add data 32 int AddDataFromInputSource(CInputSource * pInputSource, int nMaxBytes = -1, int * pBytesAdded = NULL); 33 34 // finish / kill 35 int Finish(unsigned char * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes); 36 int Kill(); 37 38 private: 39 40 int ProcessBuffer(BOOL bFinalize = FALSE); 41 42 CSmartPtr<CAPECompressCreate> m_spAPECompressCreate; 43 44 int m_nBufferHead; 45 int m_nBufferTail; 46 int m_nBufferSize; 47 unsigned char * m_pBuffer; 48 BOOL m_bBufferLocked; 49 50 CIO * m_pioOutput; 51 BOOL m_bOwnsOutputIO; 52 WAVEFORMATEX m_wfeInput; 53 54 }; 55 56 #endif // #ifndef APE_APECOMPRESS_H 57