From e33f9928fb67cc4e9173f42a9718298a9f753f49 Mon Sep 17 00:00:00 2001 From: Casey Langen Date: Wed, 25 May 2016 22:02:09 -0700 Subject: [PATCH] Incremental checkin for compiling on mac. 3rdparty compiles, and core is nearly there (boost::async not working) --- .gitignore | 4 + CMakeLists.txt | 139 +++----- src/3rdparty/CMakeLists.txt | 43 +-- src/core/CMakeLists.txt | 351 +++++--------------- src/core/audio/Player.cpp | 48 +-- src/core/io/DataStreamFactory.h | 5 +- src/core/library/IIndexer.h | 4 +- src/core/library/ILibrary.h | 6 +- src/core/library/IQuery.h | 6 +- src/core/library/Indexer.cpp | 29 +- src/core/library/Indexer.h | 8 +- src/core/library/query/PlaylistLoad.cpp | 89 ----- src/core/library/query/PlaylistLoad.h | 87 ----- src/core/library/query/PlaylistSave.cpp | 136 -------- src/core/library/query/PlaylistSave.h | 94 ------ src/core/library/query/Playlists.cpp | 106 ------ src/core/library/query/Playlists.h | 90 ----- src/core/library/track/IndexerTrack.cpp | 34 +- src/core/library/track/IndexerTrack.h | 15 +- src/core/library/track/LibraryTrack.h | 5 +- src/core/playback/NonLibraryTrackHelper.cpp | 10 +- src/core/playback/Transport.cpp | 68 ++-- src/core/playback/Transport.h | 36 +- src/core/plugin/PluginFactory.cpp | 9 +- src/core/plugin/PluginFactory.h | 4 +- src/core/sdk/IBufferProvider.h | 40 +-- src/core/sdk/config.h | 6 +- 27 files changed, 307 insertions(+), 1165 deletions(-) delete mode 100644 src/core/library/query/PlaylistLoad.cpp delete mode 100644 src/core/library/query/PlaylistLoad.h delete mode 100644 src/core/library/query/PlaylistSave.cpp delete mode 100644 src/core/library/query/PlaylistSave.h delete mode 100644 src/core/library/query/Playlists.cpp delete mode 100644 src/core/library/query/Playlists.h diff --git a/.gitignore b/.gitignore index fa3cf244f..01f1b1fee 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,10 @@ **/*.VC.db **/*.VC.opendb **/*.suo +**/CMakeCache.txt +**/CMakeFiles +**/Makefile +**/cmake_install.cmake bin obj ipch diff --git a/CMakeLists.txt b/CMakeLists.txt index c161ece64..2e57d26ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,116 +1,57 @@ -cmake_minimum_required(VERSION 2.6) -project( musikCube ) +cmake_minimum_required(VERSION 3.0) -set ( musikCube_VERSION_MAJOR 2) -set ( musikCube_VERSION_MINOR 0) +project(musikbox) -set (CMAKE_MODULE_PATH ${musikCube_SOURCE_DIR}/modules) +set (musikbox_VERSION_MAJOR 0) +set (musikbox_VERSION_MINOR 1) + +set (CMAKE_MODULE_PATH ${musikbox_SOURCE_DIR}/modules) set (BOOST_LIBS -system -date_time -filesystem -iostreams -thread -regex + system + date_time + filesystem + iostreams + thread + regex ) -include_directories(${musikCube_SOURCE_DIR}/src/3rdparty/lib) +find_package(Boost 1.60.0 REQUIRED ${BOOST_LIBS}) -set (Boost_ADDITIONAL_VERSIONS "1.37.0" ) -if(WIN32 AND NOT UNIX) - find_package(Boost 1.42.0 REQUIRED ${BOOST_LIBS} ) - if (Boost_FOUND) - add_definitions ( - -DHAVE_BOOST - ) - #set (BOOST_LINK_LIBS - # ${Boost_LIBRARIES}) - include_directories (${Boost_INCLUDE_DIRS}) - link_directories(${Boost_LIBRARY_DIRS}) - #message(STATUS "Boost includes: " ${Boost_INCLUDE_DIRS}) - #message(STATUS "Boost libs: " ${Boost_LIBRARIES}) - else (Boost_FOUND) - set (BOOST_LINK_LIBS - boost_system - boost_iostreams - boost_filesystem - boost_thread - boost_regex - boost_date_time - ) - include_directories ("${musikCube_SOURCE_DIR}/src/3rdparty/boost") - endif (Boost_FOUND) - #set (VLD_ROOT_DIR ${musikCube_SOURCE_DIR}/src/3rdparty/lib) - #set (VLD_INCLUDE_DIR ${musikCube_SOURCE_DIR}/src/3rdparty/include) - #find_package(vld REQUIRED) - #if (VLD_FOUND) - # message(STATUS "VLD Found") - # link_directories(${VLD_LIBRARIES_DIR}) - #else (VLD_FOUND) - # message(STATUS "VLD not found") - #endif (VLD_FOUND) - add_definitions ( - -DUNICODE - -D_UNICODE - ) -else(WIN32 AND NOT UNIX) - find_package(Boost 1.42.0 REQUIRED ${BOOST_LIBS}) - if(Boost_FOUND) - add_definitions (-DHAVE_BOOST - -D_FILE_OFFSET_BITS=64) - set (BOOST_LINK_LIBS - ${Boost_LIBRARIES}) - # message(STATUS "Libs: " ${BOOST_LINK_LIBS}) - # message(STATUS "Includes: " ${Boost_INCLUDE_DIRS}) - else(Boost_FOUND) - set (BOOST_LINK_LIBS - boost_system - boost_iostreams - boost_filesystem - boost_thread - boost_regex - boost_date_time - ) - include_directories ("${musikCube_SOURCE_DIR}/src/3rdparty/boost") - endif(Boost_FOUND) - find_package(Qt4 REQUIRED) - #add_definitions(${QT_DEFINITIONS}) - #include_directories(${QT_INCLUDE_DIR}) - set (linux_LINK_LIBS - dl - expat - ) - #include_directories( "/usr/include/taglib" ) - set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/Modules ) - #include(UseDoxygen) - set(DOXYFILE_OUTPUT_DIRECTORY docs) -endif(WIN32 AND NOT UNIX) +add_definitions (-DHAVE_BOOST + -D_FILE_OFFSET_BITS=64) +set (BOOST_LINK_LIBS + ${Boost_LIBRARIES}) +message(STATUS "Libs: " ${BOOST_LINK_LIBS}) +message(STATUS "Includes: " ${Boost_INCLUDE_DIRS}) + +set (linux_LINK_LIBS + dl +) + +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/Modules) SET (CMAKE_BUILD_TYPE DEBUG) -set (LIBRARY_OUTPUT_PATH ${musikCube_SOURCE_DIR}/bin/plugins) -set (EXECUTABLE_OUTPUT_PATH ${musikCube_SOURCE_DIR}/bin) +set (LIBRARY_OUTPUT_PATH ${musikbox_SOURCE_DIR}/bin/plugins) +set (EXECUTABLE_OUTPUT_PATH ${musikbox_SOURCE_DIR}/bin) -link_directories (${musikCube_SOURCE_DIR}/bin/plugins) +link_directories (${musikbox_SOURCE_DIR}/bin/plugins) -set (musikCube_LINK_LIBS - ${linux_LINK_LIBS} - ${BOOST_LINK_LIBS} - sqlite3 - md5 +set (musikbox_LINK_LIBS + ${linux_LINK_LIBS} + ${BOOST_LINK_LIBS} + sqlite3 + md5 ) include_directories ( - "${musikCube_SOURCE_DIR}/src" - "${musikCube_SOURCE_DIR}/src/core" - "${musikCube_SOURCE_DIR}/src/core/audio" - "${musikCube_SOURCE_DIR}/src/3rdparty/include") + "${musikbox_SOURCE_DIR}/src" + "${musikbox_SOURCE_DIR}/src/core" + "${musikbox_SOURCE_DIR}/src/3rdparty/include" +) add_subdirectory(src/3rdparty) add_subdirectory(src/core) -add_subdirectory(src/contrib) -add_subdirectory(src/win32cpp) -add_subdirectory(src/server) -add_subdirectory(src/square) -#add_subdirectory(src/cube) +#add_subdirectory(src/contrib) +#add_subdirectory(src/musikbox) diff --git a/src/3rdparty/CMakeLists.txt b/src/3rdparty/CMakeLists.txt index b582aa290..bc3bc8dfa 100644 --- a/src/3rdparty/CMakeLists.txt +++ b/src/3rdparty/CMakeLists.txt @@ -1,41 +1,28 @@ if (UNIX AND NOT WIN32) - if (CMAKE_SIZEOF_VOID_P MATCHES "8") - add_definitions(-fPIC) - endif (CMAKE_SIZEOF_VOID_P MATCHES "8") + if (CMAKE_SIZEOF_VOID_P MATCHES "8") + add_definitions(-fPIC) + endif (CMAKE_SIZEOF_VOID_P MATCHES "8") endif (UNIX AND NOT WIN32) set (3rdParty_MD5_SOURCES - include/md5/md5.h - src/md5/md5.c + include/md5/md5.h + src/md5/md5.c ) set (3rdParty_SQLITE_SOURCES - include/sqlite/sqlite3.h - include/sqlite/sqlite3ext.h - src/sqlite/sqlite3.c + include/sqlite/sqlite3.h + include/sqlite/sqlite3ext.h + src/sqlite/sqlite3.c ) -FILE(GLOB_RECURSE EXPAT_HEADERS include/expat/*.h) -FILE(GLOB_RECURSE EXPAT_SRC src/expat/*.c) -set (3rdParty_EXPAT_SOURCES - ${EXPAT_HEADERS} - ${EXPAT_SRC} -) +include_directories (include/md5) +add_library(md5 STATIC ${3rdParty_MD5_SOURCES}) -set (ZLIB_INCLUDE_DIR ${musikCube_SOURCE_DIRECTORY}/src/3rdparty/include) -set (ZLIB_LIBRARY ${musikCube_SOURCE_DIRECTORY}/src/3rdparty/lib) +include_directories (include/sqlite) +add_library(sqlite3 STATIC ${3rdParty_SQLITE_SOURCES}) -include_directories ( include/md5 ) -add_library( md5 STATIC ${3rdParty_MD5_SOURCES} ) - -include_directories ( include/sqlite ) -add_library( sqlite3 STATIC ${3rdParty_SQLITE_SOURCES} ) - -include_directories ( include/expat ) if (WIN32) -add_definitions( - -DHAVE_MEMMOVE -) -#Must find a better way of solving this + add_definitions( + -DHAVE_MEMMOVE + ) endif (WIN32) -add_library( expat STATIC ${3rdParty_EXPAT_SOURCES} ) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index e809f8b14..d86215985 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,283 +1,94 @@ -set(CORE_SOURCES - pch.cpp - PlaybackQueue.cpp - Common.cpp - Crypt.cpp - Image.cpp - MessageQueue.cpp - Preferences.cpp - ThreadHelper.cpp - tracklist/Base.cpp - tracklist/LibraryList.cpp - tracklist/MultiLibraryList.cpp - Indexer.cpp - LibraryFactory.cpp - Query/Base.cpp - Query/Factory.cpp - Query/ListBase.cpp - Query/ListSelection.cpp - Query/SortTracks.cpp - Query/SortTracksWithData.cpp - Query/TrackMetadata.cpp - Library/Base.cpp - Library/LocalDB.cpp - Library/Remote.cpp - db/CachedStatement.cpp - db/Connection.cpp - db/ScopedTransaction.cpp - db/Statement.cpp - MetadataValue.cpp - MetaKey.cpp - NonLibraryTrackHelper.cpp - PluginFactory.cpp - audio/Buffer.cpp - audio/Player.cpp - audio/Stream.cpp - audio/Transport.cpp - server/Connection.cpp - server/User.cpp - server/UserSession.cpp - xml/Node.cpp - xml/Parser.cpp - xml/ParserNode.cpp - xml/Socket.cpp - xml/Writer.cpp - xml/WriterNode.cpp - http/RequestParser.cpp - http/Responder.cpp - http/Server.cpp - http/TrackSender.cpp - filestreams/Factory.cpp - filestreams/LocalFileStream.cpp - GenericTrack.cpp - IndexerTrack.cpp - LibraryTrack.cpp - Track.cpp - TrackFactory.cpp - Server.cpp +set(CORE_SOURCES + ./debug.cpp + ./pch.cpp + ./audio/Buffer.cpp + ./audio/Player.cpp + ./audio/Stream.cpp + ./db/CachedStatement.cpp + ./db/Connection.cpp + ./db/ScopedTransaction.cpp + ./db/Statement.cpp + ./io/DataStreamFactory.cpp + ./io/LocalFileStream.cpp + ./library/Indexer.cpp + ./library/LibraryFactory.cpp + ./library/LocalLibrary.cpp + ./library/metadata/MetadataKeyValue.cpp + ./library/metadata/MetadataValue.cpp + ./library/query/QueryBase.cpp + ./library/track/IndexerTrack.cpp + ./library/track/LibraryTrack.cpp + ./library/track/Track.cpp + ./playback/NonLibraryTrackHelper.cpp + ./playback/Transport.cpp + ./plugin/PluginFactory.cpp + ./support/Common.cpp + ./support/Preferences.cpp + ./support/ThreadHelper.cpp + ./support/Version.cpp ) set (CORE_HEADERS - Common.h - config.h - config_filesystem.h - config_format.h - Crypt.h - Image.h - Indexer.h - IndexerTrack.h - IPlugin.h - ITrack.h - LibraryFactory.h - MessageQueue.h - MetadataValue.h - MetaKey.h - musik_dll_exports.h - NonLibraryTrackHelper.h - pch.hpp - PlaybackQueue.h - PluginFactory.h - Preferences.h - Server.h - ThreadHelper.h - Track.h - TrackFactory.h - Version.h - audio/Buffer.h - audio/IAnalyzer.h - audio/IBuffer.h - audio/IDecoder.h - audio/IDecoderFactory.h - audio/IDSP.h - audio/IOutput.h - audio/IPlayer.h - audio/Player.h - audio/Stream.h - audio/Transport.h - db/CachedStatement.h - db/Connection.h - db/dbconfig.h - db/ScopedTransaction.h - db/Statement.h - filestreams/Factory.h - filestreams/IFileStream.h - filestreams/IFileStreamFactory.h - filestreams/LocalFileStream.h - http/IRequestParser.h - http/IRequestPlugin.h - http/IResponder.h - http/RequestParser.h - http/Responder.h - http/Server.h - http/TrackSender.h - Library/Base.h - Library/LocalDB.h - Library/Remote.h - Plugin/IMetaDataReader.h - Query/Base.h - Query/Factory.h - Query/ListBase.h - Query/ListSelection.h - Query/PlaylistLoad.h - Query/Playlists.h - Query/PlaylistSave.h - Query/SortTracks.h - Query/SortTracksWithData.h - Query/TrackMetadata.h - server/Connection.h - server/User.h - server/UserSession.h - tracklist/Base.h - tracklist/LibraryList.h - tracklist/MultiLibraryList.h - xml/IReadSupplier.h - xml/IWriteSupplier.h - xml/Node.h - xml/Parser.h - xml/ParserNode.h - xml/Socket.h - xml/Writer.h - xml/WriterNode.h + ./config.h + ./debug.h + ./pch.hpp + ./audio/Buffer.h + ./audio/Player.h + ./audio/Stream.h + ./db/CachedStatement.h + ./db/Connection.h + ./db/ScopedTransaction.h + ./db/Statement.h + ./db/dbconfig.h + ./io/DataStreamFactory.h + ./io/LocalFileStream.h + ./library/IIndexer.h + ./library/ILibrary.h + ./library/IQuery.h + ./library/Indexer.h + ./library/LibraryFactory.h + ./library/LocalLibrary.h + ./library/LocalLibraryConstants.h + ./library/metadata/MetadataKeyValue.h + ./library/metadata/MetadataValue.h + ./library/query/QueryBase.h + ./library/track/IndexerTrack.h + ./library/track/LibraryTrack.h + ./library/track/Track.h + ./playback/NonLibraryTrackHelper.h + ./playback/Transport.h + ./plugin/PluginFactory.h + ./sdk/IAnalyzer.h + ./sdk/IBuffer.h + ./sdk/IBufferProvider.h + ./sdk/IDSP.h + ./sdk/IDataStream.h + ./sdk/IDataStreamFactory.h + ./sdk/IDecoder.h + ./sdk/IDecoderFactory.h + ./sdk/IMetadataReader.h + ./sdk/IMetadataWriter.h + ./sdk/IOutput.h + ./sdk/IPlugin.h + ./sdk/config.h + ./support/Common.h + ./support/Preferences.h + ./support/ThreadHelper.h + ./support/Version.h ) -SOURCE_GROUP("Header Files\\audio" FILES - audio/IAnalyzer.h - audio/IBuffer.h - audio/IDecoder.h - audio/IDecoderFactory.h - audio/IDSP.h - audio/IOutput.h - audio/IPlayer.h - audio/Player.h - audio/Stream.h - audio/Transport.h) -SOURCE_GROUP("Source Files\\audio" FILES - audio/Buffer.cpp - audio/Player.cpp - audio/Stream.cpp - audio/Transport.cpp) -SOURCE_GROUP("Header Files\\db" FILES - db/CachedStatement.h - db/Connection.h - db/dbconfig.h - db/ScopedTransaction.h - db/Statement.h) -SOURCE_GROUP("Source Files\\db" FILES - db/CachedStatement.cpp - db/Connection.cpp - db/ScopedTransaction.cpp - db/Statement.cpp) -SOURCE_GROUP("Header Files\\filestreams" FILES - filestreams/Factory.h - filestreams/IFileStream.h - filestreams/IFileStreamFactory.h - filestreams/LocalFileStream.h) -SOURCE_GROUP("Source Files\\filestreams" FILES - filestreams/Factory.cpp - filestreams/LocalFileStream.cpp) -SOURCE_GROUP("Header Files\\http" FILES - http/IRequestParser.h - http/IRequestPlugin.h - http/IResponder.h - http/RequestParser.h - http/Responder.h - http/Server.h - http/TrackSender.h) -SOURCE_GROUP("Source Files\\http" FILES - http/RequestParser.cpp - http/Responder.cpp - http/Server.cpp - http/TrackSender.cpp) -SOURCE_GROUP("Header Files\\library" FILES - Library/Base.h - Library/LocalDB.h - Library/Remote.h) -SOURCE_GROUP("Source Files\\library" FILES - Library/Base.cpp - Library/LocalDB.cpp - Library/Remote.cpp) -SOURCE_GROUP("Header Files\\plugin" FILES - Plugin/IMetaDataReader.h) -SOURCE_GROUP("Header Files\\query" FILES - Query/Base.h - Query/Factory.h - Query/ListBase.h - Query/ListSelection.h - Query/PlaylistLoad.h - Query/Playlists.h - Query/PlaylistSave.h - Query/SortTracks.h - Query/SortTracksWithData.h - Query/TrackMetadata.h) -SOURCE_GROUP("Source Files\\query" FILES - Query/Base.cpp - Query/Factory.cpp - Query/ListBase.cpp - Query/ListSelection.cpp - Query/SortTracks.cpp - Query/SortTracksWithData.cpp - Query/TrackMetadata.cpp) -SOURCE_GROUP("Header Files\\server" FILES - server/Connection.h - server/User.h - server/UserSession.h) -SOURCE_GROUP("Source Files\\server" FILES - server/Connection.cpp - server/User.cpp - server/UserSession.cpp) -SOURCE_GROUP("Header Files\\tracklist" FILES - tracklist/Base.h - tracklist/LibraryList.h - tracklist/MultiLibraryList.h) -SOURCE_GROUP("Source Files\\tracklist" FILES - tracklist/Base.cpp - tracklist/LibraryList.cpp - tracklist/MultiLibraryList.cpp) -SOURCE_GROUP("Header Files\\xml" FILES - xml/IReadSupplier.h - xml/IWriteSupplier.h - xml/Node.h - xml/Parser.h - xml/ParserNode.h - xml/Socket.h - xml/Writer.h - xml/WriterNode.h) -SOURCE_GROUP("Source Files\\xml" FILES - xml/Node.cpp - xml/Parser.cpp - xml/ParserNode.cpp - xml/Socket.cpp - xml/Writer.cpp - xml/WriterNode.cpp) - - -if(CMAKE_SYSTEM_NAME MATCHES "Windows") - add_definitions(-DWIN32) - if(NOT DEFINED MINGW) - - endif(NOT DEFINED MINGW) -else(CMAKE_SYSTEM_NAME MATCHES "Windows") - set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fpermissive) -endif(CMAKE_SYSTEM_NAME MATCHES "Windows") +set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fpermissive) include_directories( - .. - ../3rdparty/include - ../3rdparty/include/jpeg-6b + . + .. + ../3rdparty/include ) -add_definitions( - -DXML_STATIC +add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_DEBUG ) -if (WIN32) - #Just until I can figure out how to get rid of the last linker errors when exporting dll functions - add_library( musik STATIC ${CORE_SOURCES} ${CORE_HEADERS}) -else (WIN32) - add_library( musik SHARED ${CORE_SOURCES} ${CORE_HEADERS}) -endif (WIN32) -target_link_libraries( musik ${musikCube_LINK_LIBS} expat) - - +add_library(musikcore STATIC ${CORE_SOURCES} ${CORE_HEADERS}) +target_link_libraries(musikcore ${musikbox_LINK_LIBS}) diff --git a/src/core/audio/Player.cpp b/src/core/audio/Player.cpp index 27b0c1ff6..caa4c588e 100644 --- a/src/core/audio/Player.cpp +++ b/src/core/audio/Player.cpp @@ -1,33 +1,33 @@ ////////////////////////////////////////////////////////////////////////////// -// Copyright © 2007, Daniel Önnerby +// Copyright � 2007, Daniel �nnerby // // All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// 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 +// * 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. +// * 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. +// 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. // ////////////////////////////////////////////////////////////////////////////// @@ -36,10 +36,13 @@ #include #include #include +#include #define MAX_PREBUFFER_QUEUE_COUNT 16 using namespace musik::core::audio; +using std::min; +using std::max; static std::string TAG = "Player"; @@ -52,7 +55,7 @@ Player::OutputPtr Player::CreateDefaultOutput() { typedef std::vector OutputVector; OutputVector outputs = musik::core::PluginFactory::Instance().QueryInterface< - IOutput, musik::core::PluginFactory::DestroyDeleter>("GetAudioOutput"); + IOutput, musik::core::PluginFactory::DestroyDeleter >("GetAudioOutput"); if (!outputs.empty()) { musik::debug::info(TAG, "found an IOutput device!"); @@ -71,7 +74,7 @@ Player::Player(const std::string &url, double volume, OutputPtr output) , setPosition(-1) { musik::debug::info(TAG, "new instance created"); - /* we allow callers to specify an output device; but if they don't, + /* we allow callers to specify an output device; but if they don't, we will create and manage our own. */ this->output = output ? output : Player::CreateDefaultOutput(); @@ -100,7 +103,7 @@ void Player::Stop() { this->prebufferQueue.clear(); this->writeToOutputCondition.notify_all(); } - + if (this->output) { this->output->Stop(); } @@ -125,7 +128,7 @@ double Player::Position() { void Player::SetPosition(double seconds) { boost::mutex::scoped_lock lock(this->mutex); - this->setPosition = max(0, seconds); + this->setPosition = std::max(0.0, seconds); } double Player::Volume() { @@ -346,4 +349,3 @@ void Player::OnBufferProcessed(IBuffer *buffer) { } } } - diff --git a/src/core/io/DataStreamFactory.h b/src/core/io/DataStreamFactory.h index 6729d94ba..286dd181c 100644 --- a/src/core/io/DataStreamFactory.h +++ b/src/core/io/DataStreamFactory.h @@ -2,7 +2,7 @@ // // License Agreement: // -// The following are Copyright © 2008, Daniel Önnerby +// The following are Copyright � 2008, Daniel �nnerby // // All rights reserved. // @@ -51,7 +51,7 @@ namespace musik { namespace core { namespace io { DataStreamFactory(); private: - typedef std::vector> DataStreamFactoryVector; + typedef std::vector > DataStreamFactoryVector; DataStreamFactoryVector dataStreamFactories; public: @@ -60,4 +60,3 @@ namespace musik { namespace core { namespace io { }; } } } - diff --git a/src/core/library/IIndexer.h b/src/core/library/IIndexer.h index fe35f1cc7..808043e5f 100755 --- a/src/core/library/IIndexer.h +++ b/src/core/library/IIndexer.h @@ -12,11 +12,11 @@ namespace musik { namespace core { sigslot::signal0<> PathsUpdated; sigslot::signal0<> TrackRefreshed; - virtual ~IIndexer() = 0 { } + virtual ~IIndexer() { } virtual void AddPath(const std::string& path) = 0; virtual void RemovePath(const std::string& path) = 0; virtual void GetPaths(std::vector& paths) = 0; virtual void Synchronize(bool restart = false) = 0; }; -} } \ No newline at end of file +} } diff --git a/src/core/library/ILibrary.h b/src/core/library/ILibrary.h index c91a7c964..fb2b167e0 100755 --- a/src/core/library/ILibrary.h +++ b/src/core/library/ILibrary.h @@ -8,7 +8,7 @@ #include namespace musik { namespace core { - + class ILibrary; typedef std::shared_ptr LibraryPtr; @@ -16,7 +16,7 @@ namespace musik { namespace core { public: sigslot::signal1 QueryCompleted; - virtual ~ILibrary() = 0 { } + virtual ~ILibrary() { } virtual int Enqueue(QueryPtr query, unsigned int options = 0) = 0; virtual IIndexer *Indexer() = 0; @@ -24,4 +24,4 @@ namespace musik { namespace core { virtual const std::string& Name() = 0; }; -} } \ No newline at end of file +} } diff --git a/src/core/library/IQuery.h b/src/core/library/IQuery.h index 9577906bc..d9b2cdd04 100755 --- a/src/core/library/IQuery.h +++ b/src/core/library/IQuery.h @@ -9,7 +9,7 @@ #include namespace musik { namespace core { - + class IQuery; typedef std::shared_ptr QueryPtr; @@ -24,7 +24,7 @@ namespace musik { namespace core { Finished = 4, } Status; - virtual ~IQuery() = 0 { } + virtual ~IQuery() { } virtual bool Run(db::Connection &db) = 0; virtual int GetStatus() = 0; @@ -33,4 +33,4 @@ namespace musik { namespace core { virtual std::string Name() = 0; }; -} } \ No newline at end of file +} } diff --git a/src/core/library/Indexer.cpp b/src/core/library/Indexer.cpp index 4ff493377..18c6cb01f 100644 --- a/src/core/library/Indexer.cpp +++ b/src/core/library/Indexer.cpp @@ -2,7 +2,7 @@ // // License Agreement: // -// The following are Copyright © 2008, Daniel Önnerby +// The following are Copyright � 2008, Daniel �nnerby // // All rights reserved. // @@ -72,7 +72,7 @@ static std::string normalizePath(const std::string& path) { return boost::filesystem::path(path).make_preferred().string(); } -Indexer::Indexer(const std::string& libraryPath, const std::string& dbFilename) +Indexer::Indexer(const std::string& libraryPath, const std::string& dbFilename) : thread(NULL) , status(0) , restart(false) @@ -213,7 +213,7 @@ void Indexer::SynchronizeInternal() { this->status = 2; this->filesSaved = 0; } - + for(std::size_t i = 0; i < paths.size(); ++i) { std::string path = paths[i]; this->SyncDirectory(path, path, pathIds[i]); @@ -235,7 +235,7 @@ void Indexer::SynchronizeInternal() { /* cleanup -- remove stale artists, albums, genres, etc */ musik::debug::info(TAG, "cleanup 2/2"); - + { boost::mutex::scoped_lock lock(this->progressMutex); this->status = 4; @@ -367,19 +367,19 @@ void Indexer::ThreadLoop() { this->SynchronizeInternal(); this->RunAnalyzers(); - + { boost::mutex::scoped_lock lock(this->progressMutex); this->status = 0; } - + this->dbConnection.Close(); /* TODO: raii */ this->SynchronizeEnd(); } /* end skip */ firstTime = false; - + int waitTime = prefs.GetInt("SyncTimeout", 3600); /* sleep before we try again... */ if (waitTime) { @@ -414,10 +414,10 @@ void Indexer::SyncDelete() { while(allTracks.Step() == db::Row && !this->Exited() && !this->Restarted()) { bool remove = false; - std::string file = allTracks.ColumnText(1); + std::string fn = allTracks.ColumnText(1); try { - boost::filesystem::path file(file); + boost::filesystem::path file(fn); if (!boost::filesystem::exists(file)) { remove = true; } @@ -483,12 +483,12 @@ void Indexer::GetPaths(std::vector& paths) { } static int optimize( - musik::core::db::Connection &connection, - std::string singular, - std::string plural) + musik::core::db::Connection &connection, + std::string singular, + std::string plural) { std::string outer = boost::str( - boost::format("SELECT id, lower(trim(name)) AS %1% FROM %2% ORDER BY %3%") + boost::format("SELECT id, lower(trim(name)) AS %1% FROM %2% ORDER BY %3%") % singular % plural % singular); db::Statement outerStmt(outer.c_str(), connection); @@ -629,7 +629,7 @@ void Indexer::RunAnalyzers() { /* decode the stream quickly, passing to all analyzers*/ audio::BufferPtr buffer; - + while ((buffer = stream->GetNextProcessedOutputBuffer()) && !runningAnalyzers.empty()) { PluginVector::iterator plugin = runningAnalyzers.begin(); while(plugin != runningAnalyzers.end()) { @@ -670,4 +670,3 @@ void Indexer::RunAnalyzers() { getNextTrack.BindInt(0, trackId); } } - diff --git a/src/core/library/Indexer.h b/src/core/library/Indexer.h index 71115a19b..8caa82943 100644 --- a/src/core/library/Indexer.h +++ b/src/core/library/Indexer.h @@ -2,7 +2,7 @@ // // License Agreement: // -// The following are Copyright © 2008, Daniel Önnerby +// The following are Copyright � 2008, Daniel �nnerby // // All rights reserved. // @@ -61,7 +61,7 @@ namespace musik { namespace core { class Indexer : public IIndexer, public ThreadHelper, private boost::noncopyable { public: Indexer( - const std::string& libraryPath, + const std::string& libraryPath, const std::string& dbFilename); virtual ~Indexer(); @@ -110,7 +110,7 @@ namespace musik { namespace core { std::string path; }; - typedef std::vector> MetadataReaderList; + typedef std::vector > MetadataReaderList; std::deque addRemoveQueue; @@ -119,4 +119,4 @@ namespace musik { namespace core { typedef std::shared_ptr IndexerPtr; -} } \ No newline at end of file +} } diff --git a/src/core/library/query/PlaylistLoad.cpp b/src/core/library/query/PlaylistLoad.cpp deleted file mode 100644 index a7a593f5e..000000000 --- a/src/core/library/query/PlaylistLoad.cpp +++ /dev/null @@ -1,89 +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. -// -////////////////////////////////////////////////////////////////////////////// - -#ifdef WIN32 -#include "pch.hpp" -#else -#include -#endif - -#include -#include - -using namespace musik::core; - - -////////////////////////////////////////// -///\brief -///Constructor -////////////////////////////////////////// -Query::PlaylistLoad::PlaylistLoad(void){ -} - -////////////////////////////////////////// -///\brief -///Destructor -////////////////////////////////////////// -Query::PlaylistLoad::~PlaylistLoad(void){ -} - -void Query::PlaylistLoad::LoadPlaylist(int playlistId){ - this->playlistId = playlistId; -} - -bool Query::PlaylistLoad::ParseQuery(Library::Base *library,db::Connection &db){ - - db::Statement selectTracks("SELECT track_id FROM playlist_tracks WHERE playlist_id=? ORDER BY sort_order",db); - selectTracks.BindInt(0,this->playlistId); - - while(selectTracks.Step()==db::Row){ - boost::mutex::scoped_lock lock(library->resultMutex); - this->trackResults.push_back(TrackPtr(new LibraryTrack(selectTracks.ColumnInt(0),library->Id()))); - } - return true; -} - -////////////////////////////////////////// -///\brief -///Copy a query -/// -///\returns -///A shared_ptr to the Query::Base -////////////////////////////////////////// -Query::Ptr Query::PlaylistLoad::copy() const{ - return Query::Ptr(new Query::PlaylistLoad(*this)); -} - diff --git a/src/core/library/query/PlaylistLoad.h b/src/core/library/query/PlaylistLoad.h deleted file mode 100644 index de0e31eb3..000000000 --- a/src/core/library/query/PlaylistLoad.h +++ /dev/null @@ -1,87 +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 -#include -#include -#include -#include -#include - -#include -#include - -////////////////////////////////////////////////////////////// -// Forward declarations -////////////////////////////////////////////////////////////// -namespace musik{ namespace core{ - namespace Library{ - class Base; - } -} } - - -namespace musik{ namespace core{ - namespace Query{ - - class PlaylistLoad : public Query::ListBase{ - public: - PlaylistLoad(void); - ~PlaylistLoad(void); - - void LoadPlaylist(int playlistId); - - protected: - - int playlistId; - - friend class Library::Base; - friend class Library::LocalDB; - - virtual bool ParseQuery(Library::Base *library,db::Connection &db); - - Ptr copy() const; - - private: - - }; - - } -} } - - diff --git a/src/core/library/query/PlaylistSave.cpp b/src/core/library/query/PlaylistSave.cpp deleted file mode 100644 index 303f42304..000000000 --- a/src/core/library/query/PlaylistSave.cpp +++ /dev/null @@ -1,136 +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 -#include -#include - -using namespace musik::core; - - -////////////////////////////////////////// -///\brief -///Constructor -////////////////////////////////////////// -Query::PlaylistSave::PlaylistSave(void){ -} - -////////////////////////////////////////// -///\brief -///Destructor -////////////////////////////////////////// -Query::PlaylistSave::~PlaylistSave(void){ -} - -void Query::PlaylistSave::SavePlaylist(const utfstring playlistName,int playlistId,musik::core::tracklist::IRandomAccess *tracklist){ - this->playlistId = playlistId; - this->playlistName = playlistName; - - this->tracks.clear(); - - if(tracklist){ - for(int i(0);iSize();++i){ -// LibraryTrack *t = (LibraryTrack*)(*tracklist)[i].get(); - this->tracks.push_back( (*tracklist)[i]->Id() ); - } - } -} - -bool Query::PlaylistSave::ParseQuery(Library::Base *library,db::Connection &db){ - - db::ScopedTransaction transaction(db); - - { - db::Statement updatePlaylist("INSERT OR REPLACE INTO playlists (id,name,user_id) VALUES (?,?,?)",db); - if(this->playlistId!=0){ - updatePlaylist.BindInt(0,this->playlistId); - } - updatePlaylist.BindTextUTF(1,this->playlistName); - updatePlaylist.BindInt(2,library->userId); - - if( updatePlaylist.Step()==db::Done ){ - if(this->playlistId==0){ - this->playlistId = db.LastInsertedId(); - } - } - } - - { - db::Statement deleteTracks("DELETE FROM playlist_tracks WHERE playlist_id=?",db); - deleteTracks.BindInt(0,this->playlistId); - deleteTracks.Step(); - } - - db::Statement insertTracks("INSERT INTO playlist_tracks (track_id,playlist_id,sort_order) VALUES (?,?,?)",db); - - for(int i(0);itracks.size();++i){ - insertTracks.BindInt(0,this->tracks[i]); - insertTracks.BindInt(1,this->playlistId); - insertTracks.BindInt(2,i); - insertTracks.Step(); - insertTracks.Reset(); - } - return true; -} - -////////////////////////////////////////// -///\brief -///Copy a query -/// -///\returns -///A shared_ptr to the Query::Base -////////////////////////////////////////// -Query::Ptr Query::PlaylistSave::copy() const{ - return Query::Ptr(new Query::PlaylistSave(*this)); -} - -bool Query::PlaylistSave::RunCallbacks(Library::Base *library){ - bool callCallbacks(false); - { - boost::mutex::scoped_lock lock(library->libraryMutex); - if( (this->status & Status::Ended)!=0){ - callCallbacks = true; - } - } - - if(callCallbacks){ - this->PlaylistSaved(this->playlistId); - } - return callCallbacks; -} - - diff --git a/src/core/library/query/PlaylistSave.h b/src/core/library/query/PlaylistSave.h deleted file mode 100644 index 80c4865b0..000000000 --- a/src/core/library/query/PlaylistSave.h +++ /dev/null @@ -1,94 +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 -#include - -#include -#include - -#include -#include -#include - -////////////////////////////////////////////////////////////// -// Forward declarations -////////////////////////////////////////////////////////////// -namespace musik{ namespace core{ - namespace Library{ - class Base; - } -} } - - -namespace musik{ namespace core{ - namespace Query{ - - class PlaylistSave : public Query::Base{ - public: - PlaylistSave(void); - ~PlaylistSave(void); - - void SavePlaylist(const utfstring playlistName,int playlistId=0,musik::core::tracklist::Base *tracklist=NULL); - - sigslot::signal1 PlaylistSaved; - - protected: - - bool RunCallbacks(Library::Base *library); - - int playlistId; - utfstring playlistName; - - std::vector tracks; - - friend class Library::Base; - friend class Library::LocalDB; - - virtual bool ParseQuery(Library::Base *library,db::Connection &db); - - Ptr copy() const; - - private: - - }; - - } -} } - - diff --git a/src/core/library/query/Playlists.cpp b/src/core/library/query/Playlists.cpp deleted file mode 100644 index 3777057cc..000000000 --- a/src/core/library/query/Playlists.cpp +++ /dev/null @@ -1,106 +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 -#include -#include - -using namespace musik::core; - - -////////////////////////////////////////// -///\brief -///Constructor -////////////////////////////////////////// -Query::Playlists::Playlists(void){ -} - -////////////////////////////////////////// -///\brief -///Destructor -////////////////////////////////////////// -Query::Playlists::~Playlists(void){ -} - - -bool Query::Playlists::ParseQuery(Library::Base *library,db::Connection &db){ - - db::Statement stmt("SELECT id,name FROM playlists WHERE user_id=?",db); - - stmt.BindInt(0,library->userId); - - while(stmt.Step()==db::Row){ - tracklist::Ptr playlist( new tracklist::Playlist( - stmt.ColumnInt(0), - stmt.ColumnTextUTF(1), - library->GetSelfPtr() - ) ); - - this->tracklistVector.push_back(playlist); - } - - return true; -} - -////////////////////////////////////////// -///\brief -///Copy a query -/// -///\returns -///A shared_ptr to the Query::Base -////////////////////////////////////////// -Query::Ptr Query::Playlists::copy() const{ - return Query::Ptr(new Query::Playlists(*this)); -} - -bool Query::Playlists::RunCallbacks(Library::Base *library){ - bool bReturn(false); - { - boost::mutex::scoped_lock lock(library->libraryMutex); - if( (this->status & Status::Ended)!=0){ - // If the query is finished, this function should return true to report that it is finished. - bReturn = true; - } - } - - if(bReturn){ - this->PlaylistList(this->tracklistVector); - } - - return bReturn; -} - diff --git a/src/core/library/query/Playlists.h b/src/core/library/query/Playlists.h deleted file mode 100644 index f9046f38e..000000000 --- a/src/core/library/query/Playlists.h +++ /dev/null @@ -1,90 +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 - -////////////////////////////////////////////////////////////// -// Forward declarations -////////////////////////////////////////////////////////////// -namespace musik{ namespace core{ - namespace Library{ - class Base; - } -} } - -////////////////////////////////////////////////////////////// - -#include -#include -#include - -#include -#include -#include -#include - -////////////////////////////////////////////////////////////// - -namespace musik{ namespace core{ namespace Query{ - -////////////////////////////////////////////////////////////// - -class Playlists : public Query::Base{ - public: - Playlists(void); - ~Playlists(void); - - typedef std::vector TracklistVector; - typedef sigslot::signal1 PlaylistListEvent; - - PlaylistListEvent PlaylistList; - - protected: - - bool RunCallbacks(Library::Base *library); - virtual bool ParseQuery(Library::Base *library,db::Connection &db); - - Ptr copy() const; - - private: - TracklistVector tracklistVector; -}; - -////////////////////////////////////////////////////////////// -} } } -////////////////////////////////////////////////////////////// - - diff --git a/src/core/library/track/IndexerTrack.cpp b/src/core/library/track/IndexerTrack.cpp index e88906ed2..31229d09a 100644 --- a/src/core/library/track/IndexerTrack.cpp +++ b/src/core/library/track/IndexerTrack.cpp @@ -2,7 +2,7 @@ // // License Agreement: // -// The following are Copyright © 2008, Daniel Önnerby +// The following are Copyright � 2008, Daniel �nnerby // // All rights reserved. // @@ -148,7 +148,7 @@ bool IndexerTrack::NeedsToBeIndexed( this->SetValue("filesize", boost::lexical_cast(fileSize).c_str()); this->SetValue("filetime", boost::lexical_cast(fileTime).c_str()); - + db::CachedStatement stmt( "SELECT id, filename, filesize, filetime " \ "FROM tracks t " \ @@ -206,9 +206,9 @@ static DBID writeToTracksTable( } static void removeRelation( - db::Connection& connection, - const std::string& field, - DBID trackId) + db::Connection& connection, + const std::string& field, + DBID trackId) { std::string query = boost::str(boost::format("DELETE FROM %1% WHERE track_id=?") % field); db::CachedStatement stmt(query.c_str(), connection); @@ -235,23 +235,23 @@ static void removeKnownFields(Track::MetadataMap& metadata) { DBID IndexerTrack::SaveThumbnail(db::Connection& connection, const std::string& libraryDirectory) { DBID thumbnailId = 0; - + if (this->internalMetadata->thumbnailData) { UINT64 sum = Checksum(this->internalMetadata->thumbnailData, this->internalMetadata->thumbnailSize); - + db::CachedStatement thumbs("SELECT id FROM thumbnails WHERE filesize=? AND checksum=?", connection); thumbs.BindInt(0, this->internalMetadata->thumbnailSize); thumbs.BindInt(1, sum); - + if (thumbs.Step() == db::Row) { thumbnailId = thumbs.ColumnInt(0); /* thumbnail already exists */ } - + if (thumbnailId == 0) { /* doesn't exist yet, let's insert the record and write the file */ db::Statement insertThumb("INSERT INTO thumbnails (filesize,checksum) VALUES (?,?)", connection); insertThumb.BindInt(0, this->internalMetadata->thumbnailSize); insertThumb.BindInt(1, sum); - + if (insertThumb.Step() == db::Done) { thumbnailId = connection.LastInsertedId(); @@ -290,24 +290,24 @@ void IndexerTrack::ProcessNonStandardMetadata(db::Connection& connection) { for ( ; it != unknownFields.end(); ++it){ DBID keyId = 0; std::string key; - + /* lookup the ID for the key; insert if it doesn't exist.. */ selectMetaKey.BindText(0, it->first); - + if (selectMetaKey.Step() == db::Row) { keyId = selectMetaKey.ColumnInt(0); } else { insertMetaKey.BindText(0, it->first); - + if (insertMetaKey.Step() == db::Done) { keyId = connection.LastInsertedId(); } } selectMetaKey.Reset(); - + if (keyId == 0) { continue; /* welp... */ } @@ -319,7 +319,7 @@ void IndexerTrack::ProcessNonStandardMetadata(db::Connection& connection) { selectMetaValue.BindInt(0, keyId); selectMetaValue.BindText(1, it->second); - + if (selectMetaValue.Step() == db::Row) { valueId = selectMetaValue.ColumnInt(0); } @@ -335,7 +335,7 @@ void IndexerTrack::ProcessNonStandardMetadata(db::Connection& connection) { } selectMetaValue.Reset(); - + /* now that we have a keyId and a valueId, create the relationship */ if (valueId != 0) { @@ -561,4 +561,4 @@ IndexerTrack::MetadataWithThumbnail::MetadataWithThumbnail() IndexerTrack::MetadataWithThumbnail::~MetadataWithThumbnail() { delete this->thumbnailData; -} \ No newline at end of file +} diff --git a/src/core/library/track/IndexerTrack.h b/src/core/library/track/IndexerTrack.h index 9f8238dae..c54bb8bf2 100644 --- a/src/core/library/track/IndexerTrack.h +++ b/src/core/library/track/IndexerTrack.h @@ -2,7 +2,7 @@ // // License Agreement: // -// The following are Copyright © 2008, Daniel Önnerby +// The following are Copyright � 2008, Daniel �nnerby // // All rights reserved. // @@ -69,7 +69,7 @@ namespace musik { namespace core { db::Connection &dbConnection); bool Save( - db::Connection &dbConnection, + db::Connection &dbConnection, std::string libraryDirectory); private: @@ -83,13 +83,13 @@ namespace musik { namespace core { Track::MetadataMap metadata; char *thumbnailData; - long thumbnailSize; + int thumbnailSize; }; MetadataWithThumbnail *internalMetadata; DBID SaveThumbnail( - db::Connection& connection, + db::Connection& connection, const std::string& libraryDirectory); DBID SaveGenre(db::Connection& connection); @@ -109,9 +109,9 @@ namespace musik { namespace core { const std::string& junctionTableForeignKeyColumnName); DBID SaveNormalizedFieldValue( - db::Connection& dbConnection, - const std::string& tableName, - const std::string& fieldValue, + db::Connection& dbConnection, + const std::string& tableName, + const std::string& fieldValue, bool isAggregatedValue, const std::string& relationJunctionTableName = "", const std::string& relationJunctionTableColumn = ""); @@ -120,4 +120,3 @@ namespace musik { namespace core { }; } } - diff --git a/src/core/library/track/LibraryTrack.h b/src/core/library/track/LibraryTrack.h index 7e8c6ca94..7d1306023 100644 --- a/src/core/library/track/LibraryTrack.h +++ b/src/core/library/track/LibraryTrack.h @@ -2,7 +2,7 @@ // // License Agreement: // -// The following are Copyright © 2008, Daniel Önnerby +// The following are Copyright � 2008, Daniel �nnerby // // All rights reserved. // @@ -74,7 +74,7 @@ namespace musik { namespace core { virtual MetadataIteratorRange GetAllValues(); virtual TrackPtr Copy(); - static bool LibraryTrack::Load(Track *target, db::Connection &db); + static bool Load(Track *target, db::Connection &db); private: DBID id; @@ -95,4 +95,3 @@ namespace musik { namespace core { }; } } - diff --git a/src/core/playback/NonLibraryTrackHelper.cpp b/src/core/playback/NonLibraryTrackHelper.cpp index b53ed3c50..f61ab1ff3 100644 --- a/src/core/playback/NonLibraryTrackHelper.cpp +++ b/src/core/playback/NonLibraryTrackHelper.cpp @@ -2,7 +2,7 @@ // // License Agreement: // -// The following are Copyright © 2008, Daniel Önnerby +// The following are Copyright � 2008, Daniel �nnerby // // All rights reserved. // @@ -80,9 +80,9 @@ void NonLibraryTrackHelper::ThreadLoop() { /* load all IMetadataReader plugins */ typedef metadata::IMetadataReader PluginType; typedef PluginFactory::DestroyDeleter Deleter; - typedef std::vector> MetadataReaderList; + typedef std::vector > MetadataReaderList; - MetadataReaderList metadataReaders = + MetadataReaderList metadataReaders = PluginFactory::Instance() .QueryInterface("GetMetadataReader"); bool moreTracks = true; @@ -110,7 +110,7 @@ void NonLibraryTrackHelper::ThreadLoop() { /* we only support local files. other URIs are ignored */ if (musik::core::io::DataStreamFactory::IsLocalFileStream(track->URI().c_str())) { std::string url = track->URI(); - + std::string::size_type lastDot = url.find_last_of("."); if (lastDot != std::string::npos) { track->SetValue("extension", url.substr(lastDot + 1).c_str()); @@ -133,5 +133,3 @@ void NonLibraryTrackHelper::ThreadLoop() { } } } - - diff --git a/src/core/playback/Transport.cpp b/src/core/playback/Transport.cpp index f40dffe79..8bd9aeba2 100644 --- a/src/core/playback/Transport.cpp +++ b/src/core/playback/Transport.cpp @@ -1,33 +1,33 @@ ////////////////////////////////////////////////////////////////////////////// -// Copyright © 2007, Daniel Önnerby +// Copyright � 2007, Daniel �nnerby // // All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// 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 +// * 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. +// * 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. +// 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. // ////////////////////////////////////////////////////////////////////////////// @@ -36,8 +36,8 @@ #include #include #include - -#include +#include +#include using namespace musik::core::audio; @@ -47,6 +47,12 @@ static std::string TAG = "Transport"; delete this->nextPlayer; \ this->nextPlayer = NULL; +#define DEFER(x, y) \ + { \ + boost::thread thread(boost::bind(x, this, y)); \ + thread.detach(); \ + } + static void pausePlayer(Player* p) { p->Pause(); } @@ -60,7 +66,7 @@ static void deletePlayer(Player* p) { } Transport::Transport() -: volume(1.0) +: volume(1.0) , state(PlaybackStopped) , nextPlayer(NULL) { this->output = Player::CreateDefaultOutput(); @@ -128,8 +134,8 @@ void Transport::Stop() { std::swap(toDelete, this->active); } - /* do the actual delete outside of the critical section! the players run - in a background thread that will emit a signal on completion, but the + /* do the actual delete outside of the critical section! the players run + in a background thread that will emit a signal on completion, but the destructor joins(). */ std::for_each(toDelete.begin(), toDelete.end(), deletePlayer); this->active.clear(); @@ -160,7 +166,7 @@ bool Transport::Resume() { musik::debug::info(TAG, "resume"); size_t count = 0; - + { boost::recursive_mutex::scoped_lock lock(this->stateMutex); std::for_each(this->active.begin(), this->active.end(), resumePlayer); @@ -187,7 +193,7 @@ double Transport::Position() { void Transport::SetPosition(double seconds) { boost::recursive_mutex::scoped_lock lock(this->stateMutex); - + if (!this->active.empty()) { this->active.front()->SetPosition(seconds); this->TimeChanged(seconds); @@ -200,8 +206,8 @@ double Transport::Volume() { void Transport::SetVolume(double volume) { double oldVolume = this->volume; - - volume = max(0, min(1.0, volume)); + + volume = std::max(0.0, std::min(1.0, volume)); this->volume = volume; @@ -260,19 +266,19 @@ void Transport::OnPlaybackFinished(Player* player) { this->SetPlaybackState(Transport::PlaybackStopped); } - boost::async(boost::bind(&Transport::RemoveActive, this, player)); + DEFER(&Transport::RemoveActive, player); } void Transport::OnPlaybackStopped (Player* player) { this->RaiseStreamEvent(Transport::StreamStopped, player); this->SetPlaybackState(Transport::PlaybackStopped); - boost::async(boost::bind(&Transport::RemoveActive, this, player)); + DEFER(&Transport::RemoveActive, player); } void Transport::OnPlaybackError(Player* player) { this->RaiseStreamEvent(Transport::StreamError, player); this->SetPlaybackState(Transport::PlaybackStopped); - boost::async(boost::bind(&Transport::RemoveActive, this, player)); + DEFER(&Transport::RemoveActive, player); } void Transport::SetPlaybackState(int state) { @@ -290,4 +296,4 @@ void Transport::SetPlaybackState(int state) { void Transport::RaiseStreamEvent(int type, Player* player) { this->StreamEvent(type, player->GetUrl()); -} \ No newline at end of file +} diff --git a/src/core/playback/Transport.h b/src/core/playback/Transport.h index a9be8a136..392884afc 100644 --- a/src/core/playback/Transport.h +++ b/src/core/playback/Transport.h @@ -1,33 +1,33 @@ ////////////////////////////////////////////////////////////////////////////// -// Copyright © 2007, Daniel Önnerby +// Copyright � 2007, Daniel �nnerby // // All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// 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 +// * 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. +// * 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. +// 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 diff --git a/src/core/plugin/PluginFactory.cpp b/src/core/plugin/PluginFactory.cpp index ff7c68030..a68c43d58 100644 --- a/src/core/plugin/PluginFactory.cpp +++ b/src/core/plugin/PluginFactory.cpp @@ -109,7 +109,8 @@ void PluginFactory::LoadPlugins(){ if ((err = dlerror()) != NULL) { musik::debug::err( - "could not load shared library " + filename + + "PluginFactory", + "could not load shared library " + filename + " error: " + std::string(err)); } else { @@ -117,8 +118,8 @@ void PluginFactory::LoadPlugins(){ *(void **)(&getPluginCall) = dlsym(dll, "GetPlugin"); if (getPluginCall) { - this->loadedPlugins.push_back(getPluginCall); - this->loadedDLLs.push_back(dll); + this->loadedPlugins.push_back(getPluginCall()); + this->loadedDlls.push_back(dll); } else { dlclose(dll); @@ -132,5 +133,3 @@ void PluginFactory::LoadPlugins(){ catch(...) { } } - - diff --git a/src/core/plugin/PluginFactory.h b/src/core/plugin/PluginFactory.h index 0000d18d6..35a5d358e 100644 --- a/src/core/plugin/PluginFactory.h +++ b/src/core/plugin/PluginFactory.h @@ -95,12 +95,12 @@ namespace musik { namespace core { } }; - template std::vector> QueryInterface(const char* functionName) { + template std::vector > QueryInterface(const char* functionName) { boost::mutex::scoped_lock lock(this->mutex); typedef T* STDCALL(PluginInterfaceCall); - std::vector> plugins; + std::vector > plugins; HandleList& allDlls = PluginFactory::sInstance.loadedDlls; typedef HandleList::iterator Iterator; diff --git a/src/core/sdk/IBufferProvider.h b/src/core/sdk/IBufferProvider.h index 8fe7742cc..d2863e270 100644 --- a/src/core/sdk/IBufferProvider.h +++ b/src/core/sdk/IBufferProvider.h @@ -1,33 +1,33 @@ ////////////////////////////////////////////////////////////////////////////// -// Copyright © 2007, Daniel Önnerby +// Copyright � 2007, Daniel �nnerby // // All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// 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 +// * 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. +// * 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. +// 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. // ////////////////////////////////////////////////////////////////////////////// @@ -40,9 +40,9 @@ namespace musik { namespace core { namespace audio { class IBufferProvider { public: - virtual ~IBufferProvider() = 0 { } + virtual ~IBufferProvider() { } - /* the output calls this interface to let the provider know + /* the output calls this interface to let the provider know it's done with the Buffer, so it can be recycled or released */ virtual void OnBufferProcessed(IBuffer *buffer) = 0; }; diff --git a/src/core/sdk/config.h b/src/core/sdk/config.h index 25b9fc249..c18785de8 100755 --- a/src/core/sdk/config.h +++ b/src/core/sdk/config.h @@ -2,7 +2,7 @@ // // License Agreement: // -// The following are Copyright © 2008, Daniel Önnerby +// The following are Copyright � 2008, Daniel �nnerby // // All rights reserved. // @@ -51,7 +51,7 @@ typedef unsigned long long UINT64; typedef long long __int64; - + #define STDCALL(fp) (* fp)() __attribute__((stdcall)) #define _ASSERT assert -#endif \ No newline at end of file +#endif