1 #ifndef ___APEReader_H_ 2 #define ___APEReader_H_ 3 4 5 #include "MACLib.h" 6 #include "MonkeysAudioMIMEType.h" 7 #include "PositionBridgeIO.h" 8 9 #include "Reader.h" // Haiku private header 10 11 using namespace BCodecKit; 12 13 14 const int32 BLOCK_COUNT = 1024*4; // number of blocks, get from MACLib at once 15 const int32 BUFFER_SIZE = 1024*4; // size of audio data passing to Media Kit 16 const int32 MEDIA_FILE_FORMAT_VERSION = 100; // media_file_format::version 17 18 19 class TAPEReader : public BReader 20 { 21 public: 22 TAPEReader(); 23 virtual ~TAPEReader(); 24 25 virtual const char* Copyright(); 26 27 virtual status_t Sniff(int32* oStreamCount); 28 29 virtual void GetFileFormatInfo(media_file_format* oMFF); 30 31 virtual status_t AllocateCookie(int32 oStreamNumber, void** oCookie); 32 virtual status_t FreeCookie(void* oCookie); 33 34 virtual status_t GetStreamInfo(void* oCookie, int64* oFrameCount, 35 bigtime_t* oDuration, media_format* oFormat, 36 const void** oInfoBuffer, size_t* oInfoSize); 37 38 virtual status_t Seek(void *cookie, uint32 flags, 39 int64 *frame, bigtime_t *time); 40 41 virtual status_t FindKeyFrame(void* cookie, uint32 flags, 42 int64* frame, bigtime_t* time); 43 44 virtual status_t GetNextChunk(void* oCookie, const void** oChunkBuffer, 45 size_t* oChunkSize, media_header* oMediaHeader); 46 47 private: 48 typedef BReader SUPER; 49 50 bigtime_t CurrentTime() const; 51 status_t LoadAPECheck() const; 52 status_t ReadBlocks(); 53 void Unset(); 54 55 char* mDecodedData; // data after decoding 56 int64 mDataSize; 57 int64 mPlayPos; 58 int64 mReadPos; 59 int64 mReadPosTotal; 60 status_t mLoadAPECheck; 61 BPositionIO* mSrcPIO; 62 IAPEDecompress* mDecomp; 63 TPositionBridgeIO mPositionBridgeIO; 64 }; 65 66 67 class TAPEReaderPlugin : public BReaderPlugin 68 { 69 public: 70 TAPEReaderPlugin(); 71 virtual ~TAPEReaderPlugin(); 72 73 virtual BReader* NewReader(); 74 }; 75 76 77 #endif // ___APEReader_H_ 78