Moved remaining core files to their new homes.

This commit is contained in:
casey 2016-05-03 23:58:13 -07:00
parent f3f4c23c59
commit 7468b8d374
65 changed files with 253 additions and 1251 deletions

View File

@ -60,7 +60,7 @@
#include <set>
#include <core/sdk/IMetaDataReader.h>
#include <core/Common.h>
#include <core/support/Common.h>
class TagReaderTaglib : public musik::core::Plugin::IMetaDataReader {
public:

View File

@ -1,95 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, mC2 team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/Crypt.h>
#include <core/config.h>
#include <md5/md5.h>
#include <boost/random.hpp>
//////////////////////////////////////////////////////////////////////////////
using namespace musik::core;
//////////////////////////////////////////////////////////////////////////////
std::string Crypt::GenerateSalt(){
const std::string characters("ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789");
typedef boost::mt19937 RandomGenerator;
RandomGenerator randomGenerator;
randomGenerator.seed(static_cast<unsigned int>(std::time(0)));
boost::uniform_int<> randDistribution(0,(int)characters.size()-1);
boost::variate_generator<RandomGenerator&, boost::uniform_int<> > rand(randomGenerator, randDistribution);
std::string salt;
for(int i(0);i<64;++i){
salt += characters.at(rand());
}
return salt;
}
std::string Crypt::StaticSalt(){
return "mC2, don't be square";
}
std::string Crypt::Encrypt(std::string cryptContent,std::string salt){
md5_state_t md5State;
md5_init(&md5State);
std::string encryptString = cryptContent+salt;
md5_append(&md5State,(const md5_byte_t *)encryptString.c_str(),(int)encryptString.size());
// Encrypted result
md5_byte_t result[16];
// Get the results
md5_finish(&md5State, result);
// Add result to encryptedString
std::string encryptedHexString;
boost::format formatHex("%1$02x");
for(int i=0;i<16;++i){
int hex = result[i];
formatHex%hex;
encryptedHexString += formatHex.str();
formatHex.clear();
}
return encryptedHexString;
}

View File

@ -1,56 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, mC2 team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <core/config.h>
//////////////////////////////////////////////////////////////////////////////
namespace musik{ namespace core{
//////////////////////////////////////////////////////////////////////////////
class Crypt{
public:
static std::string GenerateSalt();
static std::string StaticSalt();
static std::string Encrypt(std::string cryptContent,std::string salt);
};
//////////////////////////////////////////////////////////////////////////////
} }
//////////////////////////////////////////////////////////////////////////////

View File

@ -1,50 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/Image.h>
#include <boost/gil/image.hpp>
#include <boost/gil/extension/io/jpeg_io.hpp>
using namespace musik::core;
Image::Image(void)
{
}
Image::~Image(void)
{
}

View File

@ -1,61 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <core/config.h>
#define XMD_H
#include <boost/gil/typedefs.hpp>
//////////////////////////////////////////////////////////////////////////////
namespace musik{ namespace core{
//////////////////////////////////////////////////////////////////////////////
class Image{
public:
Image(void);
~Image(void);
bool Load(std::string image);
typedef boost::shared_ptr<boost::gil::rgba8_image_t> ImageBufferPtr;
};
//////////////////////////////////////////////////////////////////////////////
} }
//////////////////////////////////////////////////////////////////////////////

View File

@ -1,93 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/MessageQueue.h>
//////////////////////////////////////////////////////////////////////////////
using namespace musik::core;
//////////////////////////////////////////////////////////////////////////////
MessageQueue MessageQueue::sInstance;
/*MessageQueue& MessageQueue::Instance(){
return MessageQueue::sInstance;
}*/
MessageQueue::MessageQueue(void)
{
}
MessageQueue::~MessageQueue(void)
{
}
MessageQueue::ControllerEventSignal& MessageQueue::EventController(){
return MessageQueue::sInstance.controllerEvent;
}
MessageQueue::EventSignal& MessageQueue::MessageEvent(const char* identifier){
return MessageQueue::sInstance.eventMap[identifier];
}
void MessageQueue::SendMessage(const char* identifier,void* data){
{
EventSignalMap::iterator eventSignal = MessageQueue::sInstance.eventMap.find(identifier);
if(eventSignal!=MessageQueue::sInstance.eventMap.end()){
// First call the controllers
MessageQueue::sInstance.controllerEvent(identifier,data);
}
}
{
// Just in case the controller would change the eventMap, lets find the eventSignal again.
EventSignalMap::iterator eventSignal = MessageQueue::sInstance.eventMap.find(identifier);
if(eventSignal!=MessageQueue::sInstance.eventMap.end()){
// Call the evenSignals
eventSignal->second(data);
}
}
}
MessageQueueData::MessageQueueData(){
}
MessageQueueData::~MessageQueueData(){
}

View File

@ -1,81 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <sigslot/sigslot.h>
#include <map>
#include <string>
//////////////////////////////////////////////////////////////////////////////
namespace musik { namespace core {
//////////////////////////////////////////////////////////////////////////////
struct MessageQueueData{
MessageQueueData();
virtual ~MessageQueueData();
};
class MessageQueue {
public:
typedef sigslot::signal2<const char*,void*> ControllerEventSignal;
typedef sigslot::signal1<void*> EventSignal;
static ControllerEventSignal& EventController();
static EventSignal& MessageEvent(const char* identifier);
static void SendMessage(const char* identifier,void* data=NULL);
private:
~MessageQueue();
MessageQueue();
//static MessageQueue& Instance();
private:
// The one and only instance
static MessageQueue sInstance;
typedef std::map<std::string,EventSignal> EventSignalMap;
EventSignalMap eventMap;
ControllerEventSignal controllerEvent;
};
//////////////////////////////////////////////////////////////////////////////
} } // musik::core
//////////////////////////////////////////////////////////////////////////////

View File

@ -1,62 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/MetaKey.h>
#include <string>
using namespace musik::core;
MetaKey::MetaKey(void){
}
MetaKey::~MetaKey(void){
}
MetaKey::Type MetaKey::TypeOf(std::string metaKey){
if(metaKey=="bpm"){
return MetaKey::Float;
}else if(metaKey=="track" || metaKey=="year"){
return MetaKey::Int;
}else if(metaKey=="filetime"){
return MetaKey::Date;
}else if(metaKey=="duration"){
return MetaKey::Duration;
}else if(metaKey=="filesize"){
return MetaKey::Size;
}
return MetaKey::String;
}

View File

@ -1,66 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <core/config.h>
//////////////////////////////////////////////////////////////////////////////
namespace musik{ namespace core{
//////////////////////////////////////////////////////////////////////////////
class MetaKey{
private:
MetaKey(void);
~MetaKey(void);
public:
typedef enum {
Int = 1,
Float = 2,
Date = 3,
Size = 4,
Duration = 5,
String = 6
} Type;
static Type TypeOf(std::string metaKey);
};
//////////////////////////////////////////////////////////////////////////////
} } // musik::core

View File

@ -1,277 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include "Server.h"
#include <core/Preferences.h>
#include <core/Common.h>
#include <core/Library/Base.h>
#include <core/Crypt.h>
#include <boost/bind.hpp>
using namespace musik::core;
Server::Server(unsigned int port,unsigned int httpPort)
:exitThread(false)
,acceptor(ioService,boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port))
,httpServer(httpPort)
{
this->acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
this->httpServer.parent = this; // should fix this.
}
Server::~Server(void){
this->Exit();
{
server::UserSessionMap clearedConnectedUsers;
server::ConnectionVector clearedConnections;
{
boost::mutex::scoped_lock lock(this->serverMutex);
clearedConnectedUsers.swap(this->connectedUsers);
clearedConnections.swap(this->connections);
}
}
this->nextConnection.reset();
this->threads.join_all();
}
void Server::Exit(){
boost::mutex::scoped_lock lock(this->serverMutex);
this->exitThread = true;
this->ioService.stop();
}
bool Server::Exited(){
boost::mutex::scoped_lock lock(this->serverMutex);
return this->exitThread;
}
bool Server::Startup(){
// Start the server thread
this->threads.create_thread(boost::bind(&Server::ThreadLoop,this));
return true;
}
std::string Server::ServerIdentifier(){
return "server";
}
void Server::ThreadLoop(){
// Get server preferences
musik::core::Preferences prefs("Server");
// Get directory and database paths
std::string directory( musik::core::GetDataDirectory()+this->ServerIdentifier()+"/" );
std::string database(directory+"musik.db");
// Create directory if not existing
boost::filesystem::path folder(directory);
if(!boost::filesystem::exists(folder)){
boost::filesystem::create_directories(folder);
}
// Create database
this->db.Open(database.c_str(),0,prefs.GetInt("DatabaseCache",4096));
Library::Base::CreateDatabase(this->db);
this->httpServer.Startup(database);
// Start the indexer
this->indexer.database = database;
this->indexer.Startup(directory);
while(!this->Exited()){
// tcp/ip port
// int port( prefs.GetInt("ipPort",10543) );
boost::system::error_code error;
// Connect the next socket connection
this->SetNextConnection();
// loop, waiting for incomming connections
this->ioService.run(error);
}
}
void Server::SetNextConnection(){
this->nextConnection.reset( new musik::core::server::Connection(this->ioService,this) );
this->acceptor.async_accept(this->nextConnection->Socket(),boost::bind(&Server::AcceptConnection,this,boost::asio::placeholders::error));
}
void Server::AcceptConnection(const boost::system::error_code& error){
if(!error){
// Start the connection
this->nextConnection->Startup();
{
boost::mutex::scoped_lock lock(this->serverMutex);
this->connections.push_back(this->nextConnection);
this->SetNextConnection();
}
this->CleanupConnections();
}
}
void Server::CleanupConnections(){
boost::mutex::scoped_lock lock(this->serverMutex);
for(server::ConnectionVector::iterator connection=this->connections.begin();connection!=this->connections.end();){
if( (*connection)->Exited() ){
connection = this->connections.erase(connection);
}else{
++connection;
}
}
}
bool Server::CreateUser(const std::string username,const std::string plainTextPassword,const std::string name){
std::string password(musik::core::Crypt::Encrypt(
plainTextPassword,musik::core::Crypt::StaticSalt()));
db::Statement stmt("INSERT INTO users (login,password,name) VALUES (?,?,?)",this->db);
stmt.BindText(0,username.c_str());
stmt.BindText(1,password.c_str());
stmt.BindText(2,name.c_str());
bool returnBool(stmt.Step()==db::Done);
this->UsersUpdated();
return returnBool;
}
bool Server::DeleteUser(const std::string username){
db::Statement stmt("DELETE FROM users WHERE login=?",this->db);
stmt.BindText(0,username.c_str());
bool returnBool(stmt.Step()==db::Done);
this->UsersUpdated();
return returnBool;
}
server::UserVector Server::AllUsers(){
server::UserVector users;
db::Statement stmt("SELECT id,name,login,password FROM users ORDER BY login",this->db);
while(stmt.Step()==db::Row){
users.push_back(server::UserPtr(new server::User(
stmt.ColumnInt(0),
stmt.ColumnText(2),
stmt.ColumnText(3),
stmt.ColumnText(1)
)));
}
return users;
}
server::UserSessionVector Server::ConnectedUserSessions(){
boost::mutex::scoped_lock lock(this->serverMutex);
server::UserSessionVector userSessionVector;
for(server::UserSessionMap::iterator userSession=this->connectedUsers.begin();userSession!=this->connectedUsers.end();++userSession){
userSessionVector.push_back(userSession->second);
}
return userSessionVector;
}
bool Server::AddUserSession(server::UserSessionPtr userSession){
{
boost::mutex::scoped_lock lock(this->serverMutex);
this->connectedUsers[userSession->UniqueId()] = userSession;
}
this->UserSessionsUpdated();
return true;
}
bool Server::RemoveUserSession(server::UserSessionPtr userSession){
if(userSession){
{
boost::mutex::scoped_lock lock(this->serverMutex);
this->connectedUsers.erase(userSession->UniqueId());
}
this->UserSessionsUpdated();
}
return true;
}
server::UserPtr Server::GetUser(std::string username){
server::UserPtr user;
db::Statement stmt("SELECT id,name,login,password FROM users WHERE login=?",this->db);
stmt.BindText(0,username);
if(stmt.Step()==db::Row){
user.reset( new server::User(
stmt.ColumnInt(0),
stmt.ColumnText(2),
stmt.ColumnText(3),
stmt.ColumnText(1)
));
}
return user;
}
bool Server::UserIsAuthorized(const char *authorizationKey,boost::asio::ip::tcp::socket &socket){
if(authorizationKey){
boost::mutex::scoped_lock lock(this->serverMutex);
server::UserSessionMap::iterator foundUser = this->connectedUsers.find(authorizationKey);
if(foundUser!=this->connectedUsers.end()){
// User found, but to be sure, lets check if the address is the same
boost::asio::ip::tcp::endpoint endpoint = socket.remote_endpoint();
if(foundUser->second->IP()==endpoint.address().to_string()){
// Same address = same user
return true;
}
}
}
return false;
}

View File

@ -1,135 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright © 2008, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <core/config.h>
#include <core/server/Connection.h>
#include <core/db/Connection.h>
#include <core/Indexer.h>
#include <core/http/Server.h>
#include <core/server/User.h>
#include <core/server/UserSession.h>
#include <boost/asio.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/shared_ptr.hpp>
#include <vector>
#include <sigslot/sigslot.h>
//////////////////////////////////////////////////////////////////////////////
namespace musik{ namespace core{
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////
///\brief
///musik::core::Server is the main class for the musikServer
///
///the Server contains everything from an Indexer,
///a musik::core::server::Connection (Library::Base derivate) for each connected user
///and a HTTP server for streaming tracks.
///
///\see
///Indexer | http::Server | server::Connection
//////////////////////////////////////////
class Server{
public:
// Methods
Server(unsigned int port,unsigned int httpPort);
~Server(void);
bool Startup();
bool CreateUser(const std::string username,const std::string plainTextPassword,const std::string name);
bool DeleteUser(const std::string username);
server::UserVector AllUsers();
server::UserSessionVector ConnectedUserSessions();
bool UserIsAuthorized(const char *authorizationKey,boost::asio::ip::tcp::socket &socket);
public:
// Events
typedef sigslot::signal0<> UserUpdatedEvent;
UserUpdatedEvent UsersUpdated;
UserUpdatedEvent UserSessionsUpdated;
public:
Indexer indexer;
http::Server httpServer;
private:
// Methods
void Exit();
bool Exited();
void ThreadLoop();
void AcceptConnection(const boost::system::error_code& error);
void SetNextConnection();
void CleanupConnections();
std::string ServerIdentifier();
friend class server::Connection;
server::UserPtr GetUser(std::string username);
bool RemoveUserSession(server::UserSessionPtr userSession);
bool AddUserSession(server::UserSessionPtr userSession);
private:
// Variables
boost::asio::io_service ioService;
boost::asio::ip::tcp::acceptor acceptor;
bool exitThread;
boost::mutex serverMutex;
boost::thread_group threads;
musik::core::server::ConnectionVector connections;
musik::core::server::ConnectionPtr nextConnection;
server::UserSessionMap connectedUsers;
db::Connection db;
};
typedef boost::shared_ptr<Server> ServerPtr;
//////////////////////////////////////////////////////////////////////////////
} }

View File

@ -34,7 +34,7 @@
#include "pch.hpp"
#include <core/audio/Player.h>
#include <core/PluginFactory.h>
#include <core/plugin/PluginFactory.h>
using namespace musik::core::audio;

View File

@ -35,7 +35,7 @@
#include <core/audio/Stream.h>
#include <core/sdk/IDecoderFactory.h>
#include <core/PluginFactory.h>
#include <core/plugin/PluginFactory.h>
using namespace musik::core::audio;
using musik::core::PluginFactory;

View File

@ -79,7 +79,11 @@
<ItemGroup>
<ClCompile Include="io\DataStreamFactory.cpp" />
<ClCompile Include="io\LocalFileStream.cpp" />
<ClCompile Include="Library\LocalLibrary.cpp" />
<ClCompile Include="library\Indexer.cpp" />
<ClCompile Include="library\LibraryBase.cpp" />
<ClCompile Include="library\LibraryFactory.cpp" />
<ClCompile Include="library\LocalLibrary.cpp" />
<ClCompile Include="library\metadata\MetadataValue.cpp" />
<ClCompile Include="Library\query\QueryFactory.cpp" />
<ClCompile Include="Library\query\LibraryTrackListQuery.cpp" />
<ClCompile Include="Library\query\ListQueryBase.cpp" />
@ -90,42 +94,39 @@
<ClCompile Include="Library\query\SortTracksWithDataQuery.cpp" />
<ClCompile Include="Library\query\TrackListQueryBase.cpp" />
<ClCompile Include="Library\query\TrackMetadataQuery.cpp" />
<ClCompile Include="library\track\GenericTrack.cpp" />
<ClCompile Include="library\track\IndexerTrack.cpp" />
<ClCompile Include="library\track\LibraryTrack.cpp" />
<ClCompile Include="library\track\Track.cpp" />
<ClCompile Include="library\track\TrackFactory.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="PlaybackQueue.cpp" />
<ClCompile Include="Common.cpp" />
<ClCompile Include="Crypt.cpp" />
<ClCompile Include="Image.cpp" />
<ClCompile Include="MessageQueue.cpp" />
<ClCompile Include="Preferences.cpp" />
<ClCompile Include="ThreadHelper.cpp" />
<ClCompile Include="Indexer.cpp" />
<ClCompile Include="LibraryFactory.cpp" />
<ClCompile Include="Library\LibraryBase.cpp" />
<ClCompile Include="db\CachedStatement.cpp" />
<ClCompile Include="db\Connection.cpp" />
<ClCompile Include="db\ScopedTransaction.cpp" />
<ClCompile Include="db\Statement.cpp" />
<ClCompile Include="MetadataValue.cpp" />
<ClCompile Include="MetaKey.cpp" />
<ClCompile Include="NonLibraryTrackHelper.cpp" />
<ClCompile Include="PluginFactory.cpp" />
<ClCompile Include="playback\NonLibraryTrackHelper.cpp" />
<ClCompile Include="playback\PlaybackQueue.cpp" />
<ClCompile Include="playback\Transport.cpp" />
<ClCompile Include="audio\Buffer.cpp" />
<ClCompile Include="audio\Player.cpp" />
<ClCompile Include="audio\Stream.cpp" />
<ClCompile Include="audio\Transport.cpp" />
<ClCompile Include="GenericTrack.cpp" />
<ClCompile Include="IndexerTrack.cpp" />
<ClCompile Include="LibraryTrack.cpp" />
<ClCompile Include="Track.cpp" />
<ClCompile Include="TrackFactory.cpp" />
<ClCompile Include="plugin\PluginFactory.cpp" />
<ClCompile Include="support\Common.cpp" />
<ClCompile Include="support\Preferences.cpp" />
<ClCompile Include="support\ThreadHelper.cpp" />
<ClCompile Include="support\Version.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="io\DataStreamFactory.h" />
<ClInclude Include="io\LocalFileStream.h" />
<ClInclude Include="Library\LocalLibrary.h" />
<ClInclude Include="library\Indexer.h" />
<ClInclude Include="library\LibraryBase.h" />
<ClInclude Include="library\LibraryFactory.h" />
<ClInclude Include="library\LocalLibrary.h" />
<ClInclude Include="library\metadata\MetadataValue.h" />
<ClInclude Include="Library\query\QueryFactory.h" />
<ClInclude Include="Library\query\LibraryTrackListQuery.h" />
<ClInclude Include="Library\query\ListQueryBase.h" />
@ -136,14 +137,17 @@
<ClInclude Include="Library\query\SortTracksWithDataQuery.h" />
<ClInclude Include="Library\query\TrackListQueryBase.h" />
<ClInclude Include="Library\query\TrackMetadataQuery.h" />
<ClInclude Include="library\track\GenericTrack.h" />
<ClInclude Include="library\track\IndexerTrack.h" />
<ClInclude Include="library\track\LibraryTrack.h" />
<ClInclude Include="library\track\Track.h" />
<ClInclude Include="library\track\TrackFactory.h" />
<ClInclude Include="pch.hpp" />
<ClInclude Include="PlaybackQueue.h" />
<ClInclude Include="Common.h" />
<ClInclude Include="config.h" />
<ClInclude Include="Crypt.h" />
<ClInclude Include="Image.h" />
<ClInclude Include="MessageQueue.h" />
<ClInclude Include="Preferences.h" />
<ClInclude Include="playback\NonLibraryTrackHelper.h" />
<ClInclude Include="playback\PlaybackQueue.h" />
<ClInclude Include="playback\Transport.h" />
<ClInclude Include="plugin\PluginFactory.h" />
<ClInclude Include="sdk\IAnalyzer.h" />
<ClInclude Include="sdk\IBuffer.h" />
<ClInclude Include="sdk\IDecoder.h" />
@ -156,28 +160,18 @@
<ClInclude Include="sdk\IPlayer.h" />
<ClInclude Include="sdk\IPlugin.h" />
<ClInclude Include="sdk\ITrack.h" />
<ClInclude Include="ThreadHelper.h" />
<ClInclude Include="Indexer.h" />
<ClInclude Include="LibraryFactory.h" />
<ClInclude Include="Library\LibraryBase.h" />
<ClInclude Include="db\CachedStatement.h" />
<ClInclude Include="db\Connection.h" />
<ClInclude Include="db\dbconfig.h" />
<ClInclude Include="db\ScopedTransaction.h" />
<ClInclude Include="db\Statement.h" />
<ClInclude Include="MetadataValue.h" />
<ClInclude Include="MetaKey.h" />
<ClInclude Include="NonLibraryTrackHelper.h" />
<ClInclude Include="PluginFactory.h" />
<ClInclude Include="audio\Buffer.h" />
<ClInclude Include="audio\Player.h" />
<ClInclude Include="audio\Stream.h" />
<ClInclude Include="audio\Transport.h" />
<ClInclude Include="GenericTrack.h" />
<ClInclude Include="IndexerTrack.h" />
<ClInclude Include="LibraryTrack.h" />
<ClInclude Include="Track.h" />
<ClInclude Include="TrackFactory.h" />
<ClInclude Include="support\Common.h" />
<ClInclude Include="support\Preferences.h" />
<ClInclude Include="support\ThreadHelper.h" />
<ClInclude Include="support\Version.h" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\3rdparty\3rdparty.vcxproj">

View File

@ -8,12 +8,6 @@
<Filter Include="src\support">
<UniqueIdentifier>{6a03fee0-b862-4be2-82df-5ecf9d5a2cf4}</UniqueIdentifier>
</Filter>
<Filter Include="src\metadata">
<UniqueIdentifier>{9f9ee41d-111b-4dab-8663-946253eeb46f}</UniqueIdentifier>
</Filter>
<Filter Include="src\plugins">
<UniqueIdentifier>{928fef19-2739-4485-83ae-1e18892247b0}</UniqueIdentifier>
</Filter>
<Filter Include="src\audio">
<UniqueIdentifier>{eb06b592-13c8-4826-b196-81f5783a3348}</UniqueIdentifier>
</Filter>
@ -38,29 +32,17 @@
<Filter Include="src\playback">
<UniqueIdentifier>{0e929af8-372d-4326-a4c6-796ec5c709d4}</UniqueIdentifier>
</Filter>
<Filter Include="src\plugin">
<UniqueIdentifier>{928fef19-2739-4485-83ae-1e18892247b0}</UniqueIdentifier>
</Filter>
<Filter Include="src\library\metadata">
<UniqueIdentifier>{9f9ee41d-111b-4dab-8663-946253eeb46f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="Common.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="Crypt.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="Image.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="MessageQueue.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="Preferences.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="ThreadHelper.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="db\CachedStatement.cpp">
<Filter>src\db</Filter>
</ClCompile>
@ -73,18 +55,6 @@
<ClCompile Include="db\Statement.cpp">
<Filter>src\db</Filter>
</ClCompile>
<ClCompile Include="MetadataValue.cpp">
<Filter>src\metadata</Filter>
</ClCompile>
<ClCompile Include="MetaKey.cpp">
<Filter>src\metadata</Filter>
</ClCompile>
<ClCompile Include="NonLibraryTrackHelper.cpp">
<Filter>src\metadata</Filter>
</ClCompile>
<ClCompile Include="PluginFactory.cpp">
<Filter>src\plugins</Filter>
</ClCompile>
<ClCompile Include="audio\Buffer.cpp">
<Filter>src\audio</Filter>
</ClCompile>
@ -94,27 +64,6 @@
<ClCompile Include="audio\Stream.cpp">
<Filter>src\audio</Filter>
</ClCompile>
<ClCompile Include="GenericTrack.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="IndexerTrack.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="LibraryTrack.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="Track.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="TrackFactory.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="Library\LibraryBase.cpp">
<Filter>src\library</Filter>
</ClCompile>
<ClCompile Include="Library\LocalLibrary.cpp">
<Filter>src\library</Filter>
</ClCompile>
<ClCompile Include="Library\query\LibraryTrackListQuery.cpp">
<Filter>src\library\query</Filter>
</ClCompile>
@ -151,41 +100,65 @@
<ClCompile Include="io\DataStreamFactory.cpp">
<Filter>src\io</Filter>
</ClCompile>
<ClCompile Include="Indexer.cpp">
<Filter>src\library</Filter>
<ClCompile Include="support\Preferences.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="LibraryFactory.cpp">
<Filter>src\library</Filter>
<ClCompile Include="support\ThreadHelper.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="PlaybackQueue.cpp">
<ClCompile Include="support\Common.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="playback\Transport.cpp">
<Filter>src\playback</Filter>
</ClCompile>
<ClCompile Include="audio\Transport.cpp">
<ClCompile Include="playback\PlaybackQueue.cpp">
<Filter>src\playback</Filter>
</ClCompile>
<ClCompile Include="library\Indexer.cpp">
<Filter>src\library</Filter>
</ClCompile>
<ClCompile Include="library\LibraryBase.cpp">
<Filter>src\library</Filter>
</ClCompile>
<ClCompile Include="library\LocalLibrary.cpp">
<Filter>src\library</Filter>
</ClCompile>
<ClCompile Include="library\track\GenericTrack.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="library\track\IndexerTrack.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="library\track\LibraryTrack.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="library\track\Track.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="library\track\TrackFactory.cpp">
<Filter>src\library\track</Filter>
</ClCompile>
<ClCompile Include="library\LibraryFactory.cpp">
<Filter>src\library</Filter>
</ClCompile>
<ClCompile Include="plugin\PluginFactory.cpp">
<Filter>src\plugin</Filter>
</ClCompile>
<ClCompile Include="support\Version.cpp">
<Filter>src\support</Filter>
</ClCompile>
<ClCompile Include="playback\NonLibraryTrackHelper.cpp">
<Filter>src\playback</Filter>
</ClCompile>
<ClCompile Include="library\metadata\MetadataValue.cpp">
<Filter>src\library\metadata</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="pch.hpp">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="Common.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="Crypt.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="Image.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="MessageQueue.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="Preferences.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="ThreadHelper.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="db\CachedStatement.h">
<Filter>src\db</Filter>
</ClInclude>
@ -201,18 +174,6 @@
<ClInclude Include="db\Statement.h">
<Filter>src\db</Filter>
</ClInclude>
<ClInclude Include="MetadataValue.h">
<Filter>src\metadata</Filter>
</ClInclude>
<ClInclude Include="MetaKey.h">
<Filter>src\metadata</Filter>
</ClInclude>
<ClInclude Include="NonLibraryTrackHelper.h">
<Filter>src\metadata</Filter>
</ClInclude>
<ClInclude Include="PluginFactory.h">
<Filter>src\plugins</Filter>
</ClInclude>
<ClInclude Include="audio\Buffer.h">
<Filter>src\audio</Filter>
</ClInclude>
@ -222,21 +183,6 @@
<ClInclude Include="audio\Stream.h">
<Filter>src\audio</Filter>
</ClInclude>
<ClInclude Include="GenericTrack.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="IndexerTrack.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="LibraryTrack.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="Track.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="TrackFactory.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="sdk\IDecoder.h">
<Filter>src\sdk</Filter>
</ClInclude>
@ -273,12 +219,6 @@
<ClInclude Include="sdk\IDataStreamFactory.h">
<Filter>src\sdk</Filter>
</ClInclude>
<ClInclude Include="Library\LibraryBase.h">
<Filter>src\library</Filter>
</ClInclude>
<ClInclude Include="Library\LocalLibrary.h">
<Filter>src\library</Filter>
</ClInclude>
<ClInclude Include="Library\query\LibraryTrackListQuery.h">
<Filter>src\library\query</Filter>
</ClInclude>
@ -315,20 +255,62 @@
<ClInclude Include="io\DataStreamFactory.h">
<Filter>src\io</Filter>
</ClInclude>
<ClInclude Include="Indexer.h">
<Filter>src\library</Filter>
</ClInclude>
<ClInclude Include="LibraryFactory.h">
<Filter>src\library</Filter>
</ClInclude>
<ClInclude Include="config.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="PlaybackQueue.h">
<ClInclude Include="support\Common.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="support\Preferences.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="support\ThreadHelper.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="playback\Transport.h">
<Filter>src\playback</Filter>
</ClInclude>
<ClInclude Include="audio\Transport.h">
<ClInclude Include="playback\PlaybackQueue.h">
<Filter>src\playback</Filter>
</ClInclude>
<ClInclude Include="library\Indexer.h">
<Filter>src\library</Filter>
</ClInclude>
<ClInclude Include="library\LibraryBase.h">
<Filter>src\library</Filter>
</ClInclude>
<ClInclude Include="library\LocalLibrary.h">
<Filter>src\library</Filter>
</ClInclude>
<ClInclude Include="library\track\GenericTrack.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="library\track\IndexerTrack.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="library\track\LibraryTrack.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="library\track\Track.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="library\track\TrackFactory.h">
<Filter>src\library\track</Filter>
</ClInclude>
<ClInclude Include="library\LibraryFactory.h">
<Filter>src\library</Filter>
</ClInclude>
<ClInclude Include="plugin\PluginFactory.h">
<Filter>src\plugin</Filter>
</ClInclude>
<ClInclude Include="support\Version.h">
<Filter>src\support</Filter>
</ClInclude>
<ClInclude Include="playback\NonLibraryTrackHelper.h">
<Filter>src\playback</Filter>
</ClInclude>
<ClInclude Include="library\metadata\MetadataValue.h">
<Filter>src\library\metadata</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -38,7 +38,7 @@
#include <core/io/DataStreamFactory.h>
#include <core/config.h>
#include <core/PluginFactory.h>
#include <core/plugin/PluginFactory.h>
#include <core/io/LocalFileStream.h>
using namespace musik::core::io;

View File

@ -38,7 +38,7 @@
#include <core/io/LocalFileStream.h>
#include <core/config.h>
#include <core/Common.h>
#include <core/support/Common.h>
#include <core/config.h>
#ifdef UTF_WIDECHAR

View File

@ -36,15 +36,15 @@
#include "pch.hpp"
#include <core/Indexer.h>
#include <core/library/Indexer.h>
#include <core/config.h>
#include <core/config.h>
#include <core/IndexerTrack.h>
#include <core/library/track/IndexerTrack.h>
#include <core/db/Connection.h>
#include <core/db/Statement.h>
#include <core/PluginFactory.h>
#include <core/Preferences.h>
#include <core/plugin/PluginFactory.h>
#include <core/support/Preferences.h>
#include <core/sdk/IAnalyzer.h>
#include <core/audio/Stream.h>

View File

@ -38,7 +38,7 @@
//#include <core/config.h>
#include <core/ThreadHelper.h>
#include <core/support/ThreadHelper.h>
#include <core/db/Connection.h>
#include <core/sdk/IMetaDataReader.h>

View File

@ -36,10 +36,10 @@
#include "pch.hpp"
#include <core/Library/LibraryBase.h>
#include <core/library/LibraryBase.h>
#include <core/config.h>
#include <core/library/query/QueryBase.h>
#include <core/Common.h>
#include <core/support/Common.h>
using namespace musik::core;
using namespace musik::core::library;

View File

@ -34,11 +34,11 @@
//
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/LibraryFactory.h>
#include <core/Library/LocalLibrary.h>
#include <core/library/LibraryFactory.h>
#include <core/library/LocalLibrary.h>
#include <core/db/Connection.h>
#include <core/Common.h>
#include <core/Preferences.h>
#include <core/support/Common.h>
#include <core/support/Preferences.h>
using namespace musik::core;

View File

@ -36,9 +36,9 @@
#include "pch.hpp"
#include <core/Library/LocalLibrary.h>
#include <core/library/LocalLibrary.h>
#include <core/library/query/QueryBase.h>
#include <core/Preferences.h>
#include <core/support/Preferences.h>
#include <boost/bind.hpp>

View File

@ -49,8 +49,8 @@ namespace musik{ namespace core{
#include <core/db/Connection.h>
#include <core/db/Statement.h>
#include <core/db/ScopedTransaction.h>
#include <core/Library/LibraryBase.h>
#include <core/Indexer.h>
#include <core/library/LibraryBase.h>
#include <core/library/Indexer.h>
//////////////////////////////////////////////////////////////////////////////

View File

@ -35,7 +35,7 @@
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/MetadataValue.h>
#include <core/library/metadata/MetadataValue.h>
using namespace musik::core;

View File

@ -43,8 +43,8 @@
#include <string>
#include <vector>
namespace musik{ namespace core{
class MetadataValue{
namespace musik { namespace core {
class MetadataValue{
public:
MetadataValue(void);
MetadataValue(const DBID newId,const char *value);
@ -54,6 +54,7 @@ namespace musik{ namespace core{
std::string value;
};
typedef boost::shared_ptr<MetadataValue> MetadataValuePtr;
typedef std::vector<MetadataValuePtr> MetadataValueVector;

View File

@ -37,7 +37,7 @@
#include "pch.hpp"
#include <core/library/query/LibraryTrackListQuery.h>
#include <core/LibraryTrack.h>
#include <core/library/track/LibraryTrack.h>
#include <core/library/query/SortTracksQuery.h>
//////////////////////////////////////////////////////////////////////////////

View File

@ -47,8 +47,6 @@
#include <map>
#include <sigslot/sigslot.h>
//////////////////////////////////////////////////////////////////////////////
namespace musik{ namespace core{ namespace tracklist {
//////////////////////////////////////////////////////////////////////////////

View File

@ -38,8 +38,8 @@
#include <core/library/query/ListQueryBase.h>
#include <core/library/LibraryBase.h>
#include <core/Common.h>
#include <core/LibraryTrack.h>
#include <core/support/Common.h>
#include <core/library/track/LibraryTrack.h>
#include <boost/algorithm/string.hpp>
using namespace musik::core;

View File

@ -37,8 +37,8 @@
#pragma once
#include <core/library/query/QueryBase.h>
#include <core/MetadataValue.h>
#include <core/LibraryTrack.h>
#include <core/library/metadata/MetadataValue.h>
#include <core/library/track/LibraryTrack.h>
#include <sigslot/sigslot.h>
#include <vector>

View File

@ -37,9 +37,9 @@
#include "pch.hpp"
#include <core/library/query/MultiLibraryTrackListQuery.h>
#include <core/LibraryTrack.h>
#include <core/LibraryFactory.h>
#include <core/NonLibraryTrackHelper.h>
#include <core/library/track/LibraryTrack.h>
#include <core/library/LibraryFactory.h>
#include <core/playback/NonLibraryTrackHelper.h>
#include <set>

View File

@ -37,7 +37,7 @@
#include "pch.hpp"
#include <core/library/query/QueryBase.h>
#include <core/Library/LibraryBase.h>
#include <core/library/LibraryBase.h>
using namespace musik::core;
using namespace musik::core::query;

View File

@ -40,8 +40,8 @@
#include <core/library/LibraryBase.h>
#include <core/config.h>
#include <boost/algorithm/string.hpp>
#include <core/LibraryTrack.h>
#include <core/Common.h>
#include <core/library/track/LibraryTrack.h>
#include <core/support/Common.h>
using namespace musik::core;
using namespace musik::core::query;

View File

@ -38,7 +38,7 @@
#include <core/config.h>
#include <core/library/query/QueryBase.h>
#include <core/Track.h>
#include <core/library/track/Track.h>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>

View File

@ -39,7 +39,7 @@
//////////////////////////////////////////////////////////////////////////////
#include <core/config.h>
#include <core/Track.h>
#include <core/library/track/Track.h>
#include <core/library/LibraryBase.h>
#include <core/library/query/ListQueryBase.h>

View File

@ -36,10 +36,10 @@
#include "pch.hpp"
#include <core/Common.h>
#include <core/support/Common.h>
#include <core/library/query/TrackMetadataQuery.h>
#include <core/library/LibraryBase.h>
#include <core/LibraryTrack.h>
#include <core/library/track/LibraryTrack.h>
#include <boost/algorithm/string.hpp>
using namespace musik::core;

View File

@ -44,7 +44,7 @@
#include <core/library/query/QueryBase.h>
#include <core/config.h>
#include <core/Track.h>
#include <core/library/track/Track.h>
#include <map>
#include <set>

View File

@ -36,8 +36,8 @@
#include "pch.hpp"
#include <core/GenericTrack.h>
#include <core/NonLibraryTrackHelper.h>
#include <core/library/track/GenericTrack.h>
#include <core/playback/NonLibraryTrackHelper.h>
using namespace musik::core;

View File

@ -37,7 +37,7 @@
#pragma once
#include <core/config.h>
#include <core/Track.h>
#include <core/library/track/Track.h>
#include <core/library/LibraryBase.h>
#include <boost/weak_ptr.hpp>
#include <boost/thread/mutex.hpp>

View File

@ -36,9 +36,9 @@
#include "pch.hpp"
#include <core/IndexerTrack.h>
#include <core/library/track/IndexerTrack.h>
#include <core/Common.h>
#include <core/support/Common.h>
#include <core/db/Connection.h>
#include <core/db/Statement.h>
#include <core/library/LibraryBase.h>

View File

@ -37,7 +37,7 @@
#pragma once
#include <core/config.h>
#include <core/Track.h>
#include <core/library/track/Track.h>
#include <core/library/LibraryBase.h>
namespace musik { namespace core {

View File

@ -36,10 +36,10 @@
#include "pch.hpp"
#include <core/LibraryTrack.h>
#include <core/LibraryFactory.h>
#include <core/library/track/LibraryTrack.h>
#include <core/library/LibraryFactory.h>
#include <core/Common.h>
#include <core/support/Common.h>
#include <core/db/Connection.h>
#include <core/db/Statement.h>
#include <core/library/LibraryBase.h>

View File

@ -37,7 +37,7 @@
#pragma once
#include <core/config.h>
#include <core/Track.h>
#include <core/library/track/Track.h>
#include <core/library/LibraryBase.h>
namespace musik { namespace core { namespace http {

View File

@ -36,7 +36,7 @@
#include "pch.hpp"
#include <core/Track.h>
#include <core/library/track/Track.h>
#include <core/library/LibraryBase.h>
using namespace musik::core;

View File

@ -35,9 +35,9 @@
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/TrackFactory.h>
#include <core/LibraryTrack.h>
#include <core/GenericTrack.h>
#include <core/library/track/TrackFactory.h>
#include <core/library/track/LibraryTrack.h>
#include <core/library/track/GenericTrack.h>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>

View File

@ -37,7 +37,7 @@
#pragma once
#include <core/config.h>
#include <core/Track.h>
#include <core/library/track/Track.h>
namespace musik { namespace core {

View File

@ -36,9 +36,9 @@
#include "pch.hpp"
#include <core/NonLibraryTrackHelper.h>
#include <core/playback/NonLibraryTrackHelper.h>
#include <boost/bind.hpp>
#include <core/PluginFactory.h>
#include <core/plugin/PluginFactory.h>
#include <core/sdk/IMetaDataReader.h>
#include <core/io/DataStreamFactory.h>

View File

@ -37,7 +37,7 @@
#pragma once
#include <core/config.h>
#include <core/Track.h>
#include <core/library/track/Track.h>
#include <boost/scoped_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/thread/mutex.hpp>

View File

@ -30,9 +30,11 @@
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/PlaybackQueue.h>
#include <core/LibraryFactory.h>
#include <core/playback/PlaybackQueue.h>
#include <core/library/LibraryFactory.h>
#include <core/library/query/MultiLibraryTrackListQuery.h>
#include <boost/algorithm/string.hpp>

View File

@ -35,7 +35,7 @@
//////////////////////////////////////////////////////////////////////////////
#include <core/audio/Transport.h>
#include <core/playback/Transport.h>
#include <core/library/query/TrackListQueryBase.h>
#include <core/library/query/TrackMetadataQuery.h>
#include <sigslot/sigslot.h>

View File

@ -33,7 +33,7 @@
#include "pch.hpp"
#include <core/audio/Transport.h>
#include <core/playback/Transport.h>
using namespace musik::core::audio;

View File

@ -35,10 +35,10 @@
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/PluginFactory.h>
#include <core/config.h>
#include <core/Common.h>
#include <core/plugin/PluginFactory.h>
#include <core/config.h>
#include <core/support/Common.h>
using namespace musik::core;

View File

@ -35,7 +35,7 @@
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/Common.h>
#include <core/support/Common.h>
#include <core/config.h>
#include <utf8/utf8.h>

View File

@ -35,9 +35,9 @@
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/Preferences.h>
#include <core/support/Preferences.h>
#include <core/Common.h>
#include <core/support/Common.h>
#include <core/db/CachedStatement.h>
#include <boost/lexical_cast.hpp>

View File

@ -35,7 +35,7 @@
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/ThreadHelper.h>
#include <core/support/ThreadHelper.h>
using namespace musik::core;

View File

@ -35,51 +35,51 @@
//////////////////////////////////////////////////////////////////////////////
#include "pch.hpp"
#include <core/Version.h>
#include <core/support/Version.h>
#include <boost/format.hpp>
using namespace musik::core;
Version::Version(void):iVersion(0){
Version::Version()
: version(0) {
}
Version::Version(VERSION iMajor,VERSION iMinor,VERSION iRevision,VERSION iBuild){
iVersion = ((iMajor&0xff)<<48) | ((iMinor&0xff)<<32) | ((iRevision&0xff)<<16) | (iBuild&0xff);
Version::Version(VERSION major, VERSION minor, VERSION revision, VERSION build) {
version = ((major & 0xff) << 48) | ((minor & 0xff) << 32) | ((revision & 0xff) << 16) | (build & 0xff);
}
Version::Version(VERSION iNewVersion):iVersion(iNewVersion){
Version::Version(VERSION version)
: version(version){
}
void Version::setVersion(VERSION iMajor,VERSION iMinor,VERSION iRevision,VERSION iBuild){
iVersion = ((iMajor&0xff)<<48) | ((iMinor&0xff)<<32) | ((iRevision&0xff)<<16) | (iBuild&0xff);
void Version::setVersion(VERSION major, VERSION minor, VERSION revision, VERSION build){
version = ((major & 0xff) << 48) | ((minor & 0xff) << 32) | ((revision & 0xff) << 16) | (build & 0xff);
}
void Version::setVersion(VERSION iNewVersion){
iVersion = iNewVersion;
void Version::setVersion(VERSION version){
version = version;
}
Version::~Version(void){
}
utfstring Version::getVersion(){
utfstring sVersion;
sVersion = boost::str( boost::wformat(UTF("%1%.%2%.%3%.%4%")) %
((iVersion>>48) & 0xff) %
((iVersion>>32) & 0xff) %
((iVersion>>16) & 0xff) %
(iVersion & 0xff) );
return sVersion;
std::string Version::getVersion() {
return boost::str(boost::format("%1%.%2%.%3%.%4%")
% ((version >> 48) & 0xff)
% ((version >> 32) & 0xff)
% ((version >> 16) & 0xff)
% (version & 0xff));
}
int Version::getMajorVersion(){
return (int)((iVersion>>48) & 0xff);
int Version::getMajorVersion() {
return (int)((version >> 48) & 0xff);
}
int Version::getMinorVersion(){
return (int)((iVersion>>32) & 0xff);
int Version::getMinorVersion() {
return (int)((version >> 32) & 0xff);
}
int Version::getRevisionVersion(){
return (int)((iVersion>>16) & 0xff);
int Version::getRevisionVersion() {
return (int)((version >> 16) & 0xff);
}
int Version::getBuildVersion(){
return (int)(iVersion & 0xff);
int Version::getBuildVersion() {
return (int)(version & 0xff);
}

View File

@ -40,24 +40,25 @@
#include <string>
namespace musik{ namespace core{
class Version{
namespace musik { namespace core {
class Version{
public:
Version(void);
Version(VERSION iMajor,VERSION iMinor,VERSION iRevision,VERSION iBuild);
Version(VERSION iNewVersion);
~Version(void);
VERSION iVersion;
utfstring getVersion();
void setVersion(VERSION iMajor,VERSION iMinor,VERSION iRevision,VERSION iBuild);
void setVersion(VERSION iNewVersion);
Version();
Version(VERSION major, VERSION minor, VERSION revision, VERSION build);
Version(VERSION version);
~Version();
std::string getVersion();
void setVersion(VERSION major, VERSION minor, VERSION revision, VERSION build);
void setVersion(VERSION version);
int getMajorVersion();
int getMinorVersion();
int getRevisionVersion();
int getBuildVersion();
private:
VERSION version;
};
} }

View File

@ -40,11 +40,11 @@
#include <boost/algorithm/string.hpp>
#include <core/sdk/IPlugin.h>
#include <core/PluginFactory.h>
#include <core/plugin/PluginFactory.h>
#include <core/TrackFactory.h>
#include <core/LibraryFactory.h>
#include <core/Indexer.h>
#include <core/library/track/TrackFactory.h>
#include <core/library/LibraryFactory.h>
#include <core/library/Indexer.h>
using namespace musik::square;

View File

@ -41,7 +41,7 @@
#include <boost/thread/mutex.hpp>
#include <core/audio/Transport.h>
#include <core/playback/Transport.h>
#include "DummyAudioEventHandler.h"