2015-12-02 17:24:17 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2015, Dario Casalinuovo. All rights reserved.
|
|
|
|
* Copyright 2012, Fredrik Modéen. All rights reserved.
|
2009-07-29 19:54:12 +04:00
|
|
|
* Copyright 2004-2007, Marcus Overhagen. All rights reserved.
|
2015-12-02 17:24:17 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
2009-07-29 19:54:12 +04:00
|
|
|
*/
|
2003-12-02 02:33:35 +03:00
|
|
|
#ifndef _PLUGIN_MANAGER_H
|
|
|
|
#define _PLUGIN_MANAGER_H
|
|
|
|
|
2009-06-07 23:07:34 +04:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
2003-12-02 02:33:35 +03:00
|
|
|
#include "DecoderPlugin.h"
|
2009-07-29 20:25:30 +04:00
|
|
|
#include "EncoderPlugin.h"
|
2009-07-29 19:54:12 +04:00
|
|
|
#include "ReaderPlugin.h"
|
2016-03-12 01:54:43 +03:00
|
|
|
#include "StreamerPlugin.h"
|
2009-07-29 20:25:30 +04:00
|
|
|
#include "WriterPlugin.h"
|
2009-07-29 19:54:12 +04:00
|
|
|
|
2003-12-05 04:18:51 +03:00
|
|
|
#include <TList.h>
|
|
|
|
#include <Locker.h>
|
2003-12-02 02:33:35 +03:00
|
|
|
|
2003-12-05 04:18:51 +03:00
|
|
|
|
2007-06-03 03:16:54 +04:00
|
|
|
namespace BPrivate { namespace media {
|
|
|
|
|
2009-07-29 19:54:12 +04:00
|
|
|
class PluginManager {
|
2003-12-05 04:18:51 +03:00
|
|
|
public:
|
2009-07-29 19:54:12 +04:00
|
|
|
PluginManager();
|
|
|
|
~PluginManager();
|
2003-12-05 04:18:51 +03:00
|
|
|
|
2009-07-29 19:54:12 +04:00
|
|
|
MediaPlugin* GetPlugin(const entry_ref& ref);
|
|
|
|
void PutPlugin(MediaPlugin* plugin);
|
|
|
|
|
2009-07-29 20:25:30 +04:00
|
|
|
// Readers and Decoders
|
2009-07-29 19:54:12 +04:00
|
|
|
status_t CreateReader(Reader** reader,
|
|
|
|
int32* streamCount, media_file_format* mff,
|
|
|
|
BDataIO* source);
|
|
|
|
void DestroyReader(Reader* reader);
|
|
|
|
|
|
|
|
status_t CreateDecoder(Decoder** decoder,
|
|
|
|
const media_format& format);
|
|
|
|
status_t CreateDecoder(Decoder** decoder,
|
|
|
|
const media_codec_info& mci);
|
|
|
|
status_t GetDecoderInfo(Decoder* decoder,
|
|
|
|
media_codec_info* _info) const;
|
|
|
|
void DestroyDecoder(Decoder* decoder);
|
2009-07-29 20:25:30 +04:00
|
|
|
|
|
|
|
// Writers and Encoders
|
|
|
|
status_t CreateWriter(Writer** writer,
|
|
|
|
const media_file_format& mff,
|
|
|
|
BDataIO* target);
|
|
|
|
void DestroyWriter(Writer* writer);
|
|
|
|
|
|
|
|
status_t CreateEncoder(Encoder** encoder,
|
2009-07-30 21:52:14 +04:00
|
|
|
const media_codec_info* codecInfo,
|
|
|
|
uint32 flags);
|
2015-12-02 17:24:17 +03:00
|
|
|
|
|
|
|
status_t CreateEncoder(Encoder** encoder,
|
|
|
|
const media_format& format);
|
|
|
|
|
2009-07-29 20:25:30 +04:00
|
|
|
void DestroyEncoder(Encoder* encoder);
|
2016-03-12 01:54:43 +03:00
|
|
|
|
|
|
|
status_t CreateStreamer(Streamer** streamer,
|
|
|
|
BUrl* url, BDataIO** source);
|
|
|
|
void DestroyStreamer(Streamer* streamer);
|
|
|
|
|
2003-12-05 04:18:51 +03:00
|
|
|
private:
|
2009-07-29 19:54:12 +04:00
|
|
|
status_t _LoadPlugin(const entry_ref& ref,
|
|
|
|
MediaPlugin** plugin, image_id* image);
|
|
|
|
|
|
|
|
struct plugin_info {
|
|
|
|
char name[260];
|
|
|
|
int usecount;
|
|
|
|
MediaPlugin* plugin;
|
|
|
|
image_id image;
|
|
|
|
|
|
|
|
plugin_info& operator=(const plugin_info& other)
|
|
|
|
{
|
|
|
|
strcpy(name, other.name);
|
|
|
|
usecount = other.usecount;
|
|
|
|
plugin = other.plugin;
|
|
|
|
image = other.image;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
List<plugin_info> fPluginList;
|
|
|
|
BLocker fLocker;
|
2003-12-05 04:18:51 +03:00
|
|
|
};
|
|
|
|
|
2007-06-03 03:16:54 +04:00
|
|
|
} } // namespace BPrivate::media
|
|
|
|
|
|
|
|
using namespace BPrivate::media;
|
|
|
|
|
2010-08-24 17:30:39 +04:00
|
|
|
extern PluginManager gPluginManager;
|
2007-06-03 00:00:48 +04:00
|
|
|
|
2009-07-29 19:54:12 +04:00
|
|
|
#endif // _PLUGIN_MANAGER_H
|