xref: /haiku/headers/private/media/ReaderPlugin.h (revision 4f2fd49bdc6078128b1391191e4edac647044c3d)
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 public:
16 								Reader();
17 	virtual						~Reader();
18 
19 	virtual	const char*			Copyright() = 0;
20 
21 	virtual	status_t			Sniff(int32* streamCount) = 0;
22 
23 	virtual	void				GetFileFormatInfo(media_file_format* mff) = 0;
24 
25 	virtual	status_t			AllocateCookie(int32 streamNumber,
26 									void** cookie) = 0;
27 	virtual	status_t			FreeCookie(void* cookie) = 0;
28 
29 	virtual	status_t			GetStreamInfo(void* cookie, int64* frameCount,
30 									bigtime_t *duration, media_format* format,
31 									const void** infoBuffer,
32 									size_t* infoSize) = 0;
33 
34 	virtual	status_t			Seek(void* cookie, uint32 flags, int64* frame,
35 									bigtime_t* time);
36 	virtual	status_t			FindKeyFrame(void* cookie, uint32 flags,
37 									int64* frame, bigtime_t* time);
38 
39 	virtual	status_t			GetNextChunk(void* cookie,
40 									const void** chunkBuffer, size_t* chunkSize,
41 									media_header* mediaHeader) = 0;
42 
43 			BDataIO*			Source() const;
44 
45 private:
46 public: // XXX for test programs only
47 			void				Setup(BDataIO* source);
48 
49 			BDataIO*			fSource;
50 };
51 
52 
53 class ReaderPlugin : public virtual MediaPlugin {
54 public:
55 	virtual	Reader*				NewReader() = 0;
56 };
57 
58 } } // namespace BPrivate::media
59 
60 using namespace BPrivate::media;
61 
62 #endif // _READER_PLUGIN_H
63