- Made PluginFactory threadsafe.

- Fixed the splitting of the track number.
This commit is contained in:
Daniel Önnerby 2008-04-20 23:07:58 +00:00
parent eb2d941042
commit 095ac9a4a8
3 changed files with 12 additions and 4 deletions

View File

@ -199,10 +199,12 @@ bool TagReaderTaglib::GetID3v2Tag(musik::core::Track *track){
// Split TRCK to track and totaltracks
std::vector<utfstring> splitTrack;
boost::algorithm::split(splitTrack,aAllTags["TRCK"].front()->toString().toWString(),boost::algorithm::is_any_of(_T("/")));
this->SetTagValue("track",splitTrack[0].c_str(),track);
if(splitTrack.size()>1){
this->SetTagValue("totaltracks",splitTrack[1].c_str(),track);
if(!aAllTags["TRCK"].isEmpty()){
boost::algorithm::split(splitTrack,aAllTags["TRCK"].front()->toString().toWString(),boost::algorithm::is_any_of(_T("/")));
this->SetTagValue("track",splitTrack[0].c_str(),track);
if(splitTrack.size()>1){
this->SetTagValue("totaltracks",splitTrack[1].c_str(),track);
}
}
this->SetTagValues("bpm",aAllTags["TBPM"],track);

View File

@ -66,6 +66,7 @@ PluginFactory::~PluginFactory(void){
}
void PluginFactory::LoadPlugins(){
boost::mutex::scoped_lock lock(this->mutex);
utfstring sPluginDir(GetPluginDirectory());
// Open plugin directory

View File

@ -41,6 +41,7 @@
#include <vector>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
namespace musik{ namespace core{
@ -70,6 +71,8 @@ namespace musik{ namespace core{
static PluginFactory sInstance;
boost::mutex mutex;
public:
template <typename T>
@ -86,6 +89,8 @@ namespace musik{ namespace core{
};
template <class T, class D> std::vector<boost::shared_ptr<T>> QueryInterface(const char* functionName){
boost::mutex::scoped_lock lock(this->mutex);
typedef T* (__stdcall* PluginInterfaceCall)();
std::vector<boost::shared_ptr<T>> plugins;