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