Includes, comments and bugfixes

- Fix includes
- Use common regex (Song::kCoverRemoveDisc) for removing Disc/CD from album
- Remove Disc/CD from album when creating hash
- Make imobiledevice support compile
- Fix setting device on windows
This commit is contained in:
Jonas Kvinge
2018-05-01 00:41:33 +02:00
parent fccbd6790c
commit e337b7933b
518 changed files with 7003 additions and 4693 deletions

View File

@@ -20,20 +20,42 @@
#include "config.h"
#include <QtGlobal>
#include <QWidget>
#include <QDialog>
#include <QAbstractItemModel>
#include <QtAlgorithms>
#include <QDir>
#include <QList>
#include <QMap>
#include <QDirIterator>
#include <QFileDialog>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QStringList>
#include <QIcon>
#include <QDateTime>
#include <QComboBox>
#include <QGroupBox>
#include <QHeaderView>
#include <QKeySequence>
#include <QLabel>
#include <QPlainTextEdit>
#include <QProgressBar>
#include <QPushButton>
#include <QTreeWidget>
#include <QDialogButtonBox>
#include <QSettings>
#include "core/iconloader.h"
#include "core/mainwindow.h"
#include "widgets/fileview.h"
#include "transcodedialog.h"
#include "transcoder.h"
#include "transcoderoptionsdialog.h"
#include "ui_transcodedialog.h"
#include "ui_transcodelogdialog.h"
#include "core/iconloader.h"
#include "core/mainwindow.h"
#include "widgets/fileview.h"
#include <QPushButton>
#include <QFileDialog>
#include <QDirIterator>
#include <QSettings>
#include <QDateTime>
// winspool.h defines this :(
#ifdef AddJob
@@ -226,8 +248,6 @@ void TranscodeDialog::AllJobsComplete() {
void TranscodeDialog::Add() {
//qLog(Debug) << __PRETTY_FUNCTION__;
QStringList filenames = QFileDialog::getOpenFileNames(
this, tr("Add files to transcode"), last_add_dir_,
QString("%1 (%2);;%3").arg(tr("Music"), FileView::kFileFilter, tr(MainWindow::kAllFilesFilterSpec)));

View File

@@ -23,14 +23,20 @@
#include "config.h"
#include <QBasicTimer>
#include <stdbool.h>
#include <QObject>
#include <QWidget>
#include <QDialog>
#include <QFileInfo>
#include <QBasicTimer>
#include <QString>
#include <QStringList>
#include <QPushButton>
#include <QTimerEvent>
class Transcoder;
class Ui_TranscodeDialog;
class Ui_TranscodeLogDialog;
struct TranscoderPreset;
class TranscodeDialog : public QDialog {

View File

@@ -20,20 +20,31 @@
#include "config.h"
#include "transcoder.h"
#include <glib.h>
#include <glib/gtypes.h>
#include <stdlib.h>
#include <memory>
#include <gst/gst.h>
#include <QtGlobal>
#include <QThread>
#include <QCoreApplication>
#include <QByteArray>
#include <QDir>
#include <QFile>
#include <QList>
#include <QMap>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QtAlgorithms>
#include <QSettings>
#include <QThread>
#include <QtDebug>
#include "core/logging.h"
#include "core/signalchecker.h"
#include "core/utilities.h"
#include "transcoder.h"
using std::shared_ptr;
@@ -88,8 +99,7 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co
return CreateElement("ffmux_mp4", bin);
}
// Keep track of all the suitable elements we find and figure out which
// is the best at the end.
// Keep track of all the suitable elements we find and figure out which is the best at the end.
QList<SuitableElement> suitable_elements_;
// The caps we're trying to find
@@ -141,9 +151,7 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co
LogLine(QString("Using '%1' (rank %2)").arg(best.name_).arg(best.rank_));
if (best.name_ == "lamemp3enc") {
// Special case: we need to add xingmux and id3v2mux to the pipeline when
// using lamemp3enc because it doesn't write the VBR or ID3v2 headers
// itself.
// Special case: we need to add xingmux and id3v2mux to the pipeline when using lamemp3enc because it doesn't write the VBR or ID3v2 headers itself.
LogLine("Adding xingmux and id3v2mux to the pipeline");
@@ -278,8 +286,7 @@ void Transcoder::AddJob(const QString &input, const TranscoderPreset &preset, co
job.input = input;
job.preset = preset;
// Use the supplied filename if there was one, otherwise take the file
// extension off the input filename and append the correct one.
// Use the supplied filename if there was one, otherwise take the file extension off the input filename and append the correct one.
if (!output.isEmpty())
job.output = output;
else
@@ -400,8 +407,7 @@ bool Transcoder::StartJob(const Job &job) {
emit LogLine(tr("Starting %1").arg(QDir::toNativeSeparators(job.input)));
// Create the pipeline.
// This should be a scoped_ptr, but scoped_ptr doesn't support custom
// destructors.
// This should be a scoped_ptr, but scoped_ptr doesn't support custom destructors.
state->pipeline_ = gst_pipeline_new("pipeline");
if (!state->pipeline_) return false;
@@ -445,9 +451,8 @@ bool Transcoder::StartJob(const Job &job) {
// Start the pipeline
gst_element_set_state(state->pipeline_, GST_STATE_PLAYING);
// GStreamer now transcodes in another thread, so we can return now and do
// something else. Keep the JobState object around. It'll post an event
// to our event loop when it finishes.
// GStreamer now transcodes in another thread, so we can return now and do something else.
// Keep the JobState object around. It'll post an event to our event loop when it finishes.
current_jobs_ << state;
return true;
@@ -475,16 +480,14 @@ bool Transcoder::event(QEvent *e) {
++it;
}
if (it == current_jobs_.end()) {
// Couldn't find it, maybe GStreamer gave us an event after we'd destroyed
// the pipeline?
// Couldn't find it, maybe GStreamer gave us an event after we'd destroyed the pipeline?
return true;
}
QString input = (*it)->job_.input;
QString output = (*it)->job_.output;
// Remove event handlers from the gstreamer pipeline so they don't get
// called after the pipeline is shutting down
// Remove event handlers from the gstreamer pipeline so they don't get called after the pipeline is shutting down
gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(finished_event->state_->pipeline_)), nullptr, nullptr, nullptr);
// Remove it from the list - this will also destroy the GStreamer pipeline
@@ -513,8 +516,7 @@ void Transcoder::Cancel() {
while (it != current_jobs_.end()) {
shared_ptr<JobState> state(*it);
// Remove event handlers from the gstreamer pipeline so they don't get
// called after the pipeline is shutting down
// Remove event handlers from the gstreamer pipeline so they don't get called after the pipeline is shutting down
gst_bus_set_sync_handler(gst_pipeline_get_bus(GST_PIPELINE(state->pipeline_)), nullptr, nullptr, nullptr);
// Stop the pipeline

View File

@@ -24,13 +24,19 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <glib.h>
#include <glib-object.h>
#include <gst/gst.h>
#include <QObject>
#include <QStringList>
#include <QEvent>
#include <QList>
#include <QMap>
#include <QMetaType>
#include <QSet>
#include <QString>
#include <QEvent>
#include <QVector>
#include "core/song.h"
@@ -85,8 +91,7 @@ signals:
TranscoderPreset preset;
};
// State held by a job and shared across gstreamer callbacks - lives in the
// job's thread.
// State held by a job and shared across gstreamer callbacks - lives in the job's thread.
struct JobState {
JobState(const Job &job, Transcoder *parent)
: job_(job),
@@ -104,8 +109,7 @@ signals:
GstElement *convert_element_;
};
// Event passed from a GStreamer callback to the Transcoder when a job
// finishes.
// Event passed from a GStreamer callback to the Transcoder when a job finishes.
struct JobFinishedEvent : public QEvent {
JobFinishedEvent(JobState *state, bool success);

View File

@@ -20,11 +20,20 @@
#include "config.h"
#include <stdbool.h>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QCheckBox>
#include <QComboBox>
#include <QSlider>
#include <QSettings>
#include "transcoderoptionsinterface.h"
#include "transcoderoptionsaac.h"
#include "ui_transcoderoptionsaac.h"
#include <QSettings>
const char *TranscoderOptionsAAC::kSettingsGroup = "Transcoder/faac";
TranscoderOptionsAAC::TranscoderOptionsAAC(QWidget* parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsAAC) {

View File

@@ -23,6 +23,8 @@
#include "config.h"
#include <QWidget>
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsAAC;

View File

@@ -20,13 +20,21 @@
#include "config.h"
#include <QWidget>
#include <QDialog>
#include <QString>
#include <QStringBuilder>
#include <QBoxLayout>
#include <QLayout>
#include "transcoderoptionsinterface.h"
#include "transcoderoptionsaac.h"
#include "transcoderoptionsdialog.h"
#include "transcoderoptionsflac.h"
#include "transcoderoptionsmp3.h"
#include "transcoderoptionsopus.h"
#include "transcoderoptionsspeex.h"
#include "transcoderoptionsvorbis.h"
#include "transcoderoptionsopus.h"
#include "transcoderoptionswma.h"
#include "ui_transcoderoptionsdialog.h"

View File

@@ -23,11 +23,18 @@
#include "config.h"
#include <QDialog>
#include <stdbool.h>
#include <QDialog>
#include <QWidget>
#include <QObject>
#include <QString>
#include "transcoderoptionsinterface.h"
#include "core/song.h"
class QShowEvent;
class TranscoderOptionsInterface;
class Ui_TranscoderOptionsDialog;
class TranscoderOptionsDialog : public QDialog {

View File

@@ -20,11 +20,17 @@
#include "config.h"
#include <QWidget>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QSlider>
#include <QSettings>
#include "transcoderoptionsinterface.h"
#include "transcoderoptionsflac.h"
#include "ui_transcoderoptionsflac.h"
#include <QSettings>
const char *TranscoderOptionsFlac::kSettingsGroup = "Transcoder/flacenc";
TranscoderOptionsFlac::TranscoderOptionsFlac(QWidget *parent)

View File

@@ -23,6 +23,8 @@
#include "config.h"
#include <QWidget>
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsFlac;

View File

@@ -24,6 +24,7 @@
#include "config.h"
#include <QWidget>
#include <QString>
class TranscoderOptionsInterface : public QWidget {
public:

View File

@@ -20,12 +20,23 @@
#include "config.h"
#include <stdbool.h>
#include <QWidget>
#include <QVariant>
#include <QStringBuilder>
#include <QCheckBox>
#include <QComboBox>
#include <QRadioButton>
#include <QSlider>
#include <QSpinBox>
#include <QSettings>
#include "transcoderoptionsinterface.h"
#include "transcoderoptionsmp3.h"
#include "ui_transcoderoptionsmp3.h"
#include <QSettings>
const char* TranscoderOptionsMP3::kSettingsGroup = "Transcoder/lamemp3enc";
const char *TranscoderOptionsMP3::kSettingsGroup = "Transcoder/lamemp3enc";
TranscoderOptionsMP3::TranscoderOptionsMP3(QWidget *parent)
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsMP3) {

View File

@@ -23,6 +23,10 @@
#include "config.h"
#include <QObject>
#include <QWidget>
#include <QString>
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsMP3;

View File

@@ -20,13 +20,18 @@
#include "config.h"
#include <QWidget>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QSlider>
#include <QSettings>
#include "transcoderoptionsinterface.h"
#include "transcoderoptionsopus.h"
#include "ui_transcoderoptionsopus.h"
#include <QSettings>
// TODO: Add more options than only bitrate as soon as gst doesn't crash
// anymore while using the cbr parmameter (like cbr=false)
// TODO: Add more options than only bitrate as soon as gst doesn't crash anymore while using the cbr parmameter (like cbr=false)
const char* TranscoderOptionsOpus::kSettingsGroup = "Transcoder/opusenc";

View File

@@ -23,6 +23,8 @@
#include "config.h"
#include <QWidget>
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsOpus;

View File

@@ -20,11 +20,22 @@
#include "config.h"
#include <stdbool.h>
#include <QWidget>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QCheckBox>
#include <QComboBox>
#include <QSlider>
#include <QSpinBox>
#include <QSettings>
#include "transcoderoptionsinterface.h"
#include "transcoderoptionsspeex.h"
#include "ui_transcoderoptionsspeex.h"
#include <QSettings>
const char *TranscoderOptionsSpeex::kSettingsGroup = "Transcoder/speexenc";
TranscoderOptionsSpeex::TranscoderOptionsSpeex(QWidget *parent)

View File

@@ -23,6 +23,8 @@
#include "config.h"
#include <QWidget>
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsSpeex;

View File

@@ -20,14 +20,23 @@
#include "config.h"
#include <stdbool.h>
#include <QWidget>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QCheckBox>
#include <QSlider>
#include <QSettings>
#include "transcoderoptionsinterface.h"
#include "transcoderoptionsvorbis.h"
#include "ui_transcoderoptionsvorbis.h"
#include <QSettings>
const char *TranscoderOptionsVorbis::kSettingsGroup = "Transcoder/vorbisenc";
const char* TranscoderOptionsVorbis::kSettingsGroup = "Transcoder/vorbisenc";
TranscoderOptionsVorbis::TranscoderOptionsVorbis(QWidget* parent)
TranscoderOptionsVorbis::TranscoderOptionsVorbis(QWidget *parent)
: TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsVorbis) {
ui_->setupUi(this);
}

View File

@@ -23,6 +23,8 @@
#include "config.h"
#include <QWidget>
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsVorbis;

View File

@@ -20,11 +20,17 @@
#include "config.h"
#include <QWidget>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QSlider>
#include <QSettings>
#include "transcoder/transcoderoptionsinterface.h"
#include "transcoderoptionswma.h"
#include "ui_transcoderoptionswma.h"
#include <QSettings>
const char *TranscoderOptionsWma::kSettingsGroup = "Transcoder/ffenc_wmav2";
TranscoderOptionsWma::TranscoderOptionsWma(QWidget *parent)

View File

@@ -23,6 +23,8 @@
#include "config.h"
#include <QWidget>
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsWma;