mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 03:45:56 +01:00
Use url instead of filename.
This commit is contained in:
parent
823b59e3a7
commit
38f1b71761
@ -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<QIODevice> 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)),
|
||||
|
@ -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);
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define MOODBARPIPELINE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/app/gstappsink.h>
|
||||
@ -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_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user