CMake variables and commandline options to allow multiple engines to be built. Thanks christoph.gysin.

Fixes issue #203
This commit is contained in:
David Sansome 2010-04-15 12:39:34 +00:00
parent 44ffc5be75
commit dd86b60411
32 changed files with 730 additions and 426 deletions

View File

@ -9,14 +9,11 @@ if (CMAKE_FIND_ROOT_PATH)
set(QT_LIBRARY_DIR ${CMAKE_FIND_ROOT_PATH}/lib)
endif (CMAKE_FIND_ROOT_PATH)
find_package(Qt4 REQUIRED)
set(QT_USE_QTOPENGL 1)
set(QT_USE_QTSQL 1)
set(QT_USE_QTNETWORK 1)
set(QT_USE_QTXML 1)
find_package(Qt4 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml)
if(UNIX AND NOT APPLE)
set(QT_USE_QTDBUS 1)
find_package(Qt4 REQUIRED QtDbus)
endif(UNIX AND NOT APPLE)
find_package(Qt4 COMPONENTS Phonon)
find_package(OpenGL REQUIRED)
find_package(Boost REQUIRED)
@ -35,19 +32,13 @@ if(WIN32)
find_library(GLIB_LIBRARIES glib-2.0)
find_library(GOBJECT_LIBRARIES gobject-2.0)
else(WIN32)
pkg_check_modules(TAGLIB taglib)
pkg_check_modules(TAGLIB REQUIRED taglib>=1.6)
pkg_check_modules(GSTREAMER gstreamer-0.10)
pkg_check_modules(GSTREAMER_BASE gstreamer-base-0.10)
if (TAGLIB_VERSION VERSION_LESS 1.6)
message(FATAL_ERROR "Taglib version 1.6 or greater is required")
endif (TAGLIB_VERSION VERSION_LESS 1.6)
pkg_check_modules(VLC libvlc)
pkg_check_modules(XINE libxine)
endif(WIN32)
if (NOT Boost_FOUND)
message(FATAL_ERROR "Boost not found")
endif (NOT Boost_FOUND)
find_library(LASTFM_LIBRARY_DIRS lastfm)
find_path(LASTFM_INCLUDE_DIRS lastfm/ws.h)

77
src/AddEngine.cmake Normal file
View File

@ -0,0 +1,77 @@
# add an engine
macro(add_engine engine lib_list src_list moc_list supported)
# recreate list
set(lib_list ${lib_list})
list(GET lib_list 0 name)
# add a user selectable build option, supported engines enabled by default
option(ENGINE_${name}_ENABLED "enable engine ${engine}" ${supported})
# check for all needed libraries
foreach(lib ${lib_list})
if(${lib}_NOTFOUND)
set(ENGINE_${name}_LIB_MISSING TRUE)
endif(${lib}_NOTFOUND)
endforeach(lib ${lib_list})
# check if engine is enabled and needed librares are available
if(ENGINE_${name}_ENABLED AND NOT ENGINE_${name}_LIB_MISSING)
# add to list of unsupported engines
set(supported ${supported})
if(NOT supported)
set(ENGINES_UNSUPPORTED "${ENGINES_UNSUPPORTED} ${engine}")
endif(NOT supported)
# add define -DHAVE_<engine> so we can clutter the code with #ifdefs
add_definitions(-DHAVE_${name})
# add sources and MOC headers
list(APPEND CLEMENTINE-SOURCES ${src_list})
list(APPEND CLEMENTINE-MOC-HEADERS ${moc_list})
# add libraries to link against
foreach(lib ${lib_list})
set(ENGINE_LIBRARIES ${ENGINE_LIBRARIES} ${${lib}_LIBRARIES})
endforeach(lib ${lib_list})
# add to list of enabled engines
set(ENGINES_ENABLED "${ENGINES_ENABLED} ${engine}")
else(ENGINE_${name}_ENABLED AND NOT ENGINE_${name}_LIB_MISSING)
# add to list of disabled engines
set(ENGINES_DISABLED "${ENGINES_DISABLED} ${engine}")
endif(ENGINE_${name}_ENABLED AND NOT ENGINE_${name}_LIB_MISSING)
endmacro(add_engine engine lib_list src_list moc_list supported)
# print engines to be built
macro(print_engines)
# show big warning if building unsupported engines
if(ENGINES_UNSUPPORTED)
message("")
message(" *********************************")
message(" ************ WARNING ************")
message(" *********************************")
message("")
message(" The following engines are NOT supported by clementine developers:")
message(" ${ENGINES_UNSUPPORTED}")
message("")
message(" Don't post any bugs if you use them, fix them yourself!")
message("")
pig()
message("")
endif(ENGINES_UNSUPPORTED)
message("building engines:${ENGINES_ENABLED}")
message("skipping engines:${ENGINES_DISABLED}")
endmacro(print_engines)
# print the pig :)
macro(pig)
file(READ pig.txt pig)
message(${pig})
endmacro(pig)

View File

@ -12,9 +12,6 @@ set(CLEMENTINE-SOURCES
playlist.cpp
playlistitem.cpp
engines/enginebase.cpp
engines/gstengine.cpp
engines/gstequalizer.cpp
engines/gstenginepipeline.cpp
analyzers/baranalyzer.cpp
analyzers/analyzerbase.cpp
fht.cpp
@ -88,8 +85,6 @@ set(CLEMENTINE-MOC-HEADERS
librarybackend.h
playlist.h
engines/enginebase.h
engines/gstengine.h
engines/gstenginepipeline.h
sliderwidget.h
playlistview.h
backgroundthread.h
@ -144,6 +139,41 @@ set(CLEMENTINE-MOC-HEADERS
stickyslider.h
)
# lists of engine source files
set(GST_ENGINE_SRC
engines/gstengine.cpp
engines/gstequalizer.cpp
engines/gstenginepipeline.cpp
)
set(GST_ENGINE_MOC
engines/gstengine.h
engines/gstenginepipeline.h
)
set(GST_ENGINE_LIB
GSTREAMER
GSTREAMER_BASE
)
set(XINE_ENGINE_SRC
engines/xine-engine.cpp
engines/xine-scope.c
)
set(XINE_ENGINE_MOC
engines/xine-engine.h
)
# try to add engines
include(AddEngine.cmake)
add_engine(gst "${GST_ENGINE_LIB}" "${GST_ENGINE_SRC}" "${GST_ENGINE_MOC}" ON)
add_engine(vlc VLC engines/vlcengine.cpp engines/vlcengine.h OFF)
add_engine(xine XINE "${XINE_ENGINE_SRC}" "${XINE_ENGINE_MOC}" OFF)
add_engine(qt-phonon QT_PHONON engines/phononengine.cpp engines/phononengine.h OFF)
print_engines()
# need at least 1 engine
if(NOT ENGINES_ENABLED)
message(FATAL_ERROR "no engine enabled!")
endif(NOT ENGINES_ENABLED)
# UI files
set(CLEMENTINE-UI
mainwindow.ui
@ -319,10 +349,9 @@ target_link_libraries(clementine_lib
lastfm
${GOBJECT_LIBRARIES}
${GLIB_LIBRARIES}
${GSTREAMER_LIBRARIES}
${GSTREAMER_BASE_LIBRARIES}
${TAGLIB_LIBRARIES}
${QT_LIBRARIES}
${ENGINE_LIBRARIES}
)
if (APPLE)
target_link_libraries(clementine_lib

View File

@ -45,7 +45,8 @@ const char* CommandlineOptions::kHelpText =
" -k, --play-track <n> %19\n"
"\n"
"%20:\n"
" -o, --show-osd %21\n";
" -o, --show-osd %21\n"
" -e, --engine %22\n";
CommandlineOptions::CommandlineOptions(int argc, char** argv)
@ -58,7 +59,8 @@ CommandlineOptions::CommandlineOptions(int argc, char** argv)
seek_to_(-1),
seek_by_(0),
play_track_at_(-1),
show_osd_(false)
show_osd_(false),
engine_(Engine::gstreamer)
{
}
@ -83,6 +85,7 @@ bool CommandlineOptions::Parse() {
{"play-track", required_argument, 0, 'k'},
{"show-osd", no_argument, 0, 'o'},
{"engine", required_argument, 0, 'e'},
{0, 0, 0, 0}
};
@ -91,7 +94,7 @@ bool CommandlineOptions::Parse() {
int option_index = 0;
bool ok = false;
forever {
int c = getopt_long(argc_, argv_, "hptusrfv:alk:o", kOptions, &option_index);
int c = getopt_long(argc_, argv_, "hptusrfv:alk:oe:", kOptions, &option_index);
// End of the options
if (c == -1)
@ -117,7 +120,8 @@ bool CommandlineOptions::Parse() {
tr("Loads files/URLs, replacing current playlist")).arg(
tr("Play the <n>th track in the playlist"),
tr("Other options"),
tr("Display the on-screen-display"));
tr("Display the on-screen-display"),
tr("Select engine"));
std::cout << translated_help_text.toLocal8Bit().constData();
return false;
@ -155,6 +159,27 @@ bool CommandlineOptions::Parse() {
if (!ok) play_track_at_ = -1;
break;
case 'e':
{
ok = true;
QString engine = optarg;
if(engine == "gst")
engine_ = Engine::gstreamer;
else if(engine == "vlc")
engine_ = Engine::vlc;
else if(engine == "xine")
engine_ = Engine::xine;
else if(engine == "qt-phonon")
engine_ = Engine::qt_phonon;
else
{
qFatal("%s %s",
tr("Unknown audio engine \"%1\". Choices are:").arg(engine).toAscii().data(),
"gst vlc xine qt-phonon");
}
}
break;
case '?':
default:
return false;

View File

@ -21,6 +21,8 @@
#include <QUrl>
#include <QDataStream>
#include "engines/engine_fwd.h"
class CommandlineOptions {
friend QDataStream& operator<<(QDataStream& s, const CommandlineOptions& a);
friend QDataStream& operator>>(QDataStream& s, CommandlineOptions& a);
@ -59,6 +61,7 @@ class CommandlineOptions {
int play_track_at() const { return play_track_at_; }
bool show_osd() const { return show_osd_; }
QList<QUrl> urls() const { return urls_; }
Engine::Type engine() const { return engine_; }
QByteArray Serialize() const;
void Load(const QByteArray& serialized);
@ -89,6 +92,7 @@ class CommandlineOptions {
int seek_by_;
int play_track_at_;
bool show_osd_;
Engine::Type engine_;
QList<QUrl> urls_;
};

View File

@ -10,6 +10,8 @@ namespace Engine
class SimpleMetaBundle;
class Base;
enum Type { gstreamer, vlc, xine, qt_phonon };
/**
* You should return:
* Playing when playing,

View File

@ -38,21 +38,21 @@ PhononEngine::~PhononEngine() {
delete audio_output_;
}
bool PhononEngine::init() {
bool PhononEngine::Init() {
return true;
}
bool PhononEngine::canDecode(const QUrl &url) const {
bool PhononEngine::CanDecode(const QUrl &url) {
// TODO
return true;
}
bool PhononEngine::load(const QUrl &url, bool stream) {
bool PhononEngine::Load(const QUrl &url, Engine::TrackChangeType change ) {
media_object_->setCurrentSource(Phonon::MediaSource(url));
return true;
}
bool PhononEngine::play(uint offset) {
bool PhononEngine::Play(uint offset) {
// The seek happens in PhononStateChanged - phonon doesn't seem to change
// currentTime() if we seek before we start playing :S
seek_offset_ = offset;
@ -61,15 +61,15 @@ bool PhononEngine::play(uint offset) {
return true;
}
void PhononEngine::stop() {
void PhononEngine::Stop() {
media_object_->stop();
}
void PhononEngine::pause() {
void PhononEngine::Pause() {
media_object_->pause();
}
void PhononEngine::unpause() {
void PhononEngine::Unpause() {
media_object_->play();
}
@ -98,21 +98,21 @@ uint PhononEngine::length() const {
return media_object_->totalTime();
}
void PhononEngine::seek(uint ms) {
void PhononEngine::Seek(uint ms) {
media_object_->seek(ms);
}
void PhononEngine::setVolumeSW(uint) {
audio_output_->setVolume(qreal(m_volume) / 100.0);
void PhononEngine::SetVolumeSW(uint volume) {
audio_output_->setVolume(volume);
}
void PhononEngine::PhononFinished() {
emit trackEnded();
emit TrackEnded();
}
void PhononEngine::PhononStateChanged(Phonon::State new_state) {
if (new_state == Phonon::ErrorState) {
emit error(media_object_->errorString());
emit Error(media_object_->errorString());
}
if (new_state == Phonon::PlayingState && seek_offset_ != -1) {
media_object_->seek(seek_offset_);
@ -124,5 +124,5 @@ void PhononEngine::PhononStateChanged(Phonon::State new_state) {
}
void PhononEngine::StateTimeoutExpired() {
emit stateChanged(state());
emit StateChanged(state());
}

View File

@ -31,24 +31,24 @@ class PhononEngine : public Engine::Base {
PhononEngine();
~PhononEngine();
bool init();
bool Init();
bool canDecode( const QUrl &url ) const;
bool CanDecode( const QUrl &url );
bool load( const QUrl &url, bool stream = false );
bool play( uint offset = 0 );
void stop();
void pause();
void unpause();
bool Load( const QUrl &url, Engine::TrackChangeType change );
bool Play( uint offset = 0 );
void Stop();
void Pause();
void Unpause();
Engine::State state() const;
uint position() const;
uint length() const;
void seek( uint ms );
void Seek( uint ms );
protected:
void setVolumeSW( uint percent );
void SetVolumeSW( uint percent );
private slots:
void PhononFinished();

View File

@ -113,23 +113,23 @@ void VlcEngine::StateChangedCallback(const libvlc_event_t* e, void* data) {
case libvlc_MediaPlayerEndReached:
engine->state_ = Engine::Idle;
emit engine->trackEnded();
emit engine->TrackEnded();
return; // Don't emit state changed here
}
emit engine->stateChanged(engine->state_);
emit engine->StateChanged(engine->state_);
}
bool VlcEngine::init() {
bool VlcEngine::Init() {
return true;
}
bool VlcEngine::canDecode(const QUrl &url) const {
bool VlcEngine::CanDecode(const QUrl &url) {
// TODO
return true;
}
bool VlcEngine::load(const QUrl &url, bool stream) {
bool VlcEngine::Load(const QUrl &url, Engine::TrackChangeType change) {
// Create the media object
VlcScopedRef<libvlc_media_t> media(
libvlc_media_new(instance_, url.toEncoded().constData(), &exception_));
@ -143,27 +143,27 @@ bool VlcEngine::load(const QUrl &url, bool stream) {
return true;
}
bool VlcEngine::play(uint offset) {
bool VlcEngine::Play(uint offset) {
libvlc_media_player_play(player_, &exception_);
if (libvlc_exception_raised(&exception_))
return false;
seek(offset);
Seek(offset);
return true;
}
void VlcEngine::stop() {
void VlcEngine::Stop() {
libvlc_media_player_stop(player_, &exception_);
HandleErrors();
}
void VlcEngine::pause() {
void VlcEngine::Pause() {
libvlc_media_player_pause(player_, &exception_);
HandleErrors();
}
void VlcEngine::unpause() {
void VlcEngine::Unpause() {
libvlc_media_player_play(player_, &exception_);
HandleErrors();
}
@ -198,7 +198,7 @@ uint VlcEngine::length() const {
return len;
}
void VlcEngine::seek(uint ms) {
void VlcEngine::Seek(uint ms) {
uint len = length();
if (len == 0)
return;
@ -209,7 +209,7 @@ void VlcEngine::seek(uint ms) {
HandleErrors();
}
void VlcEngine::setVolumeSW(uint volume) {
void VlcEngine::SetVolumeSW(uint volume) {
libvlc_audio_set_volume(instance_, volume, &exception_);
HandleErrors();
}
@ -233,19 +233,19 @@ void VlcEngine::SetScopeData(float* data, int size) {
}
}
const Engine::Scope& VlcEngine::scope() {
const Engine::Scope& VlcEngine::Scope() {
QMutexLocker l(&scope_mutex_);
// Leave the scope unchanged if there's not enough data
if (scope_data_.size() < uint(SCOPESIZE))
return m_scope;
if (scope_data_.size() < uint(kScopeSize))
return scope_;
// Take the samples off the front of the circular buffer
for (uint i=0 ; i<uint(SCOPESIZE) ; ++i)
m_scope[i] = scope_data_[i] * (1 << 15);
for (uint i=0 ; i<uint(kScopeSize) ; ++i)
scope_[i] = scope_data_[i] * (1 << 15);
// Remove the samples from the buffer. Unfortunately I think this is O(n) :(
scope_data_.rresize(qMax(0, int(scope_data_.size()) - SCOPESIZE*2));
scope_data_.rresize(qMax(0, int(scope_data_.size()) - kScopeSize*2));
return m_scope;
return scope_;
}

View File

@ -33,27 +33,27 @@ class VlcEngine : public Engine::Base {
VlcEngine();
~VlcEngine();
bool init();
bool Init();
bool canDecode( const QUrl &url ) const;
bool CanDecode( const QUrl &url );
bool load( const QUrl &url, bool stream = false );
bool play( uint offset = 0 );
void stop();
void pause();
void unpause();
bool Load( const QUrl &url, Engine::TrackChangeType change );
bool Play( uint offset = 0 );
void Stop();
void Pause();
void Unpause();
Engine::State state() const { return state_; }
uint position() const;
uint length() const;
void seek( uint ms );
void Seek( uint ms );
static void SetScopeData(float* data, int size);
const Engine::Scope& scope();
const Engine::Scope& Scope();
protected:
void setVolumeSW( uint percent );
void SetVolumeSW( uint percent );
private:
void HandleErrors() const;

File diff suppressed because it is too large Load Diff

View File

@ -57,16 +57,16 @@ class XineEngine : public Engine::Base
~XineEngine();
virtual bool init();
virtual bool canDecode( const QUrl& ) const;
virtual bool load( const QUrl &url, bool stream );
virtual bool play( uint = 0 );
virtual void stop();
virtual void pause();
virtual void unpause();
virtual bool Init();
virtual bool CanDecode( const QUrl& );
virtual bool Load( const QUrl &url, Engine::TrackChangeType change );
virtual bool Play( uint = 0 );
virtual void Stop();
virtual void Pause();
virtual void Unpause();
virtual uint position() const;
virtual uint length() const;
virtual void seek( uint );
virtual void Seek( uint );
virtual bool metaDataForUrl(const QUrl &url, Engine::SimpleMetaBundle &b);
virtual bool getAudioCDContents(const QString &device, QList<QUrl> &urls);
@ -77,7 +77,7 @@ class XineEngine : public Engine::Base
virtual void setEqualizerEnabled( bool );
virtual void setEqualizerParameters( int preamp, const QList<int>& );
virtual void setVolumeSW( uint );
virtual void SetVolumeSW( uint );
virtual void fadeOut( uint fadeLength, bool* terminate, bool exiting = false );
static void XineEventListener( void*, const xine_event_t* );
@ -95,35 +95,38 @@ class XineEngine : public Engine::Base
void determineAndShowErrorMessage(); //call after failure to load/play
xine_t *m_xine;
xine_stream_t *m_stream;
xine_audio_port_t *m_audioPort;
xine_event_queue_t *m_eventQueue;
xine_post_t *m_post;
xine_t *xine_;
xine_stream_t *stream_;
xine_audio_port_t *audioPort_;
xine_event_queue_t *eventQueue_;
xine_post_t *post_;
int64_t m_currentVpts;
float m_preamp;
int64_t currentVpts_;
float preamp_;
bool m_stopFader;
bool m_fadeOutRunning;
bool stopFader_;
bool fadeOutRunning_;
QString m_currentAudioPlugin; //to see if audio plugin has been changed
QString currentAudioPlugin_; //to see if audio plugin has been changed
//need to save these for when the audio plugin is changed and xine reloaded
bool m_equalizerEnabled;
int m_intPreamp;
QList<int> m_equalizerGains;
bool equalizerEnabled_;
int intPreamp_;
QList<int> equalizerGains_;
QMutex m_initMutex;
QMutex initMutex_;
QSettings m_settings;
bool m_fadeoutOnExit;
bool m_fadeoutEnabled;
bool m_crossfadeEnabled;
int m_fadeoutDuration;
QSettings settings_;
bool fadeoutOnExit_;
bool fadeoutEnabled_;
bool crossfadeEnabled_;
int fadeoutDuration_;
int xfadeLength_;
bool xfadeNextTrack_;
QUrl url_;
PruneScopeThread* prune_;
mutable Engine::SimpleMetaBundle m_currentBundle;
mutable Engine::SimpleMetaBundle currentBundle_;
public:
XineEngine();
@ -133,19 +136,21 @@ public:
signals:
void resetConfig(xine_t *xine);
void InfoMessage(const QString&);
void LastFmTrackChange();
};
class Fader : public QThread
{
XineEngine *m_engine;
xine_t *m_xine;
xine_stream_t *m_decrease;
xine_stream_t *m_increase;
xine_audio_port_t *m_port;
xine_post_t *m_post;
uint m_fadeLength;
bool m_paused;
bool m_terminated;
XineEngine *engine_;
xine_t *xine_;
xine_stream_t *decrease_;
xine_stream_t *increase_;
xine_audio_port_t *port_;
xine_post_t *post_;
uint fadeLength_;
bool paused_;
bool terminated_;
virtual void run();
@ -159,9 +164,9 @@ public:
class OutFader : public QThread
{
XineEngine *m_engine;
bool m_terminated;
uint m_fadeLength;
XineEngine *engine_;
bool terminated_;
uint fadeLength_;
virtual void run();

View File

@ -141,7 +141,7 @@ int main(int argc, char *argv[]) {
#endif
// Window
MainWindow w(&network);
MainWindow w(&network, options.engine());
#ifdef Q_OS_DARWIN
mac::SetApplicationHandler(&w);

View File

@ -72,7 +72,7 @@ const char* MainWindow::kSettingsGroup = "MainWindow";
const char* MainWindow::kMediaFilterSpec =
"Music (*.mp3 *.ogg *.flac *.mpc *.m4a *.aac *.wma);;Playlists (*.m3u *.xspf *.xml)";
MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent)
MainWindow::MainWindow(QNetworkAccessManager* network, Engine::Type engine, QWidget *parent)
: QMainWindow(parent),
#ifdef Q_OS_DARWIN
tray_icon_(NULL),
@ -88,7 +88,7 @@ MainWindow::MainWindow(QNetworkAccessManager* network, QWidget *parent)
about_dialog_(new About),
radio_model_(new RadioModel(this)),
playlist_(new Playlist(this)),
player_(new Player(playlist_, radio_model_->GetLastFMService(), this)),
player_(new Player(playlist_, radio_model_->GetLastFMService(), engine, this)),
library_(new Library(player_->GetEngine(), this)),
global_shortcuts_(new GlobalShortcuts(this)),
settings_dialog_(new SettingsDialog),

View File

@ -24,6 +24,7 @@
#include <QSystemTrayIcon>
#include "ui_mainwindow.h"
#include "engines/engine_fwd.h"
class Playlist;
class Player;
@ -55,7 +56,7 @@ class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QNetworkAccessManager* network, QWidget *parent = 0);
MainWindow(QNetworkAccessManager* network, Engine::Type engine, QWidget *parent = 0);
~MainWindow();
static const char* kSettingsGroup;

26
src/pig.txt Normal file
View File

@ -0,0 +1,26 @@
___
,---. /""`_,'
| `\``""-; /
\ /`\\ ';'
.') | __ \
/ (` / /(O\. _|
.-`| `"` ` .-\_
.-' \ ` ;=-.
.' . ._, / o o\
.-'` . '-._;_._.J
.-'` `.-'`
_.-` ' .'
.' '- ._.-'
/` /
/ You have been warned! |
._ ; | |
)).-| | | /
(/`.-| \ \ / .;
( (_)| | \ ; .' |
'--'; | `\ / / |
\ | `\ /.' /
\ / ; |`\ |
'. .' _.-| | | |
'-. .-';_"---'`.__| | | \
`'-._ ``'-. | \ \__\\
`''--.___\\ \__\\

View File

@ -17,7 +17,20 @@
#include "player.h"
#include "playlist.h"
#include "lastfmservice.h"
#include "engines/gstengine.h"
#include "engines/enginebase.h"
#ifdef HAVE_GSTREAMER
# include "engines/gstengine.h"
#endif
#ifdef HAVE_VLC
# include "engines/vlcengine.h"
#endif
#ifdef HAVE_XINE
# include "engines/xine-engine.h"
#endif
#ifdef HAVE_QT_PHONON
# include "engines/phononengine.h"
#endif
#ifdef Q_WS_X11
# include "mpris_player.h"
@ -54,14 +67,15 @@ const QDBusArgument& operator>> (const QDBusArgument& arg, DBusStatus& status) {
}
#endif
Player::Player(Playlist* playlist, LastFMService* lastfm, QObject* parent)
Player::Player(Playlist* playlist, LastFMService* lastfm, Engine::Type engine, QObject* parent)
: QObject(parent),
playlist_(playlist),
lastfm_(lastfm),
current_item_options_(PlaylistItem::Default),
engine_(new GstEngine),
stream_change_type_(Engine::First)
{
engine_ = createEngine(engine);
settings_.beginGroup("Player");
SetVolume(settings_.value("volume", 50).toInt());
@ -79,6 +93,37 @@ Player::Player(Playlist* playlist, LastFMService* lastfm, QObject* parent)
#endif
}
EngineBase* Player::createEngine(Engine::Type engine) {
switch(engine) {
#ifdef HAVE_GSTREAMER
case Engine::gstreamer:
return new GstEngine();
break;
#endif
#ifdef HAVE_VLC
case Engine::vlc:
return new VlcEngine();
break;
#endif
#ifdef HAVE_XINE
case Engine::xine:
return new XineEngine();
break;
#endif
#ifdef HAVE_QT_PHONON
case Engine::qt_phonon:
return new PhononEngine();
break;
#endif
default:
qFatal("Selected engine not compiled in");
break;
}
/* NOT REACHED */
return NULL;
}
void Player::Init() {
if (!engine_->Init())
qFatal("Error initialising audio engine");

View File

@ -52,8 +52,9 @@ class Player : public QObject {
Q_OBJECT
public:
Player(Playlist* playlist, LastFMService* lastfm, QObject* parent = 0);
Player(Playlist* playlist, LastFMService* lastfm, Engine::Type engine, QObject* parent = 0);
EngineBase* createEngine(Engine::Type engine);
void Init();
EngineBase* GetEngine() { return engine_; }

View File

@ -550,6 +550,14 @@ msgstr ""
msgid "Display the on-screen-display"
msgstr ""
#, fuzzy
msgid "Select engine"
msgstr "Clementine"
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr "Clementine"
@ -692,8 +700,7 @@ msgid "Tools"
msgstr "Nástroje"
msgid "These folders will be scanned for music to make up your library"
msgstr ""
"Tyto složky budou prohledány a nalezená hudba bude přidána do knihovny"
msgstr "Tyto složky budou prohledány a nalezená hudba bude přidána do knihovny"
msgid "Add new folder..."
msgstr "Přidat novou složku..."
@ -732,11 +739,11 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr ""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
"Pamatujte, že musíte být <span style=\" font-weight:600;\">platící "
"uživatel</span> abyste v Clementine mohli poslouchat rádio Last.fm."
"Pamatujte, že musíte být <span style=\" font-weight:600;\">platící uživatel</"
"span> abyste v Clementine mohli poslouchat rádio Last.fm."
msgid "Authenticating..."
msgstr "Ověřuji..."
@ -747,8 +754,8 @@ msgstr "Přehrát umělce nebo značku"
msgid ""
"Enter an <b>artist</b> or <b>tag</b> to start listening to Last.fm radio."
msgstr ""
"Zadejte <b>umělce</b> nebo <b>značku</b> pro spuštění poslouchání rádia "
"Last.fm."
"Zadejte <b>umělce</b> nebo <b>značku</b> pro spuštění poslouchání rádia Last."
"fm."
msgid "Tag"
msgstr "Značka"

View File

@ -555,6 +555,14 @@ msgstr "Einstellungen"
msgid "Display the on-screen-display"
msgstr ""
#, fuzzy
msgid "Select engine"
msgstr "Clementine"
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr "Clementine"

View File

@ -541,8 +541,7 @@ msgid "Append files/URLs to the playlist"
msgstr "Προσάρτηση αρχείων/URLs στην λίστα αναπαραγωγής"
msgid "Loads files/URLs, replacing current playlist"
msgstr ""
"Φορτώνει αρχεία/URLs, αντικαθιστώντας την τρέχουσα λίστα αναπαραγωγής"
msgstr "Φορτώνει αρχεία/URLs, αντικαθιστώντας την τρέχουσα λίστα αναπαραγωγής"
msgid "Play the <n>th track in the playlist"
msgstr "Αναπαραγωγή του <n>ου κομματιού της λίστας αναπαραγωγής"
@ -553,6 +552,14 @@ msgstr "Άλλες επιλογές"
msgid "Display the on-screen-display"
msgstr "Απεικόνιση της «απεικόνισης στην οθόνη»"
#, fuzzy
msgid "Select engine"
msgstr "Clementine"
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr "Clementine"
@ -695,8 +702,7 @@ msgid "Tools"
msgstr "Εργαλεία"
msgid "These folders will be scanned for music to make up your library"
msgstr ""
"Οι φάκελοι αυτοί θα σαρωθούν για μουσικά αρχεία για την βιβλιοθήκη σας"
msgstr "Οι φάκελοι αυτοί θα σαρωθούν για μουσικά αρχεία για την βιβλιοθήκη σας"
msgid "Add new folder..."
msgstr "Προσθήκη νέου φακέλου..."
@ -735,11 +741,11 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr "Εμφάνισε τα κουμπιά \"αγάπη\"και \"απαγόρευση\""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
"Σημείωσε πως πρέπει να είσαι <span style=\" font-"
"weight:600;\">συνδρομητής</span> για να ακούσεις Last.fm από το Clementine."
"Σημείωσε πως πρέπει να είσαι <span style=\" font-weight:600;\">συνδρομητής</"
"span> για να ακούσεις Last.fm από το Clementine."
msgid "Authenticating..."
msgstr "Πιστοποίηση..."

View File

@ -255,8 +255,7 @@ msgid "This stream is for paid subscribers only"
msgstr "Este flujo es solo para Suscriptores de Paga"
msgid "Last.fm is currently busy, please try again in a few minutes"
msgstr ""
"Last.fm está actualmente saturado, intente nuevamente en unos minutos"
msgstr "Last.fm está actualmente saturado, intente nuevamente en unos minutos"
msgid "Not enough content"
msgstr "No hay suficiente contenido"
@ -378,8 +377,8 @@ msgstr "Establecer carátula personalizada"
msgid ""
"Images (*.png *.jpg *.jpeg *.bmp *.gif *.xpm *.pbm *.pgm *.ppm *.xbm *.tiff)"
msgstr ""
"Imágenes (*.png *.jpg *.jpeg *.bmp *.gif *.xpm *.pbm *.pgm *.ppm *.xbm "
"*.tiff)"
"Imágenes (*.png *.jpg *.jpeg *.bmp *.gif *.xpm *.pbm *.pgm *.ppm *.xbm *."
"tiff)"
msgid "All files (*)"
msgstr "Todos los archivos (*)"
@ -553,6 +552,14 @@ msgstr "Otras opciones"
msgid "Display the on-screen-display"
msgstr "Mostrar la indicación-en-pantalla"
#, fuzzy
msgid "Select engine"
msgstr "Clementine"
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr "Clementine"
@ -708,8 +715,7 @@ msgid "Options"
msgstr "Opciones"
msgid "Automatically open single categories in the library tree"
msgstr ""
"Automaticamente expandir categorias unicas en el árbol de la colección"
msgstr "Automaticamente expandir categorias unicas en el árbol de la colección"
msgid "Form"
msgstr "Formulario"
@ -736,8 +742,8 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr "Mostrar los botones \"Me encanta\" y \"Prohibir\""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
"Recuerda que tienes que ser un <span style=\" font-weight:600;\">Suscriptor "
"de Paga</span> para poder escuchar la radio de Last.fm desde Clementine."
@ -751,8 +757,8 @@ msgstr "Reproducir Artista o Etiqueta"
msgid ""
"Enter an <b>artist</b> or <b>tag</b> to start listening to Last.fm radio."
msgstr ""
"Ingrese un <b>artista</b> o <b>etiqueta</b> para escuchar la radio de "
"Last.fm."
"Ingrese un <b>artista</b> o <b>etiqueta</b> para escuchar la radio de Last."
"fm."
msgid "Tag"
msgstr "Etiqueta"
@ -1050,8 +1056,8 @@ msgstr "Habilitar el ecualizador"
#~ msgstr "Acceso por defecto:"
#~ msgid ""
#~ "You are about to reset to global shortcuts default values. Are you sure you "
#~ "want to continue?"
#~ "You are about to reset to global shortcuts default values. Are you sure "
#~ "you want to continue?"
#~ msgstr ""
#~ "Estas por reinicar las teclas rapidas a sus valores por defecto. Estás "
#~ "seguro que deseas continuar?"

View File

@ -553,6 +553,14 @@ msgstr "Autres options"
msgid "Display the on-screen-display"
msgstr ""
#, fuzzy
msgid "Select engine"
msgstr "Clementine"
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr "Clementine"
@ -736,8 +744,8 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr ""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
"N'oubliez pas que vous devez être <span style=\" font-weight:600;\">abonné "
"(payant)</span> pour écouter la radio Last.fm avec Clementine."

View File

@ -557,6 +557,14 @@ msgstr "Instillinger"
msgid "Display the on-screen-display"
msgstr ""
#, fuzzy
msgid "Select engine"
msgstr "Clementine"
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr "Clementine"

View File

@ -550,6 +550,13 @@ msgstr ""
msgid "Display the on-screen-display"
msgstr ""
msgid "Select engine"
msgstr ""
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr ""
@ -731,8 +738,8 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr ""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
"Musisz posiadać <span style=\" font-weight:600;\">opłacone konto</span> aby "
"słuchać radia Last.fm w Clementine."
@ -745,8 +752,7 @@ msgstr "Odtwarzaj Wykonawcę lub Znacznik"
msgid ""
"Enter an <b>artist</b> or <b>tag</b> to start listening to Last.fm radio."
msgstr ""
"Wpisz <b>wykonawcę</b> lub <b>znacznik</b> aby słuchać radia Last.fm."
msgstr "Wpisz <b>wykonawcę</b> lub <b>znacznik</b> aby słuchać radia Last.fm."
msgid "Tag"
msgstr "Znacznik"

View File

@ -552,6 +552,14 @@ msgstr "Outras opções"
msgid "Display the on-screen-display"
msgstr ""
#, fuzzy
msgid "Select engine"
msgstr "Clementine"
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr "Clementine"
@ -733,8 +741,8 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr "Mostrar os botões \"adorar\" e \"excluir\""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
"Note que deverá ser <span style=\" font-weight:600;\"> um assinante </span> "
"para ouvir rádio da Last.fm com o Clementine."
@ -806,8 +814,7 @@ msgid "Choose automatically"
msgstr "Escolher automaticamente"
msgid "Leave blank for the default. Examples: \"/dev/dsp\", \"front\", etc."
msgstr ""
"Deixar em branco por defeito. Exemplos: \"/dev/dsp\", \"front\", etc."
msgstr "Deixar em branco por defeito. Exemplos: \"/dev/dsp\", \"front\", etc."
msgid "Output device"
msgstr "Dispositivo de saída"

View File

@ -549,6 +549,13 @@ msgstr ""
msgid "Display the on-screen-display"
msgstr ""
msgid "Select engine"
msgstr ""
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr ""
@ -730,8 +737,8 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr ""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
msgid "Authenticating..."

View File

@ -375,8 +375,8 @@ msgstr "Укажите обложку вручную"
msgid ""
"Images (*.png *.jpg *.jpeg *.bmp *.gif *.xpm *.pbm *.pgm *.ppm *.xbm *.tiff)"
msgstr ""
"Изображения (*.png *.jpg *.jpeg *.bmp *.gif *.xpm *.pbm *.pgm *.ppm *.xbm "
"*.tiff)"
"Изображения (*.png *.jpg *.jpeg *.bmp *.gif *.xpm *.pbm *.pgm *.ppm *.xbm *."
"tiff)"
msgid "All files (*)"
msgstr "Все файлы (*)"
@ -550,6 +550,14 @@ msgstr "Другие настройки"
msgid "Display the on-screen-display"
msgstr "Показывать экранное уведомление"
#, fuzzy
msgid "Select engine"
msgstr "Clementine"
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr "Clementine"
@ -732,12 +740,11 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr "Показывать кнопки \"Избранное\" и \"Запретить\""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
"Обратите внимание, что вы должны быть <span style=\"font-"
"weight:600;\">платным подписчиком</span> ,чтобы слушать радио Last.fm из "
"Clementine."
"Обратите внимание, что вы должны быть <span style=\"font-weight:600;"
"\">платным подписчиком</span> ,чтобы слушать радио Last.fm из Clementine."
msgid "Authenticating..."
msgstr "Аутентификация..."
@ -747,8 +754,7 @@ msgstr "Проиграть исполнителя или тег"
msgid ""
"Enter an <b>artist</b> or <b>tag</b> to start listening to Last.fm radio."
msgstr ""
"Укажите <b>исполнителя</b> или <b>тег</b> чтобы слушать радио Last.fm."
msgstr "Укажите <b>исполнителя</b> или <b>тег</b> чтобы слушать радио Last.fm."
msgid "Tag"
msgstr "Тег"

View File

@ -551,6 +551,13 @@ msgstr ""
msgid "Display the on-screen-display"
msgstr ""
msgid "Select engine"
msgstr ""
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr ""
@ -732,8 +739,8 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr ""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
"Pam§tajte, že musíte byť <span style=\" font-weight:600;\">platiaci "
"odberateľ</span> aby ste mohli počúvať Last.fm rádio v Clementine."
@ -1039,8 +1046,8 @@ msgstr ""
#~ msgstr "Pôvodný kľúč"
#~ msgid ""
#~ "You are about to reset to global shortcuts default values. Are you sure you "
#~ "want to continue?"
#~ "You are about to reset to global shortcuts default values. Are you sure "
#~ "you want to continue?"
#~ msgstr ""
#~ "Pokúšate sa zresetovať pôvodné globálne skratky. Ste si istý, že chcete "
#~ "pokračovať?"

View File

@ -550,6 +550,14 @@ msgstr "Övriga alternativ"
msgid "Display the on-screen-display"
msgstr ""
#, fuzzy
msgid "Select engine"
msgstr "Clementine"
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr "Clementine"
@ -733,8 +741,8 @@ msgid "Show the \"love\" and \"ban\" buttons"
msgstr "Visa knapparna \"gilla\" och \"banlys\""
msgid ""
"Note that you must be a <span style=\" font-weight:600;\">paid "
"subscriber</span> to listen to Last.fm radio from within Clementine."
"Note that you must be a <span style=\" font-weight:600;\">paid subscriber</"
"span> to listen to Last.fm radio from within Clementine."
msgstr ""
"Du måste ha ett <span style=\"font-weight:600;\">betalabonnemang</span> för "
"att kunna lyssna på Last.fm radio i Clementine."
@ -748,8 +756,8 @@ msgstr "Spela upp artist eller tagg"
msgid ""
"Enter an <b>artist</b> or <b>tag</b> to start listening to Last.fm radio."
msgstr ""
"Skriv in en <b>artist</b> eller <b>tagg</b> för att börja lyssna till "
"Last.fm radio."
"Skriv in en <b>artist</b> eller <b>tagg</b> för att börja lyssna till Last."
"fm radio."
msgid "Tag"
msgstr "Tagg"

View File

@ -549,6 +549,13 @@ msgstr ""
msgid "Display the on-screen-display"
msgstr ""
msgid "Select engine"
msgstr ""
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr ""

View File

@ -540,6 +540,13 @@ msgstr ""
msgid "Display the on-screen-display"
msgstr ""
msgid "Select engine"
msgstr ""
#, qt-format
msgid "Unknown audio engine \"%1\". Choices are:"
msgstr ""
msgid "Clementine"
msgstr ""