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