| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#include <boca.h> |
| 14 |
#include "dllinterface.h" |
| 15 |
|
| 16 |
BoCA_BEGIN_COMPONENT(DecoderMAD) |
| 17 |
|
| 18 |
namespace BoCA |
| 19 |
{ |
| 20 |
class DecoderMAD : public CS::DecoderComponent |
| 21 |
{ |
| 22 |
friend mad_flow MADInputCallback(void *, mad_stream *); |
| 23 |
friend mad_flow MADOutputCallback(void *, const mad_header *, mad_pcm *); |
| 24 |
friend mad_flow MADHeaderCallback(void *, const mad_header *, mad_pcm *); |
| 25 |
friend mad_flow MADErrorCallback(void *, mad_stream *, mad_frame *); |
| 26 |
|
| 27 |
private: |
| 28 |
ConfigLayer *configLayer; |
| 29 |
|
| 30 |
Bool stop; |
| 31 |
Bool finishing; |
| 32 |
Bool finished; |
| 33 |
|
| 34 |
Buffer<unsigned char> inputBuffer; |
| 35 |
Buffer<signed int> samplesBuffer; |
| 36 |
|
| 37 |
Track *infoTrack; |
| 38 |
|
| 39 |
Int64 numBytes; |
| 40 |
Int64 numFrames; |
| 41 |
|
| 42 |
Int delaySamples; |
| 43 |
Int padSamples; |
| 44 |
|
| 45 |
Int delaySamplesLeft; |
| 46 |
|
| 47 |
Int offset; |
| 48 |
|
| 49 |
Threads::Thread *decoderThread; |
| 50 |
|
| 51 |
Threads::Semaphore samplesRequestedSignal; |
| 52 |
Threads::Semaphore samplesAvailableSignal; |
| 53 |
|
| 54 |
Bool SkipID3v2Tag(IO::InStream &); |
| 55 |
Bool ParseVBRHeaders(IO::InStream &); |
| 56 |
|
| 57 |
Int ReadMAD(Bool); |
| 58 |
public: |
| 59 |
static const String &GetComponentSpecs(); |
| 60 |
|
| 61 |
DecoderMAD(); |
| 62 |
~DecoderMAD(); |
| 63 |
|
| 64 |
Bool CanOpenStream(const String &); |
| 65 |
Error GetStreamInfo(const String &, Track &); |
| 66 |
|
| 67 |
Bool Activate(); |
| 68 |
Bool Deactivate(); |
| 69 |
|
| 70 |
Int ReadData(Buffer<UnsignedByte> &); |
| 71 |
|
| 72 |
ConfigLayer *GetConfigurationLayer(); |
| 73 |
}; |
| 74 |
}; |
| 75 |
|
| 76 |
BoCA_DEFINE_DECODER_COMPONENT(DecoderMAD) |
| 77 |
|
| 78 |
BoCA_END_COMPONENT(DecoderMAD) |