mirror of
https://review.haiku-os.org/haiku
synced 2025-01-30 18:24:53 +01:00
bb56a763a6
needed. I've added MediaPlugin* fields to Reader and Decoder plugin classes which are set when the PluginManager hands out new instances. This way the manager knows what plugin created the Decoder or Reader instance in the Destroy*() methods and can decrease the reference count accordingly. Also added some FBC stuffing to Decoder and Reader. All media plugins need to be recompiled, in case anyone has some outside the Haiku tree. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30984 a95241bf-73f2-0310-859d-f6bbb57e9c96
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#ifndef _PLUGIN_MANAGER_H
|
|
#define _PLUGIN_MANAGER_H
|
|
|
|
#include "ReaderPlugin.h"
|
|
#include "DecoderPlugin.h"
|
|
#include <TList.h>
|
|
#include <Locker.h>
|
|
|
|
|
|
namespace BPrivate { namespace media {
|
|
|
|
class PluginManager
|
|
{
|
|
public:
|
|
PluginManager();
|
|
~PluginManager();
|
|
|
|
MediaPlugin * GetPlugin(const entry_ref &ref);
|
|
void PutPlugin(MediaPlugin *plugin);
|
|
|
|
|
|
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 *out_info) const;
|
|
void DestroyDecoder(Decoder *decoder);
|
|
|
|
private:
|
|
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;
|
|
};
|
|
|
|
} } // namespace BPrivate::media
|
|
|
|
using namespace BPrivate::media;
|
|
|
|
extern PluginManager _plugin_manager;
|
|
|
|
#endif
|