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