* Renamed _plugin_manager to gPluginManager.

* Improved tracing in PluginManager.cpp when loading an add-on.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38330 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-08-24 13:30:39 +00:00
parent 0767bd3a8b
commit e4f3cf203c
6 changed files with 36 additions and 35 deletions

View File

@ -81,6 +81,6 @@ private:
using namespace BPrivate::media;
extern PluginManager _plugin_manager;
extern PluginManager gPluginManager;
#endif // _PLUGIN_MANAGER_H

View File

@ -41,7 +41,7 @@ BMediaDecoder::BMediaDecoder(const media_codec_info *mci)
/* virtual */
BMediaDecoder::~BMediaDecoder()
{
_plugin_manager.DestroyDecoder(fDecoder);
gPluginManager.DestroyDecoder(fDecoder);
}
@ -57,10 +57,10 @@ BMediaDecoder::SetTo(const media_format *in_format,
const void *info,
size_t info_size)
{
_plugin_manager.DestroyDecoder(fDecoder);
gPluginManager.DestroyDecoder(fDecoder);
fDecoder = NULL;
status_t err = _plugin_manager.CreateDecoder(&fDecoder, *in_format);
status_t err = gPluginManager.CreateDecoder(&fDecoder, *in_format);
if (err < B_OK)
goto fail;
@ -76,7 +76,7 @@ BMediaDecoder::SetTo(const media_format *in_format,
return B_OK;
fail:
_plugin_manager.DestroyDecoder(fDecoder);
gPluginManager.DestroyDecoder(fDecoder);
fDecoder = NULL;
fInitStatus = B_NO_INIT;
return err;
@ -86,10 +86,10 @@ fail:
status_t
BMediaDecoder::SetTo(const media_codec_info *mci)
{
_plugin_manager.DestroyDecoder(fDecoder);
gPluginManager.DestroyDecoder(fDecoder);
fDecoder = NULL;
status_t err = _plugin_manager.CreateDecoder(&fDecoder, *mci);
status_t err = gPluginManager.CreateDecoder(&fDecoder, *mci);
if (err < B_OK)
goto fail;
@ -101,7 +101,7 @@ BMediaDecoder::SetTo(const media_codec_info *mci)
return B_OK;
fail:
_plugin_manager.DestroyDecoder(fDecoder);
gPluginManager.DestroyDecoder(fDecoder);
fDecoder = NULL;
fInitStatus = B_NO_INIT;
return err;
@ -177,7 +177,7 @@ BMediaDecoder::GetDecoderInfo(media_codec_info *out_info) const
if (!fDecoder)
return B_NO_INIT;
return _plugin_manager.GetDecoderInfo(fDecoder, out_info);
return gPluginManager.GetDecoderInfo(fDecoder, out_info);
}

View File

@ -71,7 +71,7 @@ MediaExtractor::MediaExtractor(BDataIO* source, int32 flags)
}
#endif
fInitStatus = _plugin_manager.CreateReader(&fReader, &fStreamCount,
fInitStatus = gPluginManager.CreateReader(&fReader, &fStreamCount,
&fFileFormat, source);
if (fInitStatus != B_OK)
return;
@ -155,7 +155,7 @@ MediaExtractor::~MediaExtractor()
delete fStreamInfo[i].chunkCache;
}
_plugin_manager.DestroyReader(fReader);
gPluginManager.DestroyReader(fReader);
delete[] fStreamInfo;
// fSource is owned by the BMediaFile
@ -328,7 +328,7 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
// TODO: Here we should work out a way so that if there is a setup
// failure we can try the next decoder
Decoder* decoder;
status = _plugin_manager.CreateDecoder(&decoder,
status = gPluginManager.CreateDecoder(&decoder,
fStreamInfo[stream].encodedFormat);
if (status != B_OK) {
#if DEBUG
@ -336,7 +336,7 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
string_for_format(fStreamInfo[stream].encodedFormat, formatString,
sizeof(formatString));
ERROR("MediaExtractor::CreateDecoder _plugin_manager.CreateDecoder "
ERROR("MediaExtractor::CreateDecoder gPluginManager.CreateDecoder "
"failed for stream %ld, format: %s: %s\n", stream, formatString,
strerror(status));
#endif
@ -346,7 +346,7 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
ChunkProvider* chunkProvider
= new(std::nothrow) MediaExtractorChunkProvider(this, stream);
if (chunkProvider == NULL) {
_plugin_manager.DestroyDecoder(decoder);
gPluginManager.DestroyDecoder(decoder);
ERROR("MediaExtractor::CreateDecoder can't create chunk provider "
"for stream %ld\n", stream);
return B_NO_MEMORY;
@ -357,15 +357,15 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
status = decoder->Setup(&fStreamInfo[stream].encodedFormat,
fStreamInfo[stream].infoBuffer, fStreamInfo[stream].infoBufferSize);
if (status != B_OK) {
_plugin_manager.DestroyDecoder(decoder);
gPluginManager.DestroyDecoder(decoder);
ERROR("MediaExtractor::CreateDecoder Setup failed for stream %ld: %s\n",
stream, strerror(status));
return status;
}
status = _plugin_manager.GetDecoderInfo(decoder, codecInfo);
status = gPluginManager.GetDecoderInfo(decoder, codecInfo);
if (status != B_OK) {
_plugin_manager.DestroyDecoder(decoder);
gPluginManager.DestroyDecoder(decoder);
ERROR("MediaExtractor::CreateDecoder GetCodecInfo failed for stream "
"%ld: %s\n", stream, strerror(status));
return status;

View File

@ -78,9 +78,9 @@ private:
BMediaTrack::~BMediaTrack()
{
CALLED();
_plugin_manager.DestroyDecoder(fRawDecoder);
_plugin_manager.DestroyDecoder(fDecoder);
_plugin_manager.DestroyEncoder(fEncoder);
gPluginManager.DestroyDecoder(fRawDecoder);
gPluginManager.DestroyDecoder(fDecoder);
gPluginManager.DestroyEncoder(fEncoder);
}
/*************************************************************
@ -148,7 +148,7 @@ BMediaTrack::DecodedFormat(media_format *inout_format, uint32 flags)
if (!fExtractor || !fDecoder)
return B_NO_INIT;
_plugin_manager.DestroyDecoder(fRawDecoder);
gPluginManager.DestroyDecoder(fRawDecoder);
fRawDecoder = NULL;
#ifdef TRACE_MEDIA_TRACK
@ -856,7 +856,7 @@ BMediaTrack::SetupWorkaround()
bool
BMediaTrack::SetupFormatTranslation(const media_format &from, media_format *to)
{
_plugin_manager.DestroyDecoder(fRawDecoder);
gPluginManager.DestroyDecoder(fRawDecoder);
fRawDecoder = NULL;
#ifdef TRACE_MEDIA_TRACK
@ -865,7 +865,7 @@ BMediaTrack::SetupFormatTranslation(const media_format &from, media_format *to)
printf("BMediaTrack::SetupFormatTranslation: from: %s\n", s);
#endif
status_t res = _plugin_manager.CreateDecoder(&fRawDecoder, from);
status_t res = gPluginManager.CreateDecoder(&fRawDecoder, from);
if (res != B_OK) {
ERROR("BMediaTrack::SetupFormatTranslation: CreateDecoder failed\n");
return false;
@ -913,7 +913,7 @@ BMediaTrack::SetupFormatTranslation(const media_format &from, media_format *to)
return true;
error:
_plugin_manager.DestroyDecoder(fRawDecoder);
gPluginManager.DestroyDecoder(fRawDecoder);
fRawDecoder = NULL;
return false;
}

View File

@ -53,7 +53,7 @@ MediaWriter::MediaWriter(BDataIO* target, const media_file_format& fileFormat)
{
CALLED();
_plugin_manager.CreateWriter(&fWriter, fFileFormat, fTarget);
gPluginManager.CreateWriter(&fWriter, fFileFormat, fTarget);
}
@ -68,7 +68,7 @@ MediaWriter::~MediaWriter()
for (fStreamInfos.Rewind(); fStreamInfos.GetNext(&info);)
fWriter->FreeCookie(info->cookie);
_plugin_manager.DestroyWriter(fWriter);
gPluginManager.DestroyWriter(fWriter);
}
// fTarget is owned by the BMediaFile
@ -107,9 +107,9 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
// TODO: Here we should work out a way so that if there is a setup
// failure we can try the next encoder.
Encoder* encoder;
status_t ret = _plugin_manager.CreateEncoder(&encoder, codecInfo, flags);
status_t ret = gPluginManager.CreateEncoder(&encoder, codecInfo, flags);
if (ret != B_OK) {
ERROR("MediaWriter::CreateEncoder _plugin_manager.CreateEncoder "
ERROR("MediaWriter::CreateEncoder gPluginManager.CreateEncoder "
"failed, codec: %s\n", codecInfo->pretty_name);
return ret;
}
@ -117,14 +117,14 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
StreamInfo info;
ret = fWriter->AllocateCookie(&info.cookie, format, codecInfo);
if (ret != B_OK) {
_plugin_manager.DestroyEncoder(encoder);
gPluginManager.DestroyEncoder(encoder);
return ret;
}
int32 streamIndex = fStreamInfos.CountItems();
if (!fStreamInfos.Insert(info)) {
_plugin_manager.DestroyEncoder(encoder);
gPluginManager.DestroyEncoder(encoder);
ERROR("MediaWriter::CreateEncoder can't create StreamInfo "
"for stream %ld\n", streamIndex);
return B_NO_MEMORY;
@ -133,7 +133,7 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
ChunkWriter* chunkWriter = new(std::nothrow) MediaExtractorChunkWriter(
this, streamIndex);
if (chunkWriter == NULL) {
_plugin_manager.DestroyEncoder(encoder);
gPluginManager.DestroyEncoder(encoder);
ERROR("MediaWriter::CreateEncoder can't create ChunkWriter "
"for stream %ld\n", streamIndex);
return B_NO_MEMORY;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004-2007, Marcus Overhagen. All rights reserved.
* Copyright 2004-2010, Marcus Overhagen. All rights reserved.
* Distributed under the terms of the OpenBeOS License.
*/
@ -12,7 +12,7 @@
#include "debug.h"
PluginManager _plugin_manager;
PluginManager gPluginManager;
// #pragma mark - Readers/Decoders
@ -418,9 +418,10 @@ PluginManager::_LoadPlugin(const entry_ref& ref, MediaPlugin** plugin,
image_id id;
id = load_add_on(p.Path());
TRACE(" loaded add-on: %ld\n", id);
if (id < 0)
if (id < 0) {
printf("PluginManager: Error, load_add_on(): %s\n", strerror(id));
return B_ERROR;
}
MediaPlugin* (*instantiate_plugin_func)();