xref: /haiku/headers/private/media/MediaWriter.h (revision a906d0a031e721e2f2ec9d95274103e74a3a774f)
1 /*
2  * Copyright 2009-2010, Stephan Aßmus <superstippi@gmx.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef _MEDIA_WRITER_H
6 #define _MEDIA_WRITER_H
7 
8 
9 #include "EncoderPlugin.h"
10 #include "TList.h"
11 #include "WriterPlugin.h"
12 
13 
14 namespace BPrivate {
15 namespace media {
16 
17 
18 class MediaWriter {
19 public:
20 								MediaWriter(BDataIO* target,
21 									const media_file_format& fileFormat);
22 								~MediaWriter();
23 
24 			status_t			InitCheck();
25 
26 			void				GetFileFormatInfo(media_file_format* mfi) const;
27 
28 			status_t			CreateEncoder(Encoder** _encoder,
29 									const media_codec_info* codecInfo,
30 									media_format* format, uint32 flags = 0);
31 
32 			status_t			SetCopyright(int32 streamIndex,
33 									const char* copyright);
34 			status_t			SetCopyright(const char* copyright);
35 			status_t			CommitHeader();
36 			status_t			Flush();
37 			status_t			Close();
38 
39 			status_t			AddTrackInfo(int32 streamIndex, uint32 code,
40 									const void* data, size_t size,
41 									uint32 flags = 0);
42 
43 			status_t			WriteChunk(int32 streamIndex,
44 									const void* chunkBuffer, size_t chunkSize,
45 									media_encode_info* encodeInfo);
46 
47 private:
48 			struct StreamInfo {
49 				void*			cookie;
50 			};
51 
52 private:
53 			BDataIO*			fTarget;
54 			Writer*				fWriter;
55 
56 			List<StreamInfo>	fStreamInfos;
57 
58 			media_file_format	fFileFormat;
59 };
60 
61 
62 }; // namespace media
63 }; // namespace BPrivate
64 
65 using namespace BPrivate::media;
66 
67 
68 #endif // _MEDIA_WRITER_H
69