| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#include <boca.h> |
| 14 |
#include "dllinterface.h" |
| 15 |
|
| 16 |
namespace BoCA |
| 17 |
{ |
| 18 |
class SuperWorker : public Threads::Thread |
| 19 |
{ |
| 20 |
friend CA::OSStatus AudioConverterComplexInputDataProc(CA::AudioConverterRef, CA::UInt32 *, CA::AudioBufferList *, CA::AudioStreamPacketDescription **, void *); |
| 21 |
|
| 22 |
private: |
| 23 |
Threads::Semaphore processSignal; |
| 24 |
Threads::Semaphore readySignal; |
| 25 |
|
| 26 |
CA::AudioConverterRef converter; |
| 27 |
CA::AudioBufferList *buffers; |
| 28 |
|
| 29 |
Format format; |
| 30 |
|
| 31 |
Int frameSize; |
| 32 |
Int sampleRate; |
| 33 |
|
| 34 |
Buffer<unsigned char> samplesBuffer; |
| 35 |
CA::UInt32 bufferSize; |
| 36 |
Int bytesConsumed; |
| 37 |
|
| 38 |
Buffer<unsigned char> suppliedData; |
| 39 |
|
| 40 |
Buffer<unsigned char> packetBuffer; |
| 41 |
Array<Int> packetSizes; |
| 42 |
Array<CA::AudioStreamPacketDescription *> packetInfos; |
| 43 |
|
| 44 |
Bool flush; |
| 45 |
Bool quit; |
| 46 |
|
| 47 |
Int Run(); |
| 48 |
public: |
| 49 |
SuperWorker(const Config *, const Format &); |
| 50 |
~SuperWorker(); |
| 51 |
|
| 52 |
Void Encode(const Buffer<unsigned char> &, Int, Int, Bool); |
| 53 |
Void WaitUntilReady(); |
| 54 |
|
| 55 |
Int Quit(); |
| 56 |
|
| 57 |
const Buffer<unsigned char> &GetPackets() const { return packetBuffer; }; |
| 58 |
const Array<Int> &GetPacketSizes() const { return packetSizes; }; |
| 59 |
const Array<CA::AudioStreamPacketDescription *> &GetPacketInfos() const { return packetInfos; }; |
| 60 |
|
| 61 |
CA::AudioConverterPrimeInfo GetPrimeInfo() const; |
| 62 |
unsigned char *GetMagicCookie(CA::UInt32 *) const; |
| 63 |
|
| 64 |
static Int GetOutputSampleRate(CA::UInt32, Int); |
| 65 |
}; |
| 66 |
}; |