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