mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 12:02:48 +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];
|
*async_pipeline = requests_[url];
|
||||||
return WillLoadAsync;
|
return WillLoadAsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if a mood file exists for this file already
|
// Check if a mood file exists for this file already
|
||||||
const QString filename(url.toLocalFile());
|
const QString filename(url.toLocalFile());
|
||||||
|
|
||||||
foreach (const QString& possible_mood_file, MoodFilenames(filename)) {
|
foreach (const QString& possible_mood_file, MoodFilenames(filename)) {
|
||||||
QFile f(possible_mood_file);
|
QFile f(possible_mood_file);
|
||||||
if (f.open(QIODevice::ReadOnly)) {
|
if (f.open(QIODevice::ReadOnly)) {
|
||||||
@ -93,7 +93,7 @@ MoodbarLoader::Result MoodbarLoader::Load(
|
|||||||
return Loaded;
|
return Loaded;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maybe it exists in the cache?
|
// Maybe it exists in the cache?
|
||||||
boost::scoped_ptr<QIODevice> cache_device(cache_->data(url));
|
boost::scoped_ptr<QIODevice> cache_device(cache_->data(url));
|
||||||
if (cache_device) {
|
if (cache_device) {
|
||||||
@ -106,9 +106,9 @@ MoodbarLoader::Result MoodbarLoader::Load(
|
|||||||
|
|
||||||
if (!thread_->isRunning())
|
if (!thread_->isRunning())
|
||||||
thread_->start();
|
thread_->start();
|
||||||
|
|
||||||
// There was no existing file, analyze the audio file and create one.
|
// 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_);
|
pipeline->moveToThread(thread_);
|
||||||
NewClosure(pipeline, SIGNAL(Finished(bool)),
|
NewClosure(pipeline, SIGNAL(Finished(bool)),
|
||||||
this, SLOT(RequestFinished(MoodbarPipeline*,QUrl)),
|
this, SLOT(RequestFinished(MoodbarPipeline*,QUrl)),
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
bool MoodbarPipeline::sIsAvailable = false;
|
bool MoodbarPipeline::sIsAvailable = false;
|
||||||
|
|
||||||
MoodbarPipeline::MoodbarPipeline(const QString& local_filename)
|
MoodbarPipeline::MoodbarPipeline(const QUrl& local_filename)
|
||||||
: QObject(NULL),
|
: QObject(NULL),
|
||||||
local_filename_(local_filename),
|
local_filename_(local_filename),
|
||||||
pipeline_(NULL),
|
pipeline_(NULL),
|
||||||
@ -93,9 +93,8 @@ void MoodbarPipeline::Start() {
|
|||||||
// Join them together
|
// Join them together
|
||||||
gst_element_link_many(convert_element_, fftwspectrum, moodbar, appsink, NULL);
|
gst_element_link_many(convert_element_, fftwspectrum, moodbar, appsink, NULL);
|
||||||
|
|
||||||
QUrl local_url = QUrl::fromLocalFile(local_filename_);
|
|
||||||
// Set properties
|
// 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,
|
g_object_set(fftwspectrum, "def-size", 2048,
|
||||||
"def-step", 1024,
|
"def-step", 1024,
|
||||||
"hiquality", true, NULL);
|
"hiquality", true, NULL);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#define MOODBARPIPELINE_H
|
#define MOODBARPIPELINE_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QUrl>
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/app/gstappsink.h>
|
#include <gst/app/gstappsink.h>
|
||||||
@ -28,7 +29,7 @@ class MoodbarPipeline : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MoodbarPipeline(const QString& local_filename);
|
MoodbarPipeline(const QUrl& local_filename);
|
||||||
~MoodbarPipeline();
|
~MoodbarPipeline();
|
||||||
|
|
||||||
static bool IsAvailable();
|
static bool IsAvailable();
|
||||||
@ -57,7 +58,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
static bool sIsAvailable;
|
static bool sIsAvailable;
|
||||||
|
|
||||||
QString local_filename_;
|
QUrl local_filename_;
|
||||||
GstElement* pipeline_;
|
GstElement* pipeline_;
|
||||||
GstElement* convert_element_;
|
GstElement* convert_element_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user