2009-07-30 21:56:01 +04:00
|
|
|
/*
|
2010-10-21 01:36:23 +04:00
|
|
|
* Copyright 2009-2010, Stephan Aßmus <superstippi@gmx.de>.
|
|
|
|
* All rights reserved. Distributed under the terms of the MIT License.
|
2009-07-30 21:56:01 +04:00
|
|
|
*/
|
|
|
|
#ifndef _MEDIA_WRITER_H
|
|
|
|
#define _MEDIA_WRITER_H
|
|
|
|
|
2018-11-25 13:59:45 +03:00
|
|
|
#include <Encoder.h>
|
2018-11-21 19:22:58 +03:00
|
|
|
#include <MetaData.h>
|
2018-11-25 13:59:45 +03:00
|
|
|
#include <Writer.h>
|
2009-07-30 21:56:01 +04:00
|
|
|
|
|
|
|
#include "TList.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPrivate {
|
|
|
|
namespace media {
|
|
|
|
|
|
|
|
|
2018-11-25 14:40:49 +03:00
|
|
|
class BMediaWriter {
|
2009-07-30 21:56:01 +04:00
|
|
|
public:
|
2018-11-25 14:40:49 +03:00
|
|
|
BMediaWriter(BDataIO* target,
|
2009-07-30 21:56:01 +04:00
|
|
|
const media_file_format& fileFormat);
|
2018-11-25 14:40:49 +03:00
|
|
|
~BMediaWriter();
|
2009-07-30 21:56:01 +04:00
|
|
|
|
|
|
|
status_t InitCheck();
|
|
|
|
|
2016-03-26 00:19:03 +03:00
|
|
|
BDataIO* Target() const;
|
|
|
|
|
2009-07-30 21:56:01 +04:00
|
|
|
void GetFileFormatInfo(media_file_format* mfi) const;
|
|
|
|
|
2018-11-25 14:40:49 +03:00
|
|
|
status_t CreateEncoder(BEncoder** _encoder,
|
2009-07-31 14:46:58 +04:00
|
|
|
const media_codec_info* codecInfo,
|
2010-10-21 01:36:23 +04:00
|
|
|
media_format* format, uint32 flags = 0);
|
2009-07-31 14:46:58 +04:00
|
|
|
|
2018-11-21 19:22:58 +03:00
|
|
|
// TODO: Why pointers? Just copy it
|
|
|
|
status_t SetMetaData(BMetaData* data);
|
|
|
|
status_t SetMetaData(int32 streamIndex,
|
|
|
|
BMetaData* data);
|
|
|
|
|
2009-07-30 21:56:01 +04:00
|
|
|
status_t CommitHeader();
|
|
|
|
status_t Flush();
|
|
|
|
status_t Close();
|
|
|
|
|
2009-07-31 14:46:58 +04:00
|
|
|
status_t AddTrackInfo(int32 streamIndex, uint32 code,
|
2009-07-30 21:56:01 +04:00
|
|
|
const void* data, size_t size,
|
|
|
|
uint32 flags = 0);
|
|
|
|
|
2009-07-31 14:46:58 +04:00
|
|
|
status_t WriteChunk(int32 streamIndex,
|
2009-07-30 21:56:01 +04:00
|
|
|
const void* chunkBuffer, size_t chunkSize,
|
2009-07-31 14:46:58 +04:00
|
|
|
media_encode_info* encodeInfo);
|
2009-07-30 21:56:01 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
struct StreamInfo {
|
|
|
|
void* cookie;
|
|
|
|
};
|
|
|
|
|
|
|
|
BDataIO* fTarget;
|
2018-11-25 14:40:49 +03:00
|
|
|
BWriter* fWriter;
|
2009-07-30 21:56:01 +04:00
|
|
|
List<StreamInfo> fStreamInfos;
|
|
|
|
media_file_format fFileFormat;
|
2018-10-28 18:14:25 +03:00
|
|
|
|
|
|
|
uint32 fReserved[5];
|
2009-07-30 21:56:01 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}; // namespace media
|
|
|
|
}; // namespace BPrivate
|
|
|
|
|
|
|
|
using namespace BPrivate::media;
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _MEDIA_WRITER_H
|