From 38f1b717615112df43579570aceb830481a8c899 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 28 May 2012 15:33:37 -0700 Subject: [PATCH] Use url instead of filename. --- src/moodbar/moodbarloader.cpp | 10 +++++----- src/moodbar/moodbarpipeline.cpp | 5 ++--- src/moodbar/moodbarpipeline.h | 5 +++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/moodbar/moodbarloader.cpp b/src/moodbar/moodbarloader.cpp index 8999b9063..1fbb71ad3 100644 --- a/src/moodbar/moodbarloader.cpp +++ b/src/moodbar/moodbarloader.cpp @@ -81,10 +81,10 @@ MoodbarLoader::Result MoodbarLoader::Load( *async_pipeline = requests_[url]; return WillLoadAsync; } - + // Check if a mood file exists for this file already const QString filename(url.toLocalFile()); - + foreach (const QString& possible_mood_file, MoodFilenames(filename)) { QFile f(possible_mood_file); if (f.open(QIODevice::ReadOnly)) { @@ -93,7 +93,7 @@ MoodbarLoader::Result MoodbarLoader::Load( return Loaded; } } - + // Maybe it exists in the cache? boost::scoped_ptr cache_device(cache_->data(url)); if (cache_device) { @@ -106,9 +106,9 @@ MoodbarLoader::Result MoodbarLoader::Load( if (!thread_->isRunning()) thread_->start(); - + // There was no existing file, analyze the audio file and create one. - MoodbarPipeline* pipeline = new MoodbarPipeline(filename); + MoodbarPipeline* pipeline = new MoodbarPipeline(url); pipeline->moveToThread(thread_); NewClosure(pipeline, SIGNAL(Finished(bool)), this, SLOT(RequestFinished(MoodbarPipeline*,QUrl)), diff --git a/src/moodbar/moodbarpipeline.cpp b/src/moodbar/moodbarpipeline.cpp index 7bb78938e..ede7202dd 100644 --- a/src/moodbar/moodbarpipeline.cpp +++ b/src/moodbar/moodbarpipeline.cpp @@ -24,7 +24,7 @@ bool MoodbarPipeline::sIsAvailable = false; -MoodbarPipeline::MoodbarPipeline(const QString& local_filename) +MoodbarPipeline::MoodbarPipeline(const QUrl& local_filename) : QObject(NULL), local_filename_(local_filename), pipeline_(NULL), @@ -93,9 +93,8 @@ void MoodbarPipeline::Start() { // Join them together gst_element_link_many(convert_element_, fftwspectrum, moodbar, appsink, NULL); - QUrl local_url = QUrl::fromLocalFile(local_filename_); // Set properties - g_object_set(decodebin, "uri", local_url.toEncoded().constData(), NULL); + g_object_set(decodebin, "uri", local_filename_.toEncoded().constData(), NULL); g_object_set(fftwspectrum, "def-size", 2048, "def-step", 1024, "hiquality", true, NULL); diff --git a/src/moodbar/moodbarpipeline.h b/src/moodbar/moodbarpipeline.h index 6a8384bb9..5978fc89a 100644 --- a/src/moodbar/moodbarpipeline.h +++ b/src/moodbar/moodbarpipeline.h @@ -19,6 +19,7 @@ #define MOODBARPIPELINE_H #include +#include #include #include @@ -28,7 +29,7 @@ class MoodbarPipeline : public QObject { Q_OBJECT public: - MoodbarPipeline(const QString& local_filename); + MoodbarPipeline(const QUrl& local_filename); ~MoodbarPipeline(); static bool IsAvailable(); @@ -57,7 +58,7 @@ private: private: static bool sIsAvailable; - QString local_filename_; + QUrl local_filename_; GstElement* pipeline_; GstElement* convert_element_;