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
14namespace BPrivate {
15namespace media {
16
17
18class MediaWriter {
19public:
20								MediaWriter(BDataIO* target,
21									const media_file_format& fileFormat);
22								~MediaWriter();
23
24			status_t			InitCheck();
25
26			BDataIO*			Target() const;
27
28			void				GetFileFormatInfo(media_file_format* mfi) const;
29
30			status_t			CreateEncoder(Encoder** _encoder,
31									const media_codec_info* codecInfo,
32									media_format* format, uint32 flags = 0);
33
34			status_t			SetCopyright(int32 streamIndex,
35									const char* copyright);
36			status_t			SetCopyright(const char* copyright);
37			status_t			CommitHeader();
38			status_t			Flush();
39			status_t			Close();
40
41			status_t			AddTrackInfo(int32 streamIndex, uint32 code,
42									const void* data, size_t size,
43									uint32 flags = 0);
44
45			status_t			WriteChunk(int32 streamIndex,
46									const void* chunkBuffer, size_t chunkSize,
47									media_encode_info* encodeInfo);
48
49private:
50			struct StreamInfo {
51				void*			cookie;
52			};
53
54private:
55			BDataIO*			fTarget;
56			Writer*				fWriter;
57
58			List<StreamInfo>	fStreamInfos;
59
60			media_file_format	fFileFormat;
61};
62
63
64}; // namespace media
65}; // namespace BPrivate
66
67using namespace BPrivate::media;
68
69
70#endif // _MEDIA_WRITER_H
71