mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +00:00
- Made PluginFactory threadsafe.
- Fixed the splitting of the track number.
This commit is contained in:
parent
eb2d941042
commit
095ac9a4a8
@ -199,10 +199,12 @@ bool TagReaderTaglib::GetID3v2Tag(musik::core::Track *track){
|
|||||||
|
|
||||||
// Split TRCK to track and totaltracks
|
// Split TRCK to track and totaltracks
|
||||||
std::vector<utfstring> splitTrack;
|
std::vector<utfstring> splitTrack;
|
||||||
boost::algorithm::split(splitTrack,aAllTags["TRCK"].front()->toString().toWString(),boost::algorithm::is_any_of(_T("/")));
|
if(!aAllTags["TRCK"].isEmpty()){
|
||||||
this->SetTagValue("track",splitTrack[0].c_str(),track);
|
boost::algorithm::split(splitTrack,aAllTags["TRCK"].front()->toString().toWString(),boost::algorithm::is_any_of(_T("/")));
|
||||||
if(splitTrack.size()>1){
|
this->SetTagValue("track",splitTrack[0].c_str(),track);
|
||||||
this->SetTagValue("totaltracks",splitTrack[1].c_str(),track);
|
if(splitTrack.size()>1){
|
||||||
|
this->SetTagValue("totaltracks",splitTrack[1].c_str(),track);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetTagValues("bpm",aAllTags["TBPM"],track);
|
this->SetTagValues("bpm",aAllTags["TBPM"],track);
|
||||||
|
@ -66,6 +66,7 @@ PluginFactory::~PluginFactory(void){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PluginFactory::LoadPlugins(){
|
void PluginFactory::LoadPlugins(){
|
||||||
|
boost::mutex::scoped_lock lock(this->mutex);
|
||||||
utfstring sPluginDir(GetPluginDirectory());
|
utfstring sPluginDir(GetPluginDirectory());
|
||||||
|
|
||||||
// Open plugin directory
|
// Open plugin directory
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <boost/thread/mutex.hpp>
|
||||||
|
|
||||||
namespace musik{ namespace core{
|
namespace musik{ namespace core{
|
||||||
|
|
||||||
@ -70,6 +71,8 @@ namespace musik{ namespace core{
|
|||||||
|
|
||||||
static PluginFactory sInstance;
|
static PluginFactory sInstance;
|
||||||
|
|
||||||
|
boost::mutex mutex;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
template <typename T>
|
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){
|
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)();
|
typedef T* (__stdcall* PluginInterfaceCall)();
|
||||||
|
|
||||||
std::vector<boost::shared_ptr<T>> plugins;
|
std::vector<boost::shared_ptr<T>> plugins;
|
||||||
|
Loading…
Reference in New Issue
Block a user