xref: /haiku/headers/private/media/WriterPlugin.h (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
1 #ifndef _WRITER_PLUGIN_H
2 #define _WRITER_PLUGIN_H
3 
4 #include <MediaTrack.h>
5 #include "MediaPlugin.h"
6 
7 namespace BPrivate { namespace media {
8 
9 class PluginManager;
10 
11 class Writer {
12 public:
13 								Writer();
14 	virtual						~Writer();
15 
16 	virtual	status_t			Init(const media_file_format* fileFormat) = 0;
17 
18 	virtual	status_t			SetCopyright(const char* copyright) = 0;
19 	virtual	status_t			CommitHeader() = 0;
20 	virtual	status_t			Flush() = 0;
21 	virtual	status_t			Close() = 0;
22 
23 	virtual	status_t			AllocateCookie(void** cookie,
24 									media_format* format,
25 									const media_codec_info* codecInfo) = 0;
26 	virtual	status_t			FreeCookie(void* cookie) = 0;
27 
28 	virtual	status_t			SetCopyright(void* cookie,
29 									const char* copyright) = 0;
30 
31 	virtual	status_t			AddTrackInfo(void* cookie, uint32 code,
32 									const void* data, size_t size,
33 									uint32 flags = 0) = 0;
34 
35 	virtual	status_t			WriteChunk(void* cookie,
36 									const void* chunkBuffer, size_t chunkSize,
37 									media_encode_info* encodeInfo) = 0;
38 
39 			BDataIO*			Target() const;
40 
41 	virtual status_t			Perform(perform_code code, void* data);
42 
43 private:
44 	virtual void				_ReservedWriter1();
45 	virtual void				_ReservedWriter2();
46 	virtual void				_ReservedWriter3();
47 	virtual void				_ReservedWriter4();
48 	virtual void				_ReservedWriter5();
49 
50 public: // XXX for test programs only
51 			void				Setup(BDataIO* target);
52 
53 			BDataIO*			fTarget;
54 
55 	// needed for plug-in reference count management
56 	friend class PluginManager;
57 			MediaPlugin*		fMediaPlugin;
58 
59 			uint32				fReserved[5];
60 };
61 
62 
63 class WriterPlugin : public virtual MediaPlugin {
64 public:
65 	virtual	Writer*				NewWriter() = 0;
66 	virtual	status_t			GetSupportedFileFormats(
67 									const media_file_format** _fileFormats,
68 									size_t* _count) = 0;
69 
70 };
71 
72 } } // namespace BPrivate::media
73 
74 using namespace BPrivate::media;
75 
76 #endif // _WRITER_PLUGIN_H
77