xref: /haiku/headers/private/media/MediaWriter.h (revision 893988af824e65e49e55f517b157db8386e8002b)
1 /*
2  * Copyright 2009, Stephan Aßmus <superstippi@gmx.de>. All rights reserved.
3  * 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 									const media_format* format,
31 									uint32 flags = 0);
32 
33 			status_t			SetCopyright(int32 streamIndex,
34 									const char* copyright);
35 			status_t			SetCopyright(const char* copyright);
36 			status_t			CommitHeader();
37 			status_t			Flush();
38 			status_t			Close();
39 
40 			status_t			AddTrackInfo(int32 streamIndex, uint32 code,
41 									const void* data, size_t size,
42 									uint32 flags = 0);
43 
44 			status_t			WriteChunk(int32 streamIndex,
45 									const void* chunkBuffer, size_t chunkSize,
46 									media_encode_info* encodeInfo);
47 
48 private:
49 			struct StreamInfo {
50 				void*			cookie;
51 			};
52 
53 private:
54 			BDataIO*			fTarget;
55 			Writer*				fWriter;
56 
57 			List<StreamInfo>	fStreamInfos;
58 
59 			media_file_format	fFileFormat;
60 };
61 
62 
63 }; // namespace media
64 }; // namespace BPrivate
65 
66 using namespace BPrivate::media;
67 
68 
69 #endif // _MEDIA_WRITER_H
70