File: APECompress.h

package info (click to toggle)
libjmac-java 1.74-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,780 kB
  • sloc: java: 9,279; cpp: 4,375; xml: 369; makefile: 31; sh: 12
file content (56 lines) | stat: -rw-r--r-- 2,169 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef APE_APECOMPRESS_H
#define APE_APECOMPRESS_H

#include "MACLib.h"
class CAPECompressCreate;

/*************************************************************************************************
CAPECompress - uses the CAPECompressHub to provide a simpler compression interface (with buffering, etc)
*************************************************************************************************/
class CAPECompress : public IAPECompress
{
public:

    CAPECompress();
    ~CAPECompress();

    // start encoding
    int Start(const wchar_t * pOutputFilename, const WAVEFORMATEX * pwfeInput, int nMaxAudioBytes, int nCompressionLevel = COMPRESSION_LEVEL_NORMAL, const void * pHeaderData = NULL, int nHeaderBytes = CREATE_WAV_HEADER_ON_DECOMPRESSION);
    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);
    
    // add data / compress data

    // allows linear, immediate access to the buffer (fast)
    int GetBufferBytesAvailable();
    int UnlockBuffer(int nBytesAdded, BOOL bProcess = TRUE);
    unsigned char * LockBuffer(int * pBytesAvailable);
    
    // slower, but easier than locking and unlocking (copies data)
    int AddData(unsigned char * pData, int nBytes);
    
    // use a CIO (input source) to add data
    int AddDataFromInputSource(CInputSource * pInputSource, int nMaxBytes = -1, int * pBytesAdded = NULL);
    
    // finish / kill
    int Finish(unsigned char * pTerminatingData, int nTerminatingBytes, int nWAVTerminatingBytes);
    int Kill();
    
private:
    
    int    ProcessBuffer(BOOL bFinalize = FALSE);
    
    CSmartPtr<CAPECompressCreate> m_spAPECompressCreate;

    int                m_nBufferHead;
    int                m_nBufferTail;
    int                m_nBufferSize;
    unsigned char * m_pBuffer;
    BOOL            m_bBufferLocked;

    CIO    *            m_pioOutput;
    BOOL            m_bOwnsOutputIO;
    WAVEFORMATEX    m_wfeInput;

};

#endif // #ifndef APE_APECOMPRESS_H