xref: /haiku/src/add-ons/media/plugins/ape_reader/APEReader.h (revision adb0d19d561947362090081e81d90dde59142026)
1 #ifndef	___APEReader_H_
2 #define	___APEReader_H_
3 //------------------------------------------------------------------------------
4 // BeOS
5 // MAC
6 #include "MACLib.h"
7 #include "MonkeysAudioMIMEType.h"
8 #include "PositionBridgeIO.h"
9 // Proj
10 #include "ReaderPlugin.h"		// Haiku private header
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 class	TAPEReader : public Reader
17 {
18 public:
19 	TAPEReader();
20 	virtual	~TAPEReader();
21 
22 	virtual	const char*	Copyright();
23 
24 	virtual	status_t	Sniff(int32* oStreamCount);
25 
26 	virtual	void		GetFileFormatInfo(media_file_format* oMFF);
27 
28 	virtual	status_t	AllocateCookie(int32 oStreamNumber, void** oCookie);
29 	virtual	status_t	FreeCookie(void* oCookie);
30 
31 	virtual	status_t	GetStreamInfo(void* oCookie, int64* oFrameCount, bigtime_t* oDuration, media_format* oFormat,
32 								const void** oInfoBuffer, size_t* oInfoSize);
33 
34 	virtual	status_t		Seek(void *cookie, uint32 flags,
35 					 			int64 *frame, bigtime_t *time);
36 
37 	virtual	status_t		FindKeyFrame(void* cookie, uint32 flags,
38 								int64* frame, bigtime_t* time);
39 
40 	virtual	status_t	GetNextChunk(void* oCookie, const void** oChunkBuffer, size_t* oChunkSize, media_header* oMediaHeader);
41 
42 private:
43 	typedef	Reader	SUPER;
44 
45 	bigtime_t			CurrentTime() const;
46 	status_t			LoadAPECheck() const;
47 	status_t			ReadBlocks();
48 	void				Unset();
49 
50 	char*				mDecodedData;				// data after decoding
51 	int64				mDataSize;
52 	int64				mPlayPos;
53 	int64				mReadPos;
54 	int64				mReadPosTotal;
55 	status_t			mLoadAPECheck;
56 	BPositionIO*		mSrcPIO;
57 	IAPEDecompress*		mDecomp;
58 	TPositionBridgeIO	mPositionBridgeIO;
59 };
60 //==============================================================================
61 class	TAPEReaderPlugin : public ReaderPlugin
62 {
63 public:
64 	TAPEReaderPlugin();
65 	virtual	~TAPEReaderPlugin();
66 
67 	virtual	Reader*	NewReader();
68 };
69 //==============================================================================
70 MediaPlugin*	instantiate_plugin();
71 //==============================================================================
72 #endif	// ___APEReader_H_
73