| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#include <boca.h> |
| 14 |
#include "worker.h" |
| 15 |
|
| 16 |
BoCA_BEGIN_COMPONENT(EncoderCoreAudio) |
| 17 |
|
| 18 |
namespace BoCA |
| 19 |
{ |
| 20 |
class EncoderCoreAudio : public CS::EncoderComponent |
| 21 |
{ |
| 22 |
friend CA::OSStatus AudioFileReadProc(void *, CA::SInt64, CA::UInt32, void *, CA::UInt32 *); |
| 23 |
friend CA::OSStatus AudioFileWriteProc(void *, CA::SInt64, CA::UInt32, const void *, CA::UInt32 *); |
| 24 |
friend CA::SInt64 AudioFileGetSizeProc(void *); |
| 25 |
friend CA::OSStatus AudioFileSetSizeProc(void *, CA::SInt64); |
| 26 |
|
| 27 |
private: |
| 28 |
ConfigLayer *configLayer; |
| 29 |
Config *config; |
| 30 |
|
| 31 |
Array<SuperWorker *> workers; |
| 32 |
|
| 33 |
CA::AudioFileID audioFile; |
| 34 |
|
| 35 |
CA::UInt32 fileType; |
| 36 |
|
| 37 |
UnsignedInt dataOffset; |
| 38 |
|
| 39 |
Buffer<unsigned char> samplesBuffer; |
| 40 |
|
| 41 |
Int nextWorker; |
| 42 |
|
| 43 |
Int frameSize; |
| 44 |
|
| 45 |
Int blockSize; |
| 46 |
Int overlap; |
| 47 |
|
| 48 |
Int packetsWritten; |
| 49 |
Int packetsMissing; |
| 50 |
|
| 51 |
Int64 totalSamples; |
| 52 |
|
| 53 |
Int EncodeFrames(Bool); |
| 54 |
Int ProcessPackets(const Buffer<unsigned char> &, const Array<Int> &, const Array<CA::AudioStreamPacketDescription *> &, Bool, Bool); |
| 55 |
|
| 56 |
Bool FixupDurationAtoms(Int64, IO::InStream &, IO::OutStream &, Int64, Bool = False); |
| 57 |
|
| 58 |
static Bool ConvertArguments(Config *); |
| 59 |
public: |
| 60 |
static const String &GetComponentSpecs(); |
| 61 |
|
| 62 |
EncoderCoreAudio(); |
| 63 |
~EncoderCoreAudio(); |
| 64 |
|
| 65 |
Bool IsLossless() const; |
| 66 |
|
| 67 |
Bool Activate(); |
| 68 |
Bool Deactivate(); |
| 69 |
|
| 70 |
Int WriteData(Buffer<UnsignedByte> &); |
| 71 |
|
| 72 |
Bool SetOutputFormat(Int); |
| 73 |
String GetOutputFileExtension() const; |
| 74 |
|
| 75 |
ConfigLayer *GetConfigurationLayer(); |
| 76 |
}; |
| 77 |
}; |
| 78 |
|
| 79 |
BoCA_DEFINE_ENCODER_COMPONENT(EncoderCoreAudio) |
| 80 |
|
| 81 |
BoCA_END_COMPONENT(EncoderCoreAudio) |