Skip to content

Commit

Permalink
Don't include cdda code if HAVE_AUDIOCD isn't defined
Browse files Browse the repository at this point in the history
  • Loading branch information
jbroadus authored and hatstand committed Jun 1, 2020
1 parent 3616a50 commit 236cfa7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/engines/gstenginepipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
#include "core/mac_startup.h"
#include "core/signalchecker.h"
#include "core/utilities.h"
#ifdef HAVE_AUDIOCD
#include "devices/cddadevice.h"
#endif
#include "internet/core/internetmodel.h"
#ifdef HAVE_SPOTIFY
# include "internet/spotify/spotifyserver.h"
# include "internet/spotify/spotifyservice.h"
#include "internet/spotify/spotifyserver.h"
#include "internet/spotify/spotifyservice.h"
#endif

const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000;
Expand Down Expand Up @@ -161,6 +163,13 @@ bool GstEnginePipeline::ReplaceDecodeBin(const QUrl& url) {
return ReplaceDecodeBin(new_bin);
}

QByteArray GstEnginePipeline::GstUriFromUrl(const QUrl& url) {
#ifdef HAVE_AUDIOCD
if (url.scheme() == "cdda") return CddaDevice::TrackUrlToStr(url).toUtf8();
#endif
return Utilities::GetUriForGstreamer(url);
}

GstElement* GstEnginePipeline::CreateDecodeBinFromUrl(const QUrl& url) {
GstElement* new_bin = nullptr;
#ifdef HAVE_SPOTIFY
Expand Down Expand Up @@ -202,12 +211,7 @@ GstElement* GstEnginePipeline::CreateDecodeBinFromUrl(const QUrl& url) {
Q_ARG(QString, url.toString()), Q_ARG(quint16, port));
} else {
#endif
QByteArray uri;
if (url.scheme() == "cdda") {
uri = CddaDevice::TrackUrlToStr(url).toUtf8();
} else {
uri = Utilities::GetUriForGstreamer(url);
}
QByteArray uri = GstUriFromUrl(url);
new_bin = engine_->CreateElement("uridecodebin");
if (!new_bin) return nullptr;
g_object_set(G_OBJECT(new_bin), "uri", uri.constData(), nullptr);
Expand Down Expand Up @@ -525,6 +529,7 @@ bool GstEnginePipeline::InitFromReq(const MediaPlaybackRequest& req,

current_ = req;
QUrl url = current_.url_;
#ifdef HAVE_AUDIOCD
if (url.scheme() == "cdda" && !url.path().isEmpty()) {
// Currently, Gstreamer can't handle input CD devices inside cdda URL. So
// we handle them ourself: we extract the track number and re-create an
Expand All @@ -535,6 +540,7 @@ bool GstEnginePipeline::InitFromReq(const MediaPlaybackRequest& req,
url = QUrl(QString("cdda://%1").arg(path.takeLast()));
source_device_ = path.join("/");
}
#endif
end_offset_nanosec_ = end_nanosec;

// Decode bin
Expand Down
2 changes: 2 additions & 0 deletions src/engines/gstenginepipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class GstEnginePipeline : public QObject {
gpointer);
static void TaskEnterCallback(GstTask*, GThread*, gpointer);

static QByteArray GstUriFromUrl(const QUrl& url);

void TagMessageReceived(GstMessage*);
void ErrorMessageReceived(GstMessage*);
void ElementMessageReceived(GstMessage*);
Expand Down

0 comments on commit 236cfa7

Please sign in to comment.