* 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
+1 -1
View File
@@ -81,6 +81,6 @@ private:
using namespace BPrivate::media; using namespace BPrivate::media;
extern PluginManager _plugin_manager; extern PluginManager gPluginManager;
#endif // _PLUGIN_MANAGER_H #endif // _PLUGIN_MANAGER_H
+8 -8
View File
@@ -41,7 +41,7 @@ BMediaDecoder::BMediaDecoder(const media_codec_info *mci)
/* virtual */ /* virtual */
BMediaDecoder::~BMediaDecoder() BMediaDecoder::~BMediaDecoder()
{ {
_plugin_manager.DestroyDecoder(fDecoder); gPluginManager.DestroyDecoder(fDecoder);
} }
@@ -57,10 +57,10 @@ BMediaDecoder::SetTo(const media_format *in_format,
const void *info, const void *info,
size_t info_size) size_t info_size)
{ {
_plugin_manager.DestroyDecoder(fDecoder); gPluginManager.DestroyDecoder(fDecoder);
fDecoder = NULL; fDecoder = NULL;
status_t err = _plugin_manager.CreateDecoder(&fDecoder, *in_format); status_t err = gPluginManager.CreateDecoder(&fDecoder, *in_format);
if (err < B_OK) if (err < B_OK)
goto fail; goto fail;
@@ -76,7 +76,7 @@ BMediaDecoder::SetTo(const media_format *in_format,
return B_OK; return B_OK;
fail: fail:
_plugin_manager.DestroyDecoder(fDecoder); gPluginManager.DestroyDecoder(fDecoder);
fDecoder = NULL; fDecoder = NULL;
fInitStatus = B_NO_INIT; fInitStatus = B_NO_INIT;
return err; return err;
@@ -86,10 +86,10 @@ fail:
status_t status_t
BMediaDecoder::SetTo(const media_codec_info *mci) BMediaDecoder::SetTo(const media_codec_info *mci)
{ {
_plugin_manager.DestroyDecoder(fDecoder); gPluginManager.DestroyDecoder(fDecoder);
fDecoder = NULL; fDecoder = NULL;
status_t err = _plugin_manager.CreateDecoder(&fDecoder, *mci); status_t err = gPluginManager.CreateDecoder(&fDecoder, *mci);
if (err < B_OK) if (err < B_OK)
goto fail; goto fail;
@@ -101,7 +101,7 @@ BMediaDecoder::SetTo(const media_codec_info *mci)
return B_OK; return B_OK;
fail: fail:
_plugin_manager.DestroyDecoder(fDecoder); gPluginManager.DestroyDecoder(fDecoder);
fDecoder = NULL; fDecoder = NULL;
fInitStatus = B_NO_INIT; fInitStatus = B_NO_INIT;
return err; return err;
@@ -177,7 +177,7 @@ BMediaDecoder::GetDecoderInfo(media_codec_info *out_info) const
if (!fDecoder) if (!fDecoder)
return B_NO_INIT; return B_NO_INIT;
return _plugin_manager.GetDecoderInfo(fDecoder, out_info); return gPluginManager.GetDecoderInfo(fDecoder, out_info);
} }
+8 -8
View File
@@ -71,7 +71,7 @@ MediaExtractor::MediaExtractor(BDataIO* source, int32 flags)
} }
#endif #endif
fInitStatus = _plugin_manager.CreateReader(&fReader, &fStreamCount, fInitStatus = gPluginManager.CreateReader(&fReader, &fStreamCount,
&fFileFormat, source); &fFileFormat, source);
if (fInitStatus != B_OK) if (fInitStatus != B_OK)
return; return;
@@ -155,7 +155,7 @@ MediaExtractor::~MediaExtractor()
delete fStreamInfo[i].chunkCache; delete fStreamInfo[i].chunkCache;
} }
_plugin_manager.DestroyReader(fReader); gPluginManager.DestroyReader(fReader);
delete[] fStreamInfo; delete[] fStreamInfo;
// fSource is owned by the BMediaFile // 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 // TODO: Here we should work out a way so that if there is a setup
// failure we can try the next decoder // failure we can try the next decoder
Decoder* decoder; Decoder* decoder;
status = _plugin_manager.CreateDecoder(&decoder, status = gPluginManager.CreateDecoder(&decoder,
fStreamInfo[stream].encodedFormat); fStreamInfo[stream].encodedFormat);
if (status != B_OK) { if (status != B_OK) {
#if DEBUG #if DEBUG
@@ -336,7 +336,7 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
string_for_format(fStreamInfo[stream].encodedFormat, formatString, string_for_format(fStreamInfo[stream].encodedFormat, formatString,
sizeof(formatString)); sizeof(formatString));
ERROR("MediaExtractor::CreateDecoder _plugin_manager.CreateDecoder " ERROR("MediaExtractor::CreateDecoder gPluginManager.CreateDecoder "
"failed for stream %ld, format: %s: %s\n", stream, formatString, "failed for stream %ld, format: %s: %s\n", stream, formatString,
strerror(status)); strerror(status));
#endif #endif
@@ -346,7 +346,7 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
ChunkProvider* chunkProvider ChunkProvider* chunkProvider
= new(std::nothrow) MediaExtractorChunkProvider(this, stream); = new(std::nothrow) MediaExtractorChunkProvider(this, stream);
if (chunkProvider == NULL) { if (chunkProvider == NULL) {
_plugin_manager.DestroyDecoder(decoder); gPluginManager.DestroyDecoder(decoder);
ERROR("MediaExtractor::CreateDecoder can't create chunk provider " ERROR("MediaExtractor::CreateDecoder can't create chunk provider "
"for stream %ld\n", stream); "for stream %ld\n", stream);
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -357,15 +357,15 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
status = decoder->Setup(&fStreamInfo[stream].encodedFormat, status = decoder->Setup(&fStreamInfo[stream].encodedFormat,
fStreamInfo[stream].infoBuffer, fStreamInfo[stream].infoBufferSize); fStreamInfo[stream].infoBuffer, fStreamInfo[stream].infoBufferSize);
if (status != B_OK) { if (status != B_OK) {
_plugin_manager.DestroyDecoder(decoder); gPluginManager.DestroyDecoder(decoder);
ERROR("MediaExtractor::CreateDecoder Setup failed for stream %ld: %s\n", ERROR("MediaExtractor::CreateDecoder Setup failed for stream %ld: %s\n",
stream, strerror(status)); stream, strerror(status));
return status; return status;
} }
status = _plugin_manager.GetDecoderInfo(decoder, codecInfo); status = gPluginManager.GetDecoderInfo(decoder, codecInfo);
if (status != B_OK) { if (status != B_OK) {
_plugin_manager.DestroyDecoder(decoder); gPluginManager.DestroyDecoder(decoder);
ERROR("MediaExtractor::CreateDecoder GetCodecInfo failed for stream " ERROR("MediaExtractor::CreateDecoder GetCodecInfo failed for stream "
"%ld: %s\n", stream, strerror(status)); "%ld: %s\n", stream, strerror(status));
return status; return status;
+7 -7
View File
@@ -78,9 +78,9 @@ private:
BMediaTrack::~BMediaTrack() BMediaTrack::~BMediaTrack()
{ {
CALLED(); CALLED();
_plugin_manager.DestroyDecoder(fRawDecoder); gPluginManager.DestroyDecoder(fRawDecoder);
_plugin_manager.DestroyDecoder(fDecoder); gPluginManager.DestroyDecoder(fDecoder);
_plugin_manager.DestroyEncoder(fEncoder); gPluginManager.DestroyEncoder(fEncoder);
} }
/************************************************************* /*************************************************************
@@ -148,7 +148,7 @@ BMediaTrack::DecodedFormat(media_format *inout_format, uint32 flags)
if (!fExtractor || !fDecoder) if (!fExtractor || !fDecoder)
return B_NO_INIT; return B_NO_INIT;
_plugin_manager.DestroyDecoder(fRawDecoder); gPluginManager.DestroyDecoder(fRawDecoder);
fRawDecoder = NULL; fRawDecoder = NULL;
#ifdef TRACE_MEDIA_TRACK #ifdef TRACE_MEDIA_TRACK
@@ -856,7 +856,7 @@ BMediaTrack::SetupWorkaround()
bool bool
BMediaTrack::SetupFormatTranslation(const media_format &from, media_format *to) BMediaTrack::SetupFormatTranslation(const media_format &from, media_format *to)
{ {
_plugin_manager.DestroyDecoder(fRawDecoder); gPluginManager.DestroyDecoder(fRawDecoder);
fRawDecoder = NULL; fRawDecoder = NULL;
#ifdef TRACE_MEDIA_TRACK #ifdef TRACE_MEDIA_TRACK
@@ -865,7 +865,7 @@ BMediaTrack::SetupFormatTranslation(const media_format &from, media_format *to)
printf("BMediaTrack::SetupFormatTranslation: from: %s\n", s); printf("BMediaTrack::SetupFormatTranslation: from: %s\n", s);
#endif #endif
status_t res = _plugin_manager.CreateDecoder(&fRawDecoder, from); status_t res = gPluginManager.CreateDecoder(&fRawDecoder, from);
if (res != B_OK) { if (res != B_OK) {
ERROR("BMediaTrack::SetupFormatTranslation: CreateDecoder failed\n"); ERROR("BMediaTrack::SetupFormatTranslation: CreateDecoder failed\n");
return false; return false;
@@ -913,7 +913,7 @@ BMediaTrack::SetupFormatTranslation(const media_format &from, media_format *to)
return true; return true;
error: error:
_plugin_manager.DestroyDecoder(fRawDecoder); gPluginManager.DestroyDecoder(fRawDecoder);
fRawDecoder = NULL; fRawDecoder = NULL;
return false; return false;
} }
+7 -7
View File
@@ -53,7 +53,7 @@ MediaWriter::MediaWriter(BDataIO* target, const media_file_format& fileFormat)
{ {
CALLED(); CALLED();
_plugin_manager.CreateWriter(&fWriter, fFileFormat, fTarget); gPluginManager.CreateWriter(&fWriter, fFileFormat, fTarget);
} }
@@ -68,7 +68,7 @@ MediaWriter::~MediaWriter()
for (fStreamInfos.Rewind(); fStreamInfos.GetNext(&info);) for (fStreamInfos.Rewind(); fStreamInfos.GetNext(&info);)
fWriter->FreeCookie(info->cookie); fWriter->FreeCookie(info->cookie);
_plugin_manager.DestroyWriter(fWriter); gPluginManager.DestroyWriter(fWriter);
} }
// fTarget is owned by the BMediaFile // 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 // TODO: Here we should work out a way so that if there is a setup
// failure we can try the next encoder. // failure we can try the next encoder.
Encoder* encoder; Encoder* encoder;
status_t ret = _plugin_manager.CreateEncoder(&encoder, codecInfo, flags); status_t ret = gPluginManager.CreateEncoder(&encoder, codecInfo, flags);
if (ret != B_OK) { if (ret != B_OK) {
ERROR("MediaWriter::CreateEncoder _plugin_manager.CreateEncoder " ERROR("MediaWriter::CreateEncoder gPluginManager.CreateEncoder "
"failed, codec: %s\n", codecInfo->pretty_name); "failed, codec: %s\n", codecInfo->pretty_name);
return ret; return ret;
} }
@@ -117,14 +117,14 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
StreamInfo info; StreamInfo info;
ret = fWriter->AllocateCookie(&info.cookie, format, codecInfo); ret = fWriter->AllocateCookie(&info.cookie, format, codecInfo);
if (ret != B_OK) { if (ret != B_OK) {
_plugin_manager.DestroyEncoder(encoder); gPluginManager.DestroyEncoder(encoder);
return ret; return ret;
} }
int32 streamIndex = fStreamInfos.CountItems(); int32 streamIndex = fStreamInfos.CountItems();
if (!fStreamInfos.Insert(info)) { if (!fStreamInfos.Insert(info)) {
_plugin_manager.DestroyEncoder(encoder); gPluginManager.DestroyEncoder(encoder);
ERROR("MediaWriter::CreateEncoder can't create StreamInfo " ERROR("MediaWriter::CreateEncoder can't create StreamInfo "
"for stream %ld\n", streamIndex); "for stream %ld\n", streamIndex);
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -133,7 +133,7 @@ MediaWriter::CreateEncoder(Encoder** _encoder,
ChunkWriter* chunkWriter = new(std::nothrow) MediaExtractorChunkWriter( ChunkWriter* chunkWriter = new(std::nothrow) MediaExtractorChunkWriter(
this, streamIndex); this, streamIndex);
if (chunkWriter == NULL) { if (chunkWriter == NULL) {
_plugin_manager.DestroyEncoder(encoder); gPluginManager.DestroyEncoder(encoder);
ERROR("MediaWriter::CreateEncoder can't create ChunkWriter " ERROR("MediaWriter::CreateEncoder can't create ChunkWriter "
"for stream %ld\n", streamIndex); "for stream %ld\n", streamIndex);
return B_NO_MEMORY; return B_NO_MEMORY;
+5 -4
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. * Distributed under the terms of the OpenBeOS License.
*/ */
@@ -12,7 +12,7 @@
#include "debug.h" #include "debug.h"
PluginManager _plugin_manager; PluginManager gPluginManager;
// #pragma mark - Readers/Decoders // #pragma mark - Readers/Decoders
@@ -418,9 +418,10 @@ PluginManager::_LoadPlugin(const entry_ref& ref, MediaPlugin** plugin,
image_id id; image_id id;
id = load_add_on(p.Path()); 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; return B_ERROR;
}
MediaPlugin* (*instantiate_plugin_func)(); MediaPlugin* (*instantiate_plugin_func)();