xref: /haiku/headers/private/media/ReaderPlugin.h (revision f2ced752a08ff5d2618826bcd3ae3976c9f3e92e)
1 #ifndef _READER_PLUGIN_H
2 #define _READER_PLUGIN_H
3 
4 #include <MediaTrack.h>
5 #include "MediaPlugin.h"
6 
7 namespace BPrivate { namespace media {
8 
9 enum {
10 	B_MEDIA_SEEK_TO_TIME	= 0x10000,
11 	B_MEDIA_SEEK_TO_FRAME	= 0x20000
12 };
13 
14 class Reader
15 {
16 public:
17 						Reader();
18 	virtual				~Reader();
19 
20 	virtual const char *Copyright() = 0;
21 
22 	virtual status_t	Sniff(int32 *streamCount) = 0;
23 
24 	virtual void		GetFileFormatInfo(media_file_format *mff) = 0;
25 
26 	virtual status_t	AllocateCookie(int32 streamNumber, void **cookie) = 0;
27 	virtual	status_t	FreeCookie(void *cookie) = 0;
28 
29 	virtual status_t	GetStreamInfo(void *cookie, int64 *frameCount, bigtime_t *duration,
30 									  media_format *format, void **infoBuffer, int32 *infoSize) = 0;
31 
32 	virtual status_t	Seek(void *cookie,
33 							 uint32 seekTo,
34 							 int64 *frame, bigtime_t *time) = 0;
35 
36 	virtual status_t	GetNextChunk(void *cookie,
37 									 void **chunkBuffer, int32 *chunkSize,
38 									 media_header *mediaHeader) = 0;
39 
40 	BDataIO *			Source();
41 
42 private:
43 public: // XXX for test programs only
44 	void		Setup(BDataIO *source);
45 
46 	BDataIO * fSource;
47 };
48 
49 
50 class ReaderPlugin : public virtual MediaPlugin
51 {
52 public:
53 	virtual Reader *NewReader() = 0;
54 };
55 
56 } } // namespace BPrivate::media
57 
58 using namespace BPrivate::media;
59 
60 #endif
61