From 9e448b622400bbc43a37bd03c731586f0fae8189 Mon Sep 17 00:00:00 2001 From: Marcus Overhagen Date: Sat, 2 Jun 2007 23:16:54 +0000 Subject: [PATCH] cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21299 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/media/PluginManager.h | 8 +++++++- src/kits/media/PluginManager.cpp | 18 +++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/headers/private/media/PluginManager.h b/headers/private/media/PluginManager.h index 4764501f39..f9667985a1 100644 --- a/headers/private/media/PluginManager.h +++ b/headers/private/media/PluginManager.h @@ -7,6 +7,8 @@ #include +namespace BPrivate { namespace media { + class PluginManager { public: @@ -26,7 +28,7 @@ public: void DestroyDecoder(Decoder *decoder); private: - bool LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id *image); + status_t LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id *image); struct plugin_info { @@ -40,6 +42,10 @@ private: BLocker *fLocker; }; +} } // namespace BPrivate::media + +using namespace BPrivate::media; + extern PluginManager _plugin_manager; #endif diff --git a/src/kits/media/PluginManager.cpp b/src/kits/media/PluginManager.cpp index f3ac715fbf..2b788a48f7 100644 --- a/src/kits/media/PluginManager.cpp +++ b/src/kits/media/PluginManager.cpp @@ -108,14 +108,14 @@ PluginManager::CreateDecoder(Decoder **_decoder, const media_format &format) DecoderPlugin *decoderPlugin = dynamic_cast(plugin); if (!decoderPlugin) { printf("PluginManager::CreateDecoder: dynamic_cast failed\n"); - _plugin_manager.PutPlugin(plugin); + PutPlugin(plugin); return B_ERROR; } *_decoder = decoderPlugin->NewDecoder(0); if (*_decoder == NULL) { printf("PluginManager::CreateDecoder: NewDecoder() failed\n"); - _plugin_manager.PutPlugin(plugin); + PutPlugin(plugin); return B_ERROR; } @@ -200,10 +200,10 @@ PluginManager::GetPlugin(const entry_ref &ref) } } - if (!LoadPlugin(ref, &info.plugin, &info.image)) { + if (LoadPlugin(ref, &info.plugin, &info.image) < B_OK) { printf("PluginManager: Error, loading PlugIn %s failed\n", ref.name); fLocker->Unlock(); - return 0; + return NULL; } strcpy(info.name, ref.name); @@ -245,7 +245,7 @@ PluginManager::PutPlugin(MediaPlugin *plugin) } -bool +status_t PluginManager::LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id *image) { BPath p(&ref); @@ -255,14 +255,14 @@ PluginManager::LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id * image_id id; id = load_add_on(p.Path()); if (id < 0) - return false; + return B_ERROR; MediaPlugin *(*instantiate_plugin_func)(); if (get_image_symbol(id, "instantiate_plugin", B_SYMBOL_TYPE_TEXT, (void**)&instantiate_plugin_func) < B_OK) { printf("PluginManager: Error, LoadPlugin can't find instantiate_plugin in %s\n", p.Path()); unload_add_on(id); - return false; + return B_ERROR; } MediaPlugin *pl; @@ -271,10 +271,10 @@ PluginManager::LoadPlugin(const entry_ref &ref, MediaPlugin **plugin, image_id * if (pl == NULL) { printf("PluginManager: Error, LoadPlugin instantiate_plugin in %s returned NULL\n", p.Path()); unload_add_on(id); - return false; + return B_ERROR; } *plugin = pl; *image = id; - return true; + return B_OK; }