2009-07-29 20:25:30 +04:00
|
|
|
#ifndef _WRITER_PLUGIN_H
|
|
|
|
#define _WRITER_PLUGIN_H
|
|
|
|
|
2018-11-21 19:22:58 +03:00
|
|
|
#include <MetaData.h>
|
2009-07-29 20:25:30 +04:00
|
|
|
#include <MediaTrack.h>
|
2018-10-29 11:41:21 +03:00
|
|
|
|
2009-07-29 20:25:30 +04:00
|
|
|
#include "MediaPlugin.h"
|
|
|
|
|
|
|
|
namespace BPrivate { namespace media {
|
|
|
|
|
|
|
|
class PluginManager;
|
|
|
|
|
|
|
|
class Writer {
|
|
|
|
public:
|
2018-11-21 19:22:58 +03:00
|
|
|
virtual status_t SetMetaData(BMetaData* data) = 0;
|
2009-07-29 20:25:30 +04:00
|
|
|
virtual status_t CommitHeader() = 0;
|
|
|
|
virtual status_t Flush() = 0;
|
|
|
|
virtual status_t Close() = 0;
|
|
|
|
|
2009-07-31 19:29:08 +04:00
|
|
|
virtual status_t AllocateCookie(void** cookie,
|
2010-10-21 01:36:23 +04:00
|
|
|
media_format* format,
|
2009-08-01 05:16:12 +04:00
|
|
|
const media_codec_info* codecInfo) = 0;
|
2009-07-29 20:25:30 +04:00
|
|
|
virtual status_t FreeCookie(void* cookie) = 0;
|
2009-07-31 14:46:58 +04:00
|
|
|
|
2018-11-21 19:22:58 +03:00
|
|
|
virtual status_t SetMetaData(void* cookie,
|
|
|
|
BMetaData* data) = 0;
|
2009-07-31 14:46:58 +04:00
|
|
|
|
2009-07-29 20:25:30 +04:00
|
|
|
virtual status_t AddTrackInfo(void* cookie, uint32 code,
|
|
|
|
const void* data, size_t size,
|
|
|
|
uint32 flags = 0) = 0;
|
|
|
|
|
2009-07-30 21:54:03 +04:00
|
|
|
virtual status_t WriteChunk(void* cookie,
|
2009-07-29 20:25:30 +04:00
|
|
|
const void* chunkBuffer, size_t chunkSize,
|
2009-07-31 14:46:58 +04:00
|
|
|
media_encode_info* encodeInfo) = 0;
|
2009-07-29 20:25:30 +04:00
|
|
|
|
|
|
|
BDataIO* Target() const;
|
|
|
|
|
2018-11-18 14:05:48 +03:00
|
|
|
virtual status_t Perform(perform_code code, void* data);
|
|
|
|
|
2018-11-22 11:24:41 +03:00
|
|
|
protected:
|
|
|
|
Writer();
|
|
|
|
virtual ~Writer();
|
|
|
|
|
|
|
|
virtual status_t Init(const media_file_format* fileFormat) = 0;
|
|
|
|
|
2009-07-29 20:25:30 +04:00
|
|
|
private:
|
2018-10-29 11:41:21 +03:00
|
|
|
void _Setup(BDataIO* target);
|
2009-07-29 20:25:30 +04:00
|
|
|
|
|
|
|
BDataIO* fTarget;
|
|
|
|
|
2018-10-29 11:41:21 +03:00
|
|
|
MediaPlugin* fMediaPlugin;
|
|
|
|
|
2009-07-29 20:25:30 +04:00
|
|
|
// needed for plug-in reference count management
|
|
|
|
friend class PluginManager;
|
2018-11-22 11:24:41 +03:00
|
|
|
friend class MediaWriter;
|
2009-07-29 20:25:30 +04:00
|
|
|
|
2018-10-28 17:45:44 +03:00
|
|
|
virtual void _ReservedWriter1();
|
|
|
|
virtual void _ReservedWriter2();
|
|
|
|
virtual void _ReservedWriter3();
|
|
|
|
virtual void _ReservedWriter4();
|
|
|
|
virtual void _ReservedWriter5();
|
|
|
|
|
2009-07-29 20:25:30 +04:00
|
|
|
uint32 fReserved[5];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class WriterPlugin : public virtual MediaPlugin {
|
|
|
|
public:
|
|
|
|
virtual Writer* NewWriter() = 0;
|
2009-07-29 23:11:32 +04:00
|
|
|
virtual status_t GetSupportedFileFormats(
|
2009-07-30 04:11:02 +04:00
|
|
|
const media_file_format** _fileFormats,
|
2009-07-29 23:11:32 +04:00
|
|
|
size_t* _count) = 0;
|
|
|
|
|
2009-07-29 20:25:30 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} } // namespace BPrivate::media
|
|
|
|
|
|
|
|
using namespace BPrivate::media;
|
|
|
|
|
|
|
|
#endif // _WRITER_PLUGIN_H
|