xref: /haiku/headers/private/media/ReaderPlugin.h (revision 579f1dbca962a2a03df54f69fdc6e9423f91f20e)
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 	virtual	status_t			GetMetaData(BMessage* _data);
27 
28 	virtual	status_t			AllocateCookie(int32 streamNumber,
29 									void** cookie) = 0;
30 	virtual	status_t			FreeCookie(void* cookie) = 0;
31 
32 	virtual	status_t			GetStreamInfo(void* cookie, int64* frameCount,
33 									bigtime_t *duration, media_format* format,
34 									const void** infoBuffer,
35 									size_t* infoSize) = 0;
36 
37 	virtual	status_t			Seek(void* cookie, uint32 flags, int64* frame,
38 									bigtime_t* time);
39 	virtual	status_t			FindKeyFrame(void* cookie, uint32 flags,
40 									int64* frame, bigtime_t* time);
41 
42 	virtual	status_t			GetNextChunk(void* cookie,
43 									const void** chunkBuffer, size_t* chunkSize,
44 									media_header* mediaHeader) = 0;
45 
46 	virtual	status_t			GetStreamMetaData(void* cookie,
47 									BMessage* _data);
48 
49 			BDataIO*			Source() const;
50 
51 	virtual status_t			Perform(perform_code code, void* data);
52 
53 private:
54 	virtual void				_ReservedReader1();
55 	virtual void				_ReservedReader2();
56 	virtual void				_ReservedReader3();
57 	virtual void				_ReservedReader4();
58 	virtual void				_ReservedReader5();
59 
60 public: // XXX for test programs only
61 			void				Setup(BDataIO* source);
62 
63 			BDataIO*			fSource;
64 
65 	// needed for plug-in reference count management
66 	friend class PluginManager;
67 			MediaPlugin*		fMediaPlugin;
68 
69 			uint32				fReserved[5];
70 };
71 
72 
73 class ReaderPlugin : public virtual MediaPlugin {
74 public:
75 	virtual	Reader*				NewReader() = 0;
76 };
77 
78 } } // namespace BPrivate::media
79 
80 using namespace BPrivate::media;
81 
82 #endif // _READER_PLUGIN_H
83