xref: /haiku/headers/private/media/ReaderPlugin.h (revision 508f54795f39c3e7552d87c95aae9dd8ec6f505b)
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 class PluginManager;
10 
11 enum {
12 	B_MEDIA_SEEK_TO_TIME	= 0x10000,
13 	B_MEDIA_SEEK_TO_FRAME	= 0x20000
14 };
15 
16 class Reader {
17 public:
18 								Reader();
19 	virtual						~Reader();
20 
21 	virtual	const char*			Copyright() = 0;
22 
23 	virtual	status_t			Sniff(int32* streamCount) = 0;
24 
25 	virtual	void				GetFileFormatInfo(media_file_format* mff) = 0;
26 
27 	virtual	status_t			AllocateCookie(int32 streamNumber,
28 									void** cookie) = 0;
29 	virtual	status_t			FreeCookie(void* cookie) = 0;
30 
31 	virtual	status_t			GetStreamInfo(void* cookie, int64* frameCount,
32 									bigtime_t *duration, media_format* format,
33 									const void** infoBuffer,
34 									size_t* infoSize) = 0;
35 
36 	virtual	status_t			Seek(void* cookie, uint32 flags, int64* frame,
37 									bigtime_t* time);
38 	virtual	status_t			FindKeyFrame(void* cookie, uint32 flags,
39 									int64* frame, bigtime_t* time);
40 
41 	virtual	status_t			GetNextChunk(void* cookie,
42 									const void** chunkBuffer, size_t* chunkSize,
43 									media_header* mediaHeader) = 0;
44 
45 			BDataIO*			Source() const;
46 
47 	virtual status_t			Perform(perform_code code, void* data);
48 
49 private:
50 	virtual void				_ReservedReader1();
51 	virtual void				_ReservedReader2();
52 	virtual void				_ReservedReader3();
53 	virtual void				_ReservedReader4();
54 	virtual void				_ReservedReader5();
55 
56 public: // XXX for test programs only
57 			void				Setup(BDataIO* source);
58 
59 			BDataIO*			fSource;
60 
61 	// needed for plug-in reference count management
62 	friend class PluginManager;
63 			MediaPlugin*		fMediaPlugin;
64 
65 			uint32				fReserved[5];
66 };
67 
68 
69 class ReaderPlugin : public virtual MediaPlugin {
70 public:
71 	virtual	Reader*				NewReader() = 0;
72 };
73 
74 } } // namespace BPrivate::media
75 
76 using namespace BPrivate::media;
77 
78 #endif // _READER_PLUGIN_H
79