Debian Codegraph @

components/encoder/coreaudio/worker.h

raw symbols SCIP
1 /* BoCA - BonkEnc Component Architecture
2 * Copyright (C) 2007-2020 Robert Kausch <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation, either version 2 of
7 * the License, or (at your option) any later version.
8 *
9 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
10 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
11 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
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 };