Remove VLC
This commit is contained in:
@@ -43,9 +43,7 @@
|
||||
#include "utilities/strutils.h"
|
||||
#include "tagreader/tagreaderclient.h"
|
||||
#include "organize.h"
|
||||
#ifdef HAVE_GSTREAMER
|
||||
# include "transcoder/transcoder.h"
|
||||
#endif
|
||||
#include "transcoder/transcoder.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
@@ -60,9 +58,7 @@ Organize::Organize(SharedPtr<TaskManager> task_manager, SharedPtr<MusicStorage>
|
||||
: QObject(parent),
|
||||
thread_(nullptr),
|
||||
task_manager_(task_manager),
|
||||
#ifdef HAVE_GSTREAMER
|
||||
transcoder_(new Transcoder(this)),
|
||||
#endif
|
||||
process_files_timer_(new QTimer(this)),
|
||||
destination_(destination),
|
||||
format_(format),
|
||||
@@ -109,10 +105,9 @@ void Organize::Start() {
|
||||
|
||||
thread_ = new QThread;
|
||||
QObject::connect(thread_, &QThread::started, this, &Organize::ProcessSomeFiles);
|
||||
#ifdef HAVE_GSTREAMER
|
||||
|
||||
QObject::connect(transcoder_, &Transcoder::JobComplete, this, &Organize::FileTranscoded);
|
||||
QObject::connect(transcoder_, &Transcoder::LogLine, this, &Organize::LogLine);
|
||||
#endif
|
||||
|
||||
moveToThread(thread_);
|
||||
thread_->start();
|
||||
@@ -136,14 +131,12 @@ void Organize::ProcessSomeFiles() {
|
||||
|
||||
// None left?
|
||||
if (tasks_pending_.isEmpty()) {
|
||||
#ifdef HAVE_GSTREAMER
|
||||
if (!tasks_transcoding_.isEmpty()) {
|
||||
// Just wait - FileTranscoded will start us off again in a little while
|
||||
qLog(Debug) << "Waiting for transcoding jobs";
|
||||
transcode_progress_timer_.start(kTranscodeProgressInterval, this);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
UpdateProgress();
|
||||
|
||||
@@ -180,7 +173,6 @@ void Organize::ProcessSomeFiles() {
|
||||
Song song = task.song_info_.song_;
|
||||
if (!song.is_valid()) continue;
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
// Maybe this file is one that's been transcoded already?
|
||||
if (!task.transcoded_filename_.isEmpty()) {
|
||||
qLog(Debug) << "This file has already been transcoded";
|
||||
@@ -217,7 +209,6 @@ void Organize::ProcessSomeFiles() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
MusicStorage::CopyJob job;
|
||||
job.source_ = task.transcoded_filename_.isEmpty() ? task.song_info_.song_.url().toLocalFile() : task.transcoded_filename_;
|
||||
@@ -289,7 +280,6 @@ void Organize::ProcessSomeFiles() {
|
||||
|
||||
}
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
Song::FileType Organize::CheckTranscode(Song::FileType original_type) const {
|
||||
|
||||
if (original_type == Song::FileType::Stream) return Song::FileType::Unknown;
|
||||
@@ -316,7 +306,6 @@ Song::FileType Organize::CheckTranscode(Song::FileType original_type) const {
|
||||
return Song::FileType::Unknown;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void Organize::SetSongProgress(float progress, bool transcoded) {
|
||||
|
||||
@@ -330,7 +319,6 @@ void Organize::UpdateProgress() {
|
||||
|
||||
const quint64 total = task_count_ * 100;
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
// Update transcoding progress
|
||||
QMap<QString, float> transcode_progress = transcoder_->GetProgress();
|
||||
const QStringList filenames = transcode_progress.keys();
|
||||
@@ -338,7 +326,6 @@ void Organize::UpdateProgress() {
|
||||
if (!tasks_transcoding_.contains(filename)) continue;
|
||||
tasks_transcoding_[filename].transcode_progress_ = transcode_progress[filename];
|
||||
}
|
||||
#endif
|
||||
|
||||
// Count the progress of all tasks that are in the queue.
|
||||
// Files that need transcoding total 50 for the transcode and 50 for the copy, files that only need to be copied total 100.
|
||||
@@ -347,12 +334,11 @@ void Organize::UpdateProgress() {
|
||||
for (const Task &task : std::as_const(tasks_pending_)) {
|
||||
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
||||
}
|
||||
#ifdef HAVE_GSTREAMER
|
||||
|
||||
const QList<Task> tasks_transcoding = tasks_transcoding_.values();
|
||||
for (const Task &task : tasks_transcoding) {
|
||||
progress += qBound(0, static_cast<int>(task.transcode_progress_ * 50), 50);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Add the progress of the track that's currently copying
|
||||
progress += current_copy_progress_;
|
||||
@@ -386,11 +372,9 @@ void Organize::timerEvent(QTimerEvent *e) {
|
||||
|
||||
QObject::timerEvent(e);
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
if (e->timerId() == transcode_progress_timer_.timerId()) {
|
||||
UpdateProgress();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -45,9 +45,7 @@ class QTimerEvent;
|
||||
|
||||
class MusicStorage;
|
||||
class TaskManager;
|
||||
#ifdef HAVE_GSTREAMER
|
||||
class Transcoder;
|
||||
#endif
|
||||
|
||||
class Organize : public QObject {
|
||||
Q_OBJECT
|
||||
@@ -83,9 +81,7 @@ class Organize : public QObject {
|
||||
private:
|
||||
void SetSongProgress(float progress, bool transcoded = false);
|
||||
void UpdateProgress();
|
||||
#ifdef HAVE_GSTREAMER
|
||||
Song::FileType CheckTranscode(Song::FileType original_type) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
struct Task {
|
||||
@@ -103,9 +99,7 @@ class Organize : public QObject {
|
||||
QThread *thread_;
|
||||
QThread *original_thread_;
|
||||
SharedPtr<TaskManager> task_manager_;
|
||||
#ifdef HAVE_GSTREAMER
|
||||
Transcoder *transcoder_;
|
||||
#endif
|
||||
QTimer *process_files_timer_;
|
||||
SharedPtr<MusicStorage> destination_;
|
||||
QList<Song::FileType> supported_filetypes_;
|
||||
|
||||
@@ -72,9 +72,7 @@
|
||||
#include "organizedialog.h"
|
||||
#include "organizeerrordialog.h"
|
||||
#include "ui_organizedialog.h"
|
||||
#ifdef HAVE_GSTREAMER
|
||||
# include "transcoder/transcoder.h"
|
||||
#endif
|
||||
#include "transcoder/transcoder.h"
|
||||
|
||||
using std::make_unique;
|
||||
|
||||
@@ -522,13 +520,11 @@ void OrganizeDialog::UpdatePreviews() {
|
||||
|
||||
if (ok) {
|
||||
QString extension;
|
||||
#ifdef HAVE_GSTREAMER
|
||||
if (storage && storage->GetTranscodeMode() == MusicStorage::TranscodeMode::Transcode_Always) {
|
||||
const Song::FileType format = storage->GetTranscodeFormat();
|
||||
TranscoderPreset preset = Transcoder::PresetForFileType(format);
|
||||
extension = preset.extension_;
|
||||
}
|
||||
#endif
|
||||
new_songs_info_ = ComputeNewSongsFilenames(songs_, format_, extension);
|
||||
if (new_songs_info_.isEmpty()) {
|
||||
ok = false;
|
||||
|
||||
Reference in New Issue
Block a user