Fix compilation without gstreamer. Fixes issue #440
This commit is contained in:
parent
7c09e39d41
commit
0404ecec70
@ -111,10 +111,6 @@ set(SOURCES
|
|||||||
radio/savedradio.cpp
|
radio/savedradio.cpp
|
||||||
radio/somafmservice.cpp
|
radio/somafmservice.cpp
|
||||||
|
|
||||||
transcoder/transcodedialog.cpp
|
|
||||||
transcoder/transcoder.cpp
|
|
||||||
transcoder/transcoderformats.cpp
|
|
||||||
|
|
||||||
ui/about.cpp
|
ui/about.cpp
|
||||||
ui/addstreamdialog.cpp
|
ui/addstreamdialog.cpp
|
||||||
ui/albumcovermanager.cpp
|
ui/albumcovermanager.cpp
|
||||||
@ -224,9 +220,6 @@ set(HEADERS
|
|||||||
radio/savedradio.h
|
radio/savedradio.h
|
||||||
radio/somafmservice.h
|
radio/somafmservice.h
|
||||||
|
|
||||||
transcoder/transcodedialog.h
|
|
||||||
transcoder/transcoder.h
|
|
||||||
|
|
||||||
ui/about.h
|
ui/about.h
|
||||||
ui/addstreamdialog.h
|
ui/addstreamdialog.h
|
||||||
ui/albumcovermanager.h
|
ui/albumcovermanager.h
|
||||||
@ -275,9 +268,6 @@ set(UI
|
|||||||
radio/magnatunedownloaddialog.ui
|
radio/magnatunedownloaddialog.ui
|
||||||
radio/radioviewcontainer.ui
|
radio/radioviewcontainer.ui
|
||||||
|
|
||||||
transcoder/transcodedialog.ui
|
|
||||||
transcoder/transcodelogdialog.ui
|
|
||||||
|
|
||||||
ui/about.ui
|
ui/about.ui
|
||||||
ui/addstreamdialog.ui
|
ui/addstreamdialog.ui
|
||||||
ui/albumcovermanager.ui
|
ui/albumcovermanager.ui
|
||||||
@ -378,6 +368,25 @@ if(ENABLE_VISUALISATIONS)
|
|||||||
)
|
)
|
||||||
endif(ENABLE_VISUALISATIONS)
|
endif(ENABLE_VISUALISATIONS)
|
||||||
|
|
||||||
|
# Transcoder
|
||||||
|
if(HAVE_GSTREAMER)
|
||||||
|
list(APPEND SOURCES
|
||||||
|
transcoder/transcodedialog.cpp
|
||||||
|
transcoder/transcoder.cpp
|
||||||
|
transcoder/transcoderformats.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND HEADERS
|
||||||
|
transcoder/transcodedialog.h
|
||||||
|
transcoder/transcoder.h
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND UI
|
||||||
|
transcoder/transcodedialog.ui
|
||||||
|
transcoder/transcodelogdialog.ui
|
||||||
|
)
|
||||||
|
endif(HAVE_GSTREAMER)
|
||||||
|
|
||||||
# OSDs
|
# OSDs
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
list(APPEND SOURCES widgets/osd_mac.mm)
|
list(APPEND SOURCES widgets/osd_mac.mm)
|
||||||
|
@ -47,14 +47,19 @@ SongLoader::SongLoader(QObject *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeout_timer_->setSingleShot(true);
|
timeout_timer_->setSingleShot(true);
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
connect(timeout_timer_, SIGNAL(timeout()), SLOT(Timeout()));
|
connect(timeout_timer_, SIGNAL(timeout()), SLOT(Timeout()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SongLoader::~SongLoader() {
|
SongLoader::~SongLoader() {
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
if (pipeline_) {
|
if (pipeline_) {
|
||||||
state_ = Finished;
|
state_ = Finished;
|
||||||
gst_element_set_state(pipeline_.get(), GST_STATE_NULL);
|
gst_element_set_state(pipeline_.get(), GST_STATE_NULL);
|
||||||
}
|
}
|
||||||
|
#endif // HAVE_GSTREAMER
|
||||||
}
|
}
|
||||||
|
|
||||||
SongLoader::Result SongLoader::Load(const QUrl& url) {
|
SongLoader::Result SongLoader::Load(const QUrl& url) {
|
||||||
@ -71,8 +76,15 @@ SongLoader::Result SongLoader::Load(const QUrl& url) {
|
|||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
timeout_timer_->start(timeout_);
|
timeout_timer_->start(timeout_);
|
||||||
return LoadRemote();
|
return LoadRemote();
|
||||||
|
#else
|
||||||
|
// If we don't have GStreamer we can't check the type of remote playlists,
|
||||||
|
// so just assume it's a raw stream and get on with our lives.
|
||||||
|
AddAsRawStream();
|
||||||
|
return Success;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SongLoader::Result SongLoader::LoadLocal() {
|
SongLoader::Result SongLoader::LoadLocal() {
|
||||||
@ -139,6 +151,16 @@ void SongLoader::LoadLocalDirectory(const QString& filename) {
|
|||||||
emit LoadFinished(true);
|
emit LoadFinished(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SongLoader::AddAsRawStream() {
|
||||||
|
Song song;
|
||||||
|
song.set_valid(true);
|
||||||
|
song.set_filetype(Song::Type_Stream);
|
||||||
|
song.set_filename(url_.toString());
|
||||||
|
song.set_title(url_.toString());
|
||||||
|
songs_ << song;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
SongLoader::Result SongLoader::LoadRemote() {
|
SongLoader::Result SongLoader::LoadRemote() {
|
||||||
qDebug() << "Loading remote file" << url_;
|
qDebug() << "Loading remote file" << url_;
|
||||||
|
|
||||||
@ -226,6 +248,12 @@ void SongLoader::DataReady(GstPad *, GstBuffer *buf, void *self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SongLoader::Timeout() {
|
||||||
|
state_ = Finished;
|
||||||
|
success_ = false;
|
||||||
|
StopTypefind();
|
||||||
|
}
|
||||||
|
|
||||||
gboolean SongLoader::BusCallback(GstBus*, GstMessage* msg, gpointer self) {
|
gboolean SongLoader::BusCallback(GstBus*, GstMessage* msg, gpointer self) {
|
||||||
SongLoader* instance = reinterpret_cast<SongLoader*>(self);
|
SongLoader* instance = reinterpret_cast<SongLoader*>(self);
|
||||||
|
|
||||||
@ -346,18 +374,4 @@ void SongLoader::StopTypefind() {
|
|||||||
|
|
||||||
emit LoadFinished(success_);
|
emit LoadFinished(success_);
|
||||||
}
|
}
|
||||||
|
#endif // HAVE_GSTREAMER
|
||||||
void SongLoader::AddAsRawStream() {
|
|
||||||
Song song;
|
|
||||||
song.set_valid(true);
|
|
||||||
song.set_filetype(Song::Type_Stream);
|
|
||||||
song.set_filename(url_.toString());
|
|
||||||
song.set_title(url_.toString());
|
|
||||||
songs_ << song;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SongLoader::Timeout() {
|
|
||||||
state_ = Finished;
|
|
||||||
success_ = false;
|
|
||||||
StopTypefind();
|
|
||||||
}
|
|
||||||
|
@ -20,10 +20,14 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <gst/gst.h>
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
|
# include <gst/gst.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class ParserBase;
|
class ParserBase;
|
||||||
class PlaylistParser;
|
class PlaylistParser;
|
||||||
@ -54,8 +58,10 @@ signals:
|
|||||||
void LoadFinished(bool success);
|
void LoadFinished(bool success);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
void Timeout();
|
void Timeout();
|
||||||
void StopTypefind();
|
void StopTypefind();
|
||||||
|
#endif // HAVE_GSTREAMER
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum State {
|
enum State {
|
||||||
@ -66,9 +72,13 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
Result LoadLocal();
|
Result LoadLocal();
|
||||||
Result LoadRemote();
|
|
||||||
void LoadLocalDirectory(const QString& filename);
|
void LoadLocalDirectory(const QString& filename);
|
||||||
|
|
||||||
|
void AddAsRawStream();
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
|
Result LoadRemote();
|
||||||
|
|
||||||
// GStreamer callbacks
|
// GStreamer callbacks
|
||||||
static void TypeFound(GstElement* typefind, uint probability, GstCaps* caps, void* self);
|
static void TypeFound(GstElement* typefind, uint probability, GstCaps* caps, void* self);
|
||||||
static void DataReady(GstPad*, GstBuffer* buf, void* self);
|
static void DataReady(GstPad*, GstBuffer* buf, void* self);
|
||||||
@ -79,8 +89,7 @@ private:
|
|||||||
void ErrorMessageReceived(GstMessage* msg);
|
void ErrorMessageReceived(GstMessage* msg);
|
||||||
void EndOfStreamReached();
|
void EndOfStreamReached();
|
||||||
void MagicReady();
|
void MagicReady();
|
||||||
|
#endif // HAVE_GSTREAMER
|
||||||
void AddAsRawStream();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static QSet<QString> sRawUriSchemes;
|
static QSet<QString> sRawUriSchemes;
|
||||||
@ -95,10 +104,13 @@ private:
|
|||||||
int timeout_;
|
int timeout_;
|
||||||
State state_;
|
State state_;
|
||||||
bool success_;
|
bool success_;
|
||||||
boost::shared_ptr<GstElement> pipeline_;
|
|
||||||
ParserBase* parser_;
|
ParserBase* parser_;
|
||||||
QString mime_type_;
|
QString mime_type_;
|
||||||
QByteArray buffer_;
|
QByteArray buffer_;
|
||||||
|
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
|
boost::shared_ptr<GstElement> pipeline_;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SONGLOADER_H
|
#endif // SONGLOADER_H
|
||||||
|
@ -123,7 +123,9 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
|
|||||||
add_stream_dialog_(new AddStreamDialog),
|
add_stream_dialog_(new AddStreamDialog),
|
||||||
cover_manager_(NULL),
|
cover_manager_(NULL),
|
||||||
equalizer_(new Equalizer),
|
equalizer_(new Equalizer),
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
transcode_dialog_(new TranscodeDialog),
|
transcode_dialog_(new TranscodeDialog),
|
||||||
|
#endif
|
||||||
error_dialog_(new ErrorDialog),
|
error_dialog_(new ErrorDialog),
|
||||||
organise_dialog_(new OrganiseDialog(task_manager_)),
|
organise_dialog_(new OrganiseDialog(task_manager_)),
|
||||||
#ifdef ENABLE_VISUALISATIONS
|
#ifdef ENABLE_VISUALISATIONS
|
||||||
@ -171,7 +173,11 @@ MainWindow::MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidg
|
|||||||
# ifdef ENABLE_VISUALISATIONS
|
# ifdef ENABLE_VISUALISATIONS
|
||||||
visualisation_->SetEngine(engine);
|
visualisation_->SetEngine(engine);
|
||||||
# endif
|
# endif
|
||||||
|
} else {
|
||||||
|
ui_->action_transcode->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
#else // HAVE_GSTREAMER
|
||||||
|
ui_->action_transcode->setEnabled(false);
|
||||||
#endif // HAVE_GSTREAMER
|
#endif // HAVE_GSTREAMER
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
|
@ -145,12 +145,14 @@ void ProjectMVisualisation::SetDuration(int seconds) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProjectMVisualisation::ConsumeBuffer(GstBuffer *buffer, GstEnginePipeline*) {
|
void ProjectMVisualisation::ConsumeBuffer(GstBuffer *buffer, GstEnginePipeline*) {
|
||||||
|
#ifdef HAVE_GSTREAMER
|
||||||
const int samples_per_channel = GST_BUFFER_SIZE(buffer) / sizeof(short) / 2;
|
const int samples_per_channel = GST_BUFFER_SIZE(buffer) / sizeof(short) / 2;
|
||||||
const short* data = reinterpret_cast<short*>(GST_BUFFER_DATA(buffer));
|
const short* data = reinterpret_cast<short*>(GST_BUFFER_DATA(buffer));
|
||||||
|
|
||||||
if (projectm_)
|
if (projectm_)
|
||||||
projectm_->pcm()->addPCM16Data(data, samples_per_channel);
|
projectm_->pcm()->addPCM16Data(data, samples_per_channel);
|
||||||
gst_buffer_unref(buffer);
|
gst_buffer_unref(buffer);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectMVisualisation::SetSelected(const QStringList& paths, bool selected) {
|
void ProjectMVisualisation::SetSelected(const QStringList& paths, bool selected) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user