mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-09 21:40:05 +00:00
Incremental checkin for compiling on mac. 3rdparty compiles, and core is nearly there (boost::async not working)
This commit is contained in:
parent
73305d420d
commit
e33f9928fb
4
.gitignore
vendored
4
.gitignore
vendored
@ -2,6 +2,10 @@
|
||||
**/*.VC.db
|
||||
**/*.VC.opendb
|
||||
**/*.suo
|
||||
**/CMakeCache.txt
|
||||
**/CMakeFiles
|
||||
**/Makefile
|
||||
**/cmake_install.cmake
|
||||
bin
|
||||
obj
|
||||
ipch
|
||||
|
101
CMakeLists.txt
101
CMakeLists.txt
@ -1,10 +1,11 @@
|
||||
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
|
||||
@ -15,86 +16,29 @@ 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})
|
||||
message(STATUS "Libs: " ${BOOST_LINK_LIBS})
|
||||
message(STATUS "Includes: " ${Boost_INCLUDE_DIRS})
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
set (musikbox_LINK_LIBS
|
||||
${linux_LINK_LIBS}
|
||||
${BOOST_LINK_LIBS}
|
||||
sqlite3
|
||||
@ -102,15 +46,12 @@ set (musikCube_LINK_LIBS
|
||||
)
|
||||
|
||||
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)
|
||||
|
13
src/3rdparty/CMakeLists.txt
vendored
13
src/3rdparty/CMakeLists.txt
vendored
@ -15,27 +15,14 @@ set (3rdParty_SQLITE_SOURCES
|
||||
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}
|
||||
)
|
||||
|
||||
set (ZLIB_INCLUDE_DIR ${musikCube_SOURCE_DIRECTORY}/src/3rdparty/include)
|
||||
set (ZLIB_LIBRARY ${musikCube_SOURCE_DIRECTORY}/src/3rdparty/lib)
|
||||
|
||||
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
|
||||
endif (WIN32)
|
||||
add_library( expat STATIC ${3rdParty_EXPAT_SOURCES} )
|
||||
|
@ -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
|
||||
./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")
|
||||
|
||||
include_directories(
|
||||
.
|
||||
..
|
||||
../3rdparty/include
|
||||
../3rdparty/include/jpeg-6b
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-DXML_STATIC
|
||||
-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})
|
||||
|
@ -1,5 +1,5 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright © 2007, Daniel Önnerby
|
||||
// Copyright <EFBFBD> 2007, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@ -36,10 +36,13 @@
|
||||
#include <core/debug.h>
|
||||
#include <core/audio/Player.h>
|
||||
#include <core/plugin/PluginFactory.h>
|
||||
#include <algorithm>
|
||||
|
||||
#define MAX_PREBUFFER_QUEUE_COUNT 16
|
||||
|
||||
using namespace musik::core::audio;
|
||||
using std::min;
|
||||
using std::max;
|
||||
|
||||
static std::string TAG = "Player";
|
||||
|
||||
@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
// The following are Copyright <EFBFBD> 2008, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@ -60,4 +60,3 @@ namespace musik { namespace core { namespace io {
|
||||
};
|
||||
|
||||
} } }
|
||||
|
||||
|
@ -12,7 +12,7 @@ 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;
|
||||
|
@ -16,7 +16,7 @@ namespace musik { namespace core {
|
||||
public:
|
||||
sigslot::signal1<QueryPtr> QueryCompleted;
|
||||
|
||||
virtual ~ILibrary() = 0 { }
|
||||
virtual ~ILibrary() { }
|
||||
|
||||
virtual int Enqueue(QueryPtr query, unsigned int options = 0) = 0;
|
||||
virtual IIndexer *Indexer() = 0;
|
||||
|
@ -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;
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
// The following are Copyright <EFBFBD> 2008, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@ -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;
|
||||
}
|
||||
@ -670,4 +670,3 @@ void Indexer::RunAnalyzers() {
|
||||
getNextTrack.BindInt(0, trackId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
// The following are Copyright <EFBFBD> 2008, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
|
@ -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 <core/pch.hpp>
|
||||
#endif
|
||||
|
||||
#include <core/library/query/PlaylistLoad.h>
|
||||
#include <core/Library/Base.h>
|
||||
|
||||
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));
|
||||
}
|
||||
|
@ -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 <boost/shared_ptr.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/library/query/ListBase.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// 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:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
} }
|
||||
|
||||
|
@ -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 <core/library/query/PlaylistSave.h>
|
||||
#include <core/Library/Base.h>
|
||||
#include <core/LibraryTrack.h>
|
||||
|
||||
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);i<tracklist->Size();++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);i<this->tracks.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;
|
||||
}
|
||||
|
||||
|
@ -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 <boost/shared_ptr.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
#include <core/config.h>
|
||||
#include <core/library/query/Base.h>
|
||||
#include <core/library/query/LibraryList.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// 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<int> PlaylistSaved;
|
||||
|
||||
protected:
|
||||
|
||||
bool RunCallbacks(Library::Base *library);
|
||||
|
||||
int playlistId;
|
||||
utfstring playlistName;
|
||||
|
||||
std::vector<int> tracks;
|
||||
|
||||
friend class Library::Base;
|
||||
friend class Library::LocalDB;
|
||||
|
||||
virtual bool ParseQuery(Library::Base *library,db::Connection &db);
|
||||
|
||||
Ptr copy() const;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
} }
|
||||
|
||||
|
@ -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 <core/library/query/Playlists.h>
|
||||
#include <core/Library/Base.h>
|
||||
#include <core/library/query/Playlist.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -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 <core/config.h>
|
||||
#include <core/library/query/Base.h>
|
||||
#include <core/library/query/LibraryList.h>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <vector>
|
||||
#include <sigslot/sigslot.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
namespace musik{ namespace core{ namespace Query{
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
class Playlists : public Query::Base{
|
||||
public:
|
||||
Playlists(void);
|
||||
~Playlists(void);
|
||||
|
||||
typedef std::vector<musik::core::tracklist::Ptr> TracklistVector;
|
||||
typedef sigslot::signal1<TracklistVector> PlaylistListEvent;
|
||||
|
||||
PlaylistListEvent PlaylistList;
|
||||
|
||||
protected:
|
||||
|
||||
bool RunCallbacks(Library::Base *library);
|
||||
virtual bool ParseQuery(Library::Base *library,db::Connection &db);
|
||||
|
||||
Ptr copy() const;
|
||||
|
||||
private:
|
||||
TracklistVector tracklistVector;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
} } }
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
// The following are Copyright <EFBFBD> 2008, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
// The following are Copyright <EFBFBD> 2008, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@ -83,7 +83,7 @@ namespace musik { namespace core {
|
||||
|
||||
Track::MetadataMap metadata;
|
||||
char *thumbnailData;
|
||||
long thumbnailSize;
|
||||
int thumbnailSize;
|
||||
};
|
||||
|
||||
MetadataWithThumbnail *internalMetadata;
|
||||
@ -120,4 +120,3 @@ namespace musik { namespace core {
|
||||
};
|
||||
|
||||
} }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
// The following are Copyright <EFBFBD> 2008, Daniel <20>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 {
|
||||
};
|
||||
|
||||
} }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
// The following are Copyright <EFBFBD> 2008, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@ -133,5 +133,3 @@ void NonLibraryTrackHelper::ThreadLoop() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright © 2007, Daniel Önnerby
|
||||
// Copyright <EFBFBD> 2007, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@ -36,8 +36,8 @@
|
||||
#include <core/debug.h>
|
||||
#include <core/playback/Transport.h>
|
||||
#include <core/plugin/PluginFactory.h>
|
||||
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <algorithm>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
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();
|
||||
}
|
||||
@ -201,7 +207,7 @@ 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) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright © 2007, Daniel Önnerby
|
||||
// Copyright <EFBFBD> 2007, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
|
@ -109,6 +109,7 @@ void PluginFactory::LoadPlugins(){
|
||||
|
||||
if ((err = dlerror()) != NULL) {
|
||||
musik::debug::err(
|
||||
"PluginFactory",
|
||||
"could not load shared library " + filename +
|
||||
" error: " + std::string(err));
|
||||
}
|
||||
@ -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(...) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright © 2007, Daniel Önnerby
|
||||
// Copyright <EFBFBD> 2007, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
@ -40,7 +40,7 @@ namespace musik { namespace core { namespace audio {
|
||||
|
||||
class IBufferProvider {
|
||||
public:
|
||||
virtual ~IBufferProvider() = 0 { }
|
||||
virtual ~IBufferProvider() { }
|
||||
|
||||
/* the output calls this interface to let the provider know
|
||||
it's done with the Buffer, so it can be recycled or released */
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// License Agreement:
|
||||
//
|
||||
// The following are Copyright © 2008, Daniel Önnerby
|
||||
// The following are Copyright <EFBFBD> 2008, Daniel <20>nnerby
|
||||
//
|
||||
// All rights reserved.
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user