Rename initialise to initialize
This commit is contained in:
@@ -115,7 +115,7 @@ static void gst_fastspectrum_init (GstFastSpectrum * spectrum) {
|
|||||||
spectrum->interval = DEFAULT_INTERVAL;
|
spectrum->interval = DEFAULT_INTERVAL;
|
||||||
spectrum->bands = DEFAULT_BANDS;
|
spectrum->bands = DEFAULT_BANDS;
|
||||||
|
|
||||||
spectrum->channel_data_initialised = false;
|
spectrum->channel_data_initialized = false;
|
||||||
|
|
||||||
g_mutex_init (&spectrum->lock);
|
g_mutex_init (&spectrum->lock);
|
||||||
|
|
||||||
@@ -137,14 +137,14 @@ static void gst_fastspectrum_alloc_channel_data (GstFastSpectrum * spectrum) {
|
|||||||
QMutexLocker l(klass->fftw_lock);
|
QMutexLocker l(klass->fftw_lock);
|
||||||
spectrum->plan = fftw_plan_dft_r2c_1d(nfft, spectrum->fft_input, spectrum->fft_output, FFTW_ESTIMATE);
|
spectrum->plan = fftw_plan_dft_r2c_1d(nfft, spectrum->fft_input, spectrum->fft_output, FFTW_ESTIMATE);
|
||||||
}
|
}
|
||||||
spectrum->channel_data_initialised = true;
|
spectrum->channel_data_initialized = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_free_channel_data (GstFastSpectrum * spectrum) {
|
static void gst_fastspectrum_free_channel_data (GstFastSpectrum * spectrum) {
|
||||||
|
|
||||||
GstFastSpectrumClass* klass = reinterpret_cast<GstFastSpectrumClass*>(G_OBJECT_GET_CLASS(spectrum));
|
GstFastSpectrumClass* klass = reinterpret_cast<GstFastSpectrumClass*>(G_OBJECT_GET_CLASS(spectrum));
|
||||||
if (spectrum->channel_data_initialised) {
|
if (spectrum->channel_data_initialized) {
|
||||||
{
|
{
|
||||||
QMutexLocker l(klass->fftw_lock);
|
QMutexLocker l(klass->fftw_lock);
|
||||||
fftw_destroy_plan(spectrum->plan);
|
fftw_destroy_plan(spectrum->plan);
|
||||||
@@ -154,7 +154,7 @@ static void gst_fastspectrum_free_channel_data (GstFastSpectrum * spectrum) {
|
|||||||
delete[] spectrum->input_ring_buffer;
|
delete[] spectrum->input_ring_buffer;
|
||||||
delete[] spectrum->spect_magnitude;
|
delete[] spectrum->spect_magnitude;
|
||||||
|
|
||||||
spectrum->channel_data_initialised = false;
|
spectrum->channel_data_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -422,7 +422,7 @@ static GstFlowReturn gst_fastspectrum_transform_ip (GstBaseTransform *trans, Gst
|
|||||||
/* If we don't have a FFT context yet (or it was reset due to parameter
|
/* If we don't have a FFT context yet (or it was reset due to parameter
|
||||||
* changes) get one and allocate memory for everything
|
* changes) get one and allocate memory for everything
|
||||||
*/
|
*/
|
||||||
if (!spectrum->channel_data_initialised) {
|
if (!spectrum->channel_data_initialized) {
|
||||||
GST_DEBUG_OBJECT (spectrum, "allocating for bands %u", bands);
|
GST_DEBUG_OBJECT (spectrum, "allocating for bands %u", bands);
|
||||||
|
|
||||||
gst_fastspectrum_alloc_channel_data (spectrum);
|
gst_fastspectrum_alloc_channel_data (spectrum);
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ struct GstFastSpectrum {
|
|||||||
GstClockTime message_ts; /* starttime for next message */
|
GstClockTime message_ts; /* starttime for next message */
|
||||||
|
|
||||||
/* <private> */
|
/* <private> */
|
||||||
bool channel_data_initialised;
|
bool channel_data_initialized;
|
||||||
double* input_ring_buffer;
|
double* input_ring_buffer;
|
||||||
double* fft_input;
|
double* fft_input;
|
||||||
fftw_complex* fft_output;
|
fftw_complex* fft_output;
|
||||||
|
|||||||
@@ -34,25 +34,25 @@ class Lazy {
|
|||||||
Lazy() : init_([]() { return new T; }) {}
|
Lazy() : init_([]() { return new T; }) {}
|
||||||
|
|
||||||
T* get() const {
|
T* get() const {
|
||||||
CheckInitialised();
|
CheckInitialized();
|
||||||
return ptr_.get();
|
return ptr_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
typename std::add_lvalue_reference<T>::type operator*() const {
|
typename std::add_lvalue_reference<T>::type operator*() const {
|
||||||
CheckInitialised();
|
CheckInitialized();
|
||||||
return *ptr_;
|
return *ptr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
T* operator->() const { return get(); }
|
T* operator->() const { return get(); }
|
||||||
|
|
||||||
// Returns true if the object is not yet initialised.
|
// Returns true if the object is not yet initialized.
|
||||||
explicit operator bool() const { return ptr_; }
|
explicit operator bool() const { return ptr_; }
|
||||||
|
|
||||||
// Deletes the underlying object and will re-run the initialisation function if the object is requested again.
|
// Deletes the underlying object and will re-run the initialization function if the object is requested again.
|
||||||
void reset() { ptr_.reset(); }
|
void reset() { ptr_.reset(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CheckInitialised() const {
|
void CheckInitialized() const {
|
||||||
if (!ptr_) {
|
if (!ptr_) {
|
||||||
ptr_.reset(init_(), [](T*obj) { obj->deleteLater(); });
|
ptr_.reset(init_(), [](T*obj) { obj->deleteLater(); });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
// INSTRUCTIONS Base2D
|
// INSTRUCTIONS Base2D
|
||||||
// 1. do anything that depends on height() in init(), Base2D will call it before you are shown
|
// 1. do anything that depends on height() in init(), Base2D will call it before you are shown
|
||||||
// 2. otherwise you can use the constructor to initialise things
|
// 2. otherwise you can use the constructor to initialize things
|
||||||
// 3. reimplement analyze(), and paint to canvas(), Base2D will update the widget when you return control to it
|
// 3. reimplement analyze(), and paint to canvas(), Base2D will update the widget when you return control to it
|
||||||
// 4. if you want to manipulate the scope, reimplement transform()
|
// 4. if you want to manipulate the scope, reimplement transform()
|
||||||
// 5. for convenience <vector> <qpixmap.h> <qwdiget.h> are pre-included
|
// 5. for convenience <vector> <qpixmap.h> <qwdiget.h> are pre-included
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ void AnalyzerContainer::ChangeAnalyzer(int id) {
|
|||||||
QObject *instance = analyzer_types_[id]->newInstance(Q_ARG(QWidget*, this));
|
QObject *instance = analyzer_types_[id]->newInstance(Q_ARG(QWidget*, this));
|
||||||
|
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
qLog(Warning) << "Couldn't initialise a new" << analyzer_types_[id]->className();
|
qLog(Warning) << "Couldn't initialize a new" << analyzer_types_[id]->className();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class RainbowAnalyzer : public Analyzer::Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// "constants" that get initialised in the constructor
|
// "constants" that get initialized in the constructor
|
||||||
float band_scale_[kRainbowBands];
|
float band_scale_[kRainbowBands];
|
||||||
QPen colors_[kRainbowBands];
|
QPen colors_[kRainbowBands];
|
||||||
|
|
||||||
|
|||||||
@@ -817,7 +817,7 @@ CollectionModel::QueryResult CollectionModel::RunQuery(CollectionItem *parent) {
|
|||||||
int child_level = parent == root_ ? 0 : parent->container_level + 1;
|
int child_level = parent == root_ ? 0 : parent->container_level + 1;
|
||||||
GroupBy child_type = child_level >= 3 ? GroupBy_None : group_by_[child_level];
|
GroupBy child_type = child_level >= 3 ? GroupBy_None : group_by_[child_level];
|
||||||
|
|
||||||
// Initialise the query. child_type says what type of thing we want (artists, songs, etc.)
|
// Initialize the query. child_type says what type of thing we want (artists, songs, etc.)
|
||||||
CollectionQuery q(query_options_);
|
CollectionQuery q(query_options_);
|
||||||
InitQuery(child_type, &q);
|
InitQuery(child_type, &q);
|
||||||
|
|
||||||
@@ -1133,7 +1133,7 @@ CollectionItem *CollectionModel::InitItem(const GroupBy type, const bool signal,
|
|||||||
|
|
||||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
||||||
|
|
||||||
// Initialise the item depending on what type it's meant to be
|
// Initialize the item depending on what type it's meant to be
|
||||||
CollectionItem *item = new CollectionItem(item_type, parent);
|
CollectionItem *item = new CollectionItem(item_type, parent);
|
||||||
item->compilation_artist_node_ = nullptr;
|
item->compilation_artist_node_ = nullptr;
|
||||||
item->container_level = container_level;
|
item->container_level = container_level;
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ QSqlDatabase Database::Connect() {
|
|||||||
UpdateMainSchema(&db);
|
UpdateMainSchema(&db);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We might have to initialise the schema in some attached databases now, if they were deleted and don't match up with the main schema version.
|
// We might have to initialize the schema in some attached databases now, if they were deleted and don't match up with the main schema version.
|
||||||
for (const QString &key : attached_databases_.keys()) {
|
for (const QString &key : attached_databases_.keys()) {
|
||||||
if (attached_databases_[key].is_temporary_ && attached_databases_[key].schema_.isEmpty())
|
if (attached_databases_[key].is_temporary_ && attached_databases_[key].schema_.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSDBase *osd
|
|||||||
connect(app, SIGNAL(ErrorAdded(QString)), SLOT(ShowErrorDialog(QString)));
|
connect(app, SIGNAL(ErrorAdded(QString)), SLOT(ShowErrorDialog(QString)));
|
||||||
connect(app, SIGNAL(SettingsDialogRequested(SettingsDialog::Page)), SLOT(OpenSettingsDialogAtPage(SettingsDialog::Page)));
|
connect(app, SIGNAL(SettingsDialogRequested(SettingsDialog::Page)), SLOT(OpenSettingsDialogAtPage(SettingsDialog::Page)));
|
||||||
|
|
||||||
// Initialise the UI
|
// Initialize the UI
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
album_cover_choice_controller_->Init(app);
|
album_cover_choice_controller_->Init(app);
|
||||||
@@ -330,7 +330,7 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSDBase *osd
|
|||||||
context_view_->Init(app_, collection_view_->view(), album_cover_choice_controller_);
|
context_view_->Init(app_, collection_view_->view(), album_cover_choice_controller_);
|
||||||
ui_->widget_playing->Init(app_, album_cover_choice_controller_);
|
ui_->widget_playing->Init(app_, album_cover_choice_controller_);
|
||||||
|
|
||||||
// Initialise the search widget
|
// Initialize the search widget
|
||||||
StyleHelper::setBaseColor(palette().color(QPalette::Highlight).darker());
|
StyleHelper::setBaseColor(palette().color(QPalette::Highlight).darker());
|
||||||
|
|
||||||
// Add tabs to the fancy tab widget
|
// Add tabs to the fancy tab widget
|
||||||
@@ -363,8 +363,8 @@ MainWindow::MainWindow(Application *app, SystemTrayIcon *tray_icon, OSDBase *osd
|
|||||||
track_slider_timer_->setInterval(kTrackSliderUpdateTimeMs);
|
track_slider_timer_->setInterval(kTrackSliderUpdateTimeMs);
|
||||||
connect(track_slider_timer_, SIGNAL(timeout()), SLOT(UpdateTrackSliderPosition()));
|
connect(track_slider_timer_, SIGNAL(timeout()), SLOT(UpdateTrackSliderPosition()));
|
||||||
|
|
||||||
// Start initialising the player
|
// Start initializing the player
|
||||||
qLog(Debug) << "Initialising player";
|
qLog(Debug) << "Initializing player";
|
||||||
app_->player()->SetAnalyzer(ui_->analyzer);
|
app_->player()->SetAnalyzer(ui_->analyzer);
|
||||||
app_->player()->SetEqualizer(equalizer_.get());
|
app_->player()->SetEqualizer(equalizer_.get());
|
||||||
app_->player()->Init();
|
app_->player()->Init();
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ void Player::Init() {
|
|||||||
CreateEngine(enginetype);
|
CreateEngine(enginetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!engine_->Init()) { qFatal("Error initialising audio engine"); }
|
if (!engine_->Init()) { qFatal("Error initializing audio engine"); }
|
||||||
|
|
||||||
analyzer_->SetEngine(engine_.get());
|
analyzer_->SetEngine(engine_.get());
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class DeviceLister : public QObject {
|
|||||||
DeviceLister();
|
DeviceLister();
|
||||||
~DeviceLister() override;
|
~DeviceLister() override;
|
||||||
|
|
||||||
// Tries to start the thread and initialise the engine. This object will be moved to the new thread.
|
// Tries to start the thread and initialize the engine. This object will be moved to the new thread.
|
||||||
void Start();
|
void Start();
|
||||||
virtual void ExitAsync();
|
virtual void ExitAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
class DeviceLister;
|
class DeviceLister;
|
||||||
class DeviceManager;
|
class DeviceManager;
|
||||||
|
|
||||||
bool MtpDevice::sInitialisedLibMTP = false;
|
bool MtpDevice::sInitializedLibMTP = false;
|
||||||
|
|
||||||
MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
||||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
|
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
|
||||||
@@ -55,9 +55,9 @@ MtpDevice::MtpDevice(const QUrl &url, DeviceLister *lister, const QString &uniqu
|
|||||||
loader_thread_(nullptr),
|
loader_thread_(nullptr),
|
||||||
closing_(false) {
|
closing_(false) {
|
||||||
|
|
||||||
if (!sInitialisedLibMTP) {
|
if (!sInitializedLibMTP) {
|
||||||
LIBMTP_Init();
|
LIBMTP_Init();
|
||||||
sInitialisedLibMTP = true;
|
sInitializedLibMTP = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class MtpDevice : public ConnectedDevice {
|
|||||||
int GetCapacity(LIBMTP_mtpdevice_struct* device);
|
int GetCapacity(LIBMTP_mtpdevice_struct* device);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool sInitialisedLibMTP;
|
static bool sInitializedLibMTP;
|
||||||
|
|
||||||
MtpLoader *loader_;
|
MtpLoader *loader_;
|
||||||
QThread *loader_thread_;
|
QThread *loader_thread_;
|
||||||
|
|||||||
@@ -35,8 +35,7 @@
|
|||||||
#include "alsadevicefinder.h"
|
#include "alsadevicefinder.h"
|
||||||
|
|
||||||
AlsaDeviceFinder::AlsaDeviceFinder()
|
AlsaDeviceFinder::AlsaDeviceFinder()
|
||||||
: DeviceFinder("alsa", {"alsa","alsasink"}) {
|
: DeviceFinder("alsa", {"alsa","alsasink"}) {}
|
||||||
}
|
|
||||||
|
|
||||||
QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
|||||||
snd_pcm_stream_name(SND_PCM_STREAM_PLAYBACK);
|
snd_pcm_stream_name(SND_PCM_STREAM_PLAYBACK);
|
||||||
|
|
||||||
int card = -1;
|
int card = -1;
|
||||||
snd_ctl_card_info_t* cardinfo;
|
snd_ctl_card_info_t *cardinfo = nullptr;
|
||||||
snd_ctl_card_info_alloca(&cardinfo);
|
snd_ctl_card_info_alloca(&cardinfo);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
|||||||
char str[32];
|
char str[32];
|
||||||
snprintf(str, sizeof(str) - 1, "hw:%d", card);
|
snprintf(str, sizeof(str) - 1, "hw:%d", card);
|
||||||
|
|
||||||
snd_ctl_t* handle;
|
snd_ctl_t *handle = nullptr;
|
||||||
result = snd_ctl_open(&handle, str, 0);
|
result = snd_ctl_open(&handle, str, 0);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
qLog(Error) << "Unable to open soundcard" << card << ":" << snd_strerror(result);
|
qLog(Error) << "Unable to open soundcard" << card << ":" << snd_strerror(result);
|
||||||
@@ -75,7 +74,7 @@ QList<DeviceFinder::Device> AlsaDeviceFinder::ListDevices() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int dev = -1;
|
int dev = -1;
|
||||||
snd_pcm_info_t* pcminfo;
|
snd_pcm_info_t *pcminfo = nullptr;
|
||||||
snd_pcm_info_alloca(&pcminfo);
|
snd_pcm_info_alloca(&pcminfo);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class AlsaDeviceFinder : public DeviceFinder {
|
|||||||
public:
|
public:
|
||||||
explicit AlsaDeviceFinder();
|
explicit AlsaDeviceFinder();
|
||||||
|
|
||||||
bool Initialise() override { return true; }
|
bool Initialize() override { return true; }
|
||||||
QList<Device> ListDevices() override;
|
QList<Device> ListDevices() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class DeviceFinder {
|
|||||||
void add_output(const QString output) { outputs_.append(output); }
|
void add_output(const QString output) { outputs_.append(output); }
|
||||||
|
|
||||||
// Does any necessary setup, returning false if this DeviceFinder cannot be used.
|
// Does any necessary setup, returning false if this DeviceFinder cannot be used.
|
||||||
virtual bool Initialise() = 0;
|
virtual bool Initialize() = 0;
|
||||||
|
|
||||||
// Returns a list of available devices.
|
// Returns a list of available devices.
|
||||||
virtual QList<Device> ListDevices() = 0;
|
virtual QList<Device> ListDevices() = 0;
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ void DeviceFinders::Init() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (DeviceFinder *finder : device_finders) {
|
for (DeviceFinder *finder : device_finders) {
|
||||||
if (!finder->Initialise()) {
|
if (!finder->Initialize()) {
|
||||||
qLog(Warning) << "Failed to initialise DeviceFinder for" << finder->name();
|
qLog(Warning) << "Failed to initialize DeviceFinder for" << finder->name();
|
||||||
delete finder;
|
delete finder;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class DirectSoundDeviceFinder : public DeviceFinder {
|
|||||||
public:
|
public:
|
||||||
explicit DirectSoundDeviceFinder();
|
explicit DirectSoundDeviceFinder();
|
||||||
|
|
||||||
virtual bool Initialise() { return true; }
|
virtual bool Initialize() { return true; }
|
||||||
virtual QList<Device> ListDevices();
|
virtual QList<Device> ListDevices();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ GstEngine::GstEngine(TaskManager *task_manager)
|
|||||||
|
|
||||||
GstEngine::~GstEngine() {
|
GstEngine::~GstEngine() {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialized();
|
||||||
current_pipeline_.reset();
|
current_pipeline_.reset();
|
||||||
|
|
||||||
if (latest_buffer_) {
|
if (latest_buffer_) {
|
||||||
@@ -136,7 +136,7 @@ Engine::State GstEngine::state() const {
|
|||||||
|
|
||||||
void GstEngine::StartPreloading(const QUrl &stream_url, const QUrl &original_url, const bool force_stop_at_end, const qint64 beginning_nanosec, const qint64 end_nanosec) {
|
void GstEngine::StartPreloading(const QUrl &stream_url, const QUrl &original_url, const bool force_stop_at_end, const qint64 beginning_nanosec, const qint64 end_nanosec) {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialized();
|
||||||
|
|
||||||
QByteArray gst_url = FixupUrl(stream_url);
|
QByteArray gst_url = FixupUrl(stream_url);
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ void GstEngine::StartPreloading(const QUrl &stream_url, const QUrl &original_url
|
|||||||
|
|
||||||
bool GstEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec) {
|
bool GstEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, const bool force_stop_at_end, const quint64 beginning_nanosec, const qint64 end_nanosec) {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialized();
|
||||||
|
|
||||||
Engine::Base::Load(stream_url, original_url, change, force_stop_at_end, beginning_nanosec, end_nanosec);
|
Engine::Base::Load(stream_url, original_url, change, force_stop_at_end, beginning_nanosec, end_nanosec);
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ bool GstEngine::Load(const QUrl &stream_url, const QUrl &original_url, Engine::T
|
|||||||
|
|
||||||
bool GstEngine::Play(const quint64 offset_nanosec) {
|
bool GstEngine::Play(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialized();
|
||||||
|
|
||||||
if (!current_pipeline_ || current_pipeline_->is_buffering()) return false;
|
if (!current_pipeline_ || current_pipeline_->is_buffering()) return false;
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ const Engine::Scope &GstEngine::scope(const int chunk_length) {
|
|||||||
|
|
||||||
EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
|
EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
|
||||||
|
|
||||||
const_cast<GstEngine*>(this)->EnsureInitialised();
|
const_cast<GstEngine*>(this)->EnsureInitialized();
|
||||||
|
|
||||||
EngineBase::OutputDetailsList ret;
|
EngineBase::OutputDetailsList ret;
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ EngineBase::OutputDetailsList GstEngine::GetOutputsList() const {
|
|||||||
|
|
||||||
bool GstEngine::ValidOutput(const QString &output) {
|
bool GstEngine::ValidOutput(const QString &output) {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialized();
|
||||||
|
|
||||||
PluginDetailsList plugins = GetPluginList("Sink/Audio");
|
PluginDetailsList plugins = GetPluginList("Sink/Audio");
|
||||||
for (const PluginDetails &plugin : plugins) {
|
for (const PluginDetails &plugin : plugins) {
|
||||||
@@ -645,7 +645,7 @@ void GstEngine::BufferingFinished() {
|
|||||||
|
|
||||||
GstEngine::PluginDetailsList GstEngine::GetPluginList(const QString &classname) const {
|
GstEngine::PluginDetailsList GstEngine::GetPluginList(const QString &classname) const {
|
||||||
|
|
||||||
const_cast<GstEngine*>(this)->EnsureInitialised();
|
const_cast<GstEngine*>(this)->EnsureInitialized();
|
||||||
|
|
||||||
PluginDetailsList ret;
|
PluginDetailsList ret;
|
||||||
|
|
||||||
@@ -672,7 +672,7 @@ GstEngine::PluginDetailsList GstEngine::GetPluginList(const QString &classname)
|
|||||||
|
|
||||||
QByteArray GstEngine::FixupUrl(const QUrl &url) {
|
QByteArray GstEngine::FixupUrl(const QUrl &url) {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialized();
|
||||||
|
|
||||||
QByteArray uri;
|
QByteArray uri;
|
||||||
|
|
||||||
@@ -749,7 +749,7 @@ void GstEngine::StopTimers() {
|
|||||||
|
|
||||||
std::shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline() {
|
std::shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline() {
|
||||||
|
|
||||||
EnsureInitialised();
|
EnsureInitialized();
|
||||||
|
|
||||||
std::shared_ptr<GstEnginePipeline> ret(new GstEnginePipeline(this));
|
std::shared_ptr<GstEnginePipeline> ret(new GstEnginePipeline(this));
|
||||||
ret->set_output_device(output_, device_);
|
ret->set_output_device(output_, device_);
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class GstEngine : public Engine::Base, public GstBufferConsumer {
|
|||||||
bool ALSADeviceSupport(const QString &output) override;
|
bool ALSADeviceSupport(const QString &output) override;
|
||||||
|
|
||||||
void SetStartup(GstStartup *gst_startup) { gst_startup_ = gst_startup; }
|
void SetStartup(GstStartup *gst_startup) { gst_startup_ = gst_startup; }
|
||||||
void EnsureInitialised() { gst_startup_->EnsureInitialised(); }
|
void EnsureInitialized() { gst_startup_->EnsureInitialized(); }
|
||||||
|
|
||||||
GstElement *CreateElement(const QString &factoryName, GstElement *bin = nullptr, const bool showerror = true);
|
GstElement *CreateElement(const QString &factoryName, GstElement *bin = nullptr, const bool showerror = true);
|
||||||
void ConsumeBuffer(GstBuffer *buffer, const int pipeline_id, const QString &format) override;
|
void ConsumeBuffer(GstBuffer *buffer, const int pipeline_id, const QString &format) override;
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ GstEnginePipeline::GstEnginePipeline(GstEngine *engine)
|
|||||||
next_end_offset_nanosec_(-1),
|
next_end_offset_nanosec_(-1),
|
||||||
ignore_next_seek_(false),
|
ignore_next_seek_(false),
|
||||||
ignore_tags_(false),
|
ignore_tags_(false),
|
||||||
pipeline_is_initialised_(false),
|
pipeline_is_initialized_(false),
|
||||||
pipeline_is_connected_(false),
|
pipeline_is_connected_(false),
|
||||||
pending_seek_nanosec_(-1),
|
pending_seek_nanosec_(-1),
|
||||||
last_known_position_ns_(0),
|
last_known_position_ns_(0),
|
||||||
@@ -480,7 +480,7 @@ GstPadProbeReturn GstEnginePipeline::EventHandoffCallback(GstPad*, GstPadProbeIn
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::SourceSetupCallback(GstPlayBin *bin, GParamSpec *, gpointer self) {
|
void GstEnginePipeline::SourceSetupCallback(GstPlayBin *bin, GParamSpec*, gpointer self) {
|
||||||
|
|
||||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||||
|
|
||||||
@@ -537,7 +537,7 @@ void GstEnginePipeline::NewPadCallback(GstElement*, GstPad *pad, gpointer self)
|
|||||||
gst_pad_add_probe(pad, static_cast<GstPadProbeType>(GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_FLUSH), PlaybinProbe, instance, nullptr);
|
gst_pad_add_probe(pad, static_cast<GstPadProbeType>(GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_FLUSH), PlaybinProbe, instance, nullptr);
|
||||||
|
|
||||||
instance->pipeline_is_connected_ = true;
|
instance->pipeline_is_connected_ = true;
|
||||||
if (instance->pending_seek_nanosec_ != -1 && instance->pipeline_is_initialised_) {
|
if (instance->pending_seek_nanosec_ != -1 && instance->pipeline_is_initialized_) {
|
||||||
QMetaObject::invokeMethod(instance, "Seek", Qt::QueuedConnection, Q_ARG(qint64, instance->pending_seek_nanosec_));
|
QMetaObject::invokeMethod(instance, "Seek", Qt::QueuedConnection, Q_ARG(qint64, instance->pending_seek_nanosec_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -804,7 +804,7 @@ GstBusSyncReply GstEnginePipeline::BusCallbackSync(GstBus*, GstMessage *msg, gpo
|
|||||||
void GstEnginePipeline::StreamStatusMessageReceived(GstMessage *msg) {
|
void GstEnginePipeline::StreamStatusMessageReceived(GstMessage *msg) {
|
||||||
|
|
||||||
GstStreamStatusType type;
|
GstStreamStatusType type;
|
||||||
GstElement *owner;
|
GstElement *owner = nullptr;
|
||||||
gst_message_parse_stream_status(msg, &type, &owner);
|
gst_message_parse_stream_status(msg, &type, &owner);
|
||||||
|
|
||||||
if (type == GST_STREAM_STATUS_TYPE_CREATE) {
|
if (type == GST_STREAM_STATUS_TYPE_CREATE) {
|
||||||
@@ -835,9 +835,9 @@ void GstEnginePipeline::StreamStartMessageReceived() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GstEnginePipeline::TaskEnterCallback(GstTask *, GThread *, gpointer) {
|
void GstEnginePipeline::TaskEnterCallback(GstTask*, GThread*, gpointer) {
|
||||||
|
|
||||||
// Bump the priority of the thread only on OS X
|
// Bump the priority of the thread only on macOS
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
sched_param param;
|
sched_param param;
|
||||||
@@ -875,7 +875,7 @@ void GstEnginePipeline::ErrorMessageReceived(GstMessage *msg) {
|
|||||||
g_error_free(error);
|
g_error_free(error);
|
||||||
g_free(debugs);
|
g_free(debugs);
|
||||||
|
|
||||||
if (state() == GST_STATE_PLAYING && pipeline_is_initialised_ && next_uri_set_ && (domain == GST_RESOURCE_ERROR || domain == GST_STREAM_ERROR)) {
|
if (state() == GST_STATE_PLAYING && pipeline_is_initialized_ && next_uri_set_ && (domain == GST_RESOURCE_ERROR || domain == GST_STREAM_ERROR)) {
|
||||||
// A track is still playing and the next uri is not playable. We ignore the error here so it can play until the end.
|
// A track is still playing and the next uri is not playable. We ignore the error here so it can play until the end.
|
||||||
// But there is no message send to the bus when the current track finishes, we have to add an EOS ourself.
|
// But there is no message send to the bus when the current track finishes, we have to add an EOS ourself.
|
||||||
qLog(Info) << "Ignoring error when loading next track";
|
qLog(Info) << "Ignoring error when loading next track";
|
||||||
@@ -990,15 +990,15 @@ void GstEnginePipeline::StateChangedMessageReceived(GstMessage *msg) {
|
|||||||
GstState old_state, new_state, pending;
|
GstState old_state, new_state, pending;
|
||||||
gst_message_parse_state_changed(msg, &old_state, &new_state, &pending);
|
gst_message_parse_state_changed(msg, &old_state, &new_state, &pending);
|
||||||
|
|
||||||
if (!pipeline_is_initialised_ && (new_state == GST_STATE_PAUSED || new_state == GST_STATE_PLAYING)) {
|
if (!pipeline_is_initialized_ && (new_state == GST_STATE_PAUSED || new_state == GST_STATE_PLAYING)) {
|
||||||
pipeline_is_initialised_ = true;
|
pipeline_is_initialized_ = true;
|
||||||
if (pending_seek_nanosec_ != -1 && pipeline_is_connected_) {
|
if (pending_seek_nanosec_ != -1 && pipeline_is_connected_) {
|
||||||
QMetaObject::invokeMethod(this, "Seek", Qt::QueuedConnection, Q_ARG(qint64, pending_seek_nanosec_));
|
QMetaObject::invokeMethod(this, "Seek", Qt::QueuedConnection, Q_ARG(qint64, pending_seek_nanosec_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pipeline_is_initialised_ && new_state != GST_STATE_PAUSED && new_state != GST_STATE_PLAYING) {
|
if (pipeline_is_initialized_ && new_state != GST_STATE_PAUSED && new_state != GST_STATE_PLAYING) {
|
||||||
pipeline_is_initialised_ = false;
|
pipeline_is_initialized_ = false;
|
||||||
|
|
||||||
if (next_uri_set_ && new_state == GST_STATE_READY) {
|
if (next_uri_set_ && new_state == GST_STATE_READY) {
|
||||||
// Revert uri and go back to PLAY state again
|
// Revert uri and go back to PLAY state again
|
||||||
@@ -1050,7 +1050,7 @@ void GstEnginePipeline::BufferingMessageReceived(GstMessage *msg) {
|
|||||||
|
|
||||||
qint64 GstEnginePipeline::position() const {
|
qint64 GstEnginePipeline::position() const {
|
||||||
|
|
||||||
if (pipeline_is_initialised_)
|
if (pipeline_is_initialized_)
|
||||||
gst_element_query_position(pipeline_, GST_FORMAT_TIME, &last_known_position_ns_);
|
gst_element_query_position(pipeline_, GST_FORMAT_TIME, &last_known_position_ns_);
|
||||||
|
|
||||||
return last_known_position_ns_;
|
return last_known_position_ns_;
|
||||||
@@ -1087,7 +1087,7 @@ bool GstEnginePipeline::Seek(const qint64 nanosec) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pipeline_is_connected_ || !pipeline_is_initialised_) {
|
if (!pipeline_is_connected_ || !pipeline_is_initialized_) {
|
||||||
pending_seek_nanosec_ = nanosec;
|
pending_seek_nanosec_ = nanosec;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ class GstEnginePipeline : public QObject {
|
|||||||
|
|
||||||
// Seeking while the pipeline is in the READY state doesn't work, so we have to wait until it goes to PAUSED or PLAYING.
|
// Seeking while the pipeline is in the READY state doesn't work, so we have to wait until it goes to PAUSED or PLAYING.
|
||||||
// Also we have to wait for the playbin to be connected.
|
// Also we have to wait for the playbin to be connected.
|
||||||
bool pipeline_is_initialised_;
|
bool pipeline_is_initialized_;
|
||||||
bool pipeline_is_connected_;
|
bool pipeline_is_connected_;
|
||||||
qint64 pending_seek_nanosec_;
|
qint64 pending_seek_nanosec_;
|
||||||
|
|
||||||
|
|||||||
@@ -41,14 +41,12 @@
|
|||||||
#include "gststartup.h"
|
#include "gststartup.h"
|
||||||
|
|
||||||
GstStartup::GstStartup(QObject *parent) : QObject(parent) {
|
GstStartup::GstStartup(QObject *parent) : QObject(parent) {
|
||||||
initialising_ = QtConcurrent::run([=]{ InitialiseGStreamer(); });
|
initializing_ = QtConcurrent::run([=]{ InitializeGStreamer(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
GstStartup::~GstStartup() {
|
GstStartup::~GstStartup() {}
|
||||||
//gst_deinit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GstStartup::InitialiseGStreamer() {
|
void GstStartup::InitializeGStreamer() {
|
||||||
|
|
||||||
SetEnvironment();
|
SetEnvironment();
|
||||||
|
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ class GstStartup : public QObject {
|
|||||||
explicit GstStartup(QObject *parent = nullptr);
|
explicit GstStartup(QObject *parent = nullptr);
|
||||||
~GstStartup() override;
|
~GstStartup() override;
|
||||||
|
|
||||||
void EnsureInitialised() { initialising_.waitForFinished(); }
|
void EnsureInitialized() { initializing_.waitForFinished(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitialiseGStreamer();
|
void InitializeGStreamer();
|
||||||
void SetEnvironment();
|
void SetEnvironment();
|
||||||
QFuture<void> initialising_;
|
QFuture<void> initializing_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class MacOsDeviceFinder : public DeviceFinder {
|
|||||||
public:
|
public:
|
||||||
explicit MacOsDeviceFinder();
|
explicit MacOsDeviceFinder();
|
||||||
|
|
||||||
virtual bool Initialise() { return true; }
|
virtual bool Initialize() { return true; }
|
||||||
virtual QList<Device> ListDevices();
|
virtual QList<Device> ListDevices();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class MMDeviceFinder : public DeviceFinder {
|
|||||||
public:
|
public:
|
||||||
explicit MMDeviceFinder();
|
explicit MMDeviceFinder();
|
||||||
|
|
||||||
virtual bool Initialise() { return true; }
|
virtual bool Initialize() { return true; }
|
||||||
virtual QList<Device> ListDevices();
|
virtual QList<Device> ListDevices();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder("pulseaudio", {"pulseaudio", "pulse", "pulsesink"} ), mainloop_(nullptr), context_(nullptr) {
|
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder("pulseaudio", {"pulseaudio", "pulse", "pulsesink"} ), mainloop_(nullptr), context_(nullptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PulseDeviceFinder::Initialise() {
|
bool PulseDeviceFinder::Initialize() {
|
||||||
|
|
||||||
mainloop_ = pa_mainloop_new();
|
mainloop_ = pa_mainloop_new();
|
||||||
if (!mainloop_) {
|
if (!mainloop_) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class PulseDeviceFinder : public DeviceFinder {
|
|||||||
explicit PulseDeviceFinder();
|
explicit PulseDeviceFinder();
|
||||||
~PulseDeviceFinder() override;
|
~PulseDeviceFinder() override;
|
||||||
|
|
||||||
bool Initialise() override;
|
bool Initialize() override;
|
||||||
QList<Device> ListDevices() override;
|
QList<Device> ListDevices() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ bool VLCEngine::Load(const QUrl &stream_url, const QUrl &original_url, const Eng
|
|||||||
Q_UNUSED(beginning_nanosec);
|
Q_UNUSED(beginning_nanosec);
|
||||||
Q_UNUSED(end_nanosec);
|
Q_UNUSED(end_nanosec);
|
||||||
|
|
||||||
if (!Initialised()) return false;
|
if (!Initialized()) return false;
|
||||||
|
|
||||||
// Create the media object
|
// Create the media object
|
||||||
VlcScopedRef<libvlc_media_t> media(libvlc_media_new_location(instance_, stream_url.toEncoded().constData()));
|
VlcScopedRef<libvlc_media_t> media(libvlc_media_new_location(instance_, stream_url.toEncoded().constData()));
|
||||||
@@ -121,7 +121,7 @@ bool VLCEngine::Load(const QUrl &stream_url, const QUrl &original_url, const Eng
|
|||||||
|
|
||||||
bool VLCEngine::Play(const quint64 offset_nanosec) {
|
bool VLCEngine::Play(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
if (!Initialised()) return false;
|
if (!Initialized()) return false;
|
||||||
|
|
||||||
// Set audio output
|
// Set audio output
|
||||||
if (!output_.isEmpty() && output_ != "auto") {
|
if (!output_.isEmpty() && output_ != "auto") {
|
||||||
@@ -147,28 +147,28 @@ void VLCEngine::Stop(const bool stop_after) {
|
|||||||
|
|
||||||
Q_UNUSED(stop_after);
|
Q_UNUSED(stop_after);
|
||||||
|
|
||||||
if (!Initialised()) return;
|
if (!Initialized()) return;
|
||||||
libvlc_media_player_stop(player_);
|
libvlc_media_player_stop(player_);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VLCEngine::Pause() {
|
void VLCEngine::Pause() {
|
||||||
|
|
||||||
if (!Initialised()) return;
|
if (!Initialized()) return;
|
||||||
libvlc_media_player_pause(player_);
|
libvlc_media_player_pause(player_);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VLCEngine::Unpause() {
|
void VLCEngine::Unpause() {
|
||||||
|
|
||||||
if (!Initialised()) return;
|
if (!Initialized()) return;
|
||||||
libvlc_media_player_play(player_);
|
libvlc_media_player_play(player_);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VLCEngine::Seek(const quint64 offset_nanosec) {
|
void VLCEngine::Seek(const quint64 offset_nanosec) {
|
||||||
|
|
||||||
if (!Initialised()) return;
|
if (!Initialized()) return;
|
||||||
|
|
||||||
int offset = (offset_nanosec / kNsecPerMsec);
|
int offset = (offset_nanosec / kNsecPerMsec);
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ void VLCEngine::Seek(const quint64 offset_nanosec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void VLCEngine::SetVolumeSW(const uint percent) {
|
void VLCEngine::SetVolumeSW(const uint percent) {
|
||||||
if (!Initialised()) return;
|
if (!Initialized()) return;
|
||||||
if (!volume_control_ && percent != 100) return;
|
if (!volume_control_ && percent != 100) return;
|
||||||
libvlc_audio_set_volume(player_, percent);
|
libvlc_audio_set_volume(player_, percent);
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ bool VLCEngine::ALSADeviceSupport(const QString &output) {
|
|||||||
|
|
||||||
uint VLCEngine::position() const {
|
uint VLCEngine::position() const {
|
||||||
|
|
||||||
if (!Initialised()) return (0);
|
if (!Initialized()) return (0);
|
||||||
|
|
||||||
bool is_playing = libvlc_media_player_is_playing(player_);
|
bool is_playing = libvlc_media_player_is_playing(player_);
|
||||||
if (!is_playing) return 0;
|
if (!is_playing) return 0;
|
||||||
@@ -260,7 +260,7 @@ uint VLCEngine::position() const {
|
|||||||
|
|
||||||
uint VLCEngine::length() const {
|
uint VLCEngine::length() const {
|
||||||
|
|
||||||
if (!Initialised()) return(0);
|
if (!Initialized()) return(0);
|
||||||
|
|
||||||
bool is_playing = libvlc_media_player_is_playing(player_);
|
bool is_playing = libvlc_media_player_is_playing(player_);
|
||||||
if (!is_playing) return 0;
|
if (!is_playing) return 0;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class VLCEngine : public Engine::Base {
|
|||||||
libvlc_media_player_t *player_;
|
libvlc_media_player_t *player_;
|
||||||
Engine::State state_;
|
Engine::State state_;
|
||||||
|
|
||||||
bool Initialised() const { return (instance_ && player_); }
|
bool Initialized() const { return (instance_ && player_); }
|
||||||
uint position() const;
|
uint position() const;
|
||||||
uint length() const;
|
uint length() const;
|
||||||
bool CanDecode(const QUrl &url);
|
bool CanDecode(const QUrl &url);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
// Do Mac specific startup to get media keys working.
|
// Do Mac specific startup to get media keys working.
|
||||||
// This must go before QApplication initialisation.
|
// This must go before QApplication initialization.
|
||||||
mac::MacMain();
|
mac::MacMain();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
RegisterMetaTypes();
|
RegisterMetaTypes();
|
||||||
|
|
||||||
// Initialise logging. Log levels are set after the commandline options are parsed below.
|
// Initialize logging. Log levels are set after the commandline options are parsed below.
|
||||||
logging::Init();
|
logging::Init();
|
||||||
g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog), nullptr);
|
g_log_set_default_handler(reinterpret_cast<GLogFunc>(&logging::GLog), nullptr);
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void BackendSettingsPage::Load() {
|
|||||||
device_current_ = s.value("device", QVariant());
|
device_current_ = s.value("device", QVariant());
|
||||||
|
|
||||||
ui_->combobox_engine->setCurrentIndex(ui_->combobox_engine->findData(static_cast<int>(enginetype)));
|
ui_->combobox_engine->setCurrentIndex(ui_->combobox_engine->findData(static_cast<int>(enginetype)));
|
||||||
if (EngineInitialised()) Load_Engine(enginetype);
|
if (EngineInitialized()) Load_Engine(enginetype);
|
||||||
|
|
||||||
ui_->checkbox_volume_control->setChecked(s.value("volume_control", true).toBool());
|
ui_->checkbox_volume_control->setChecked(s.value("volume_control", true).toBool());
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ void BackendSettingsPage::Load() {
|
|||||||
ui_->widget_alsa_plugin->hide();
|
ui_->widget_alsa_plugin->hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!EngineInitialised()) return;
|
if (!EngineInitialized()) return;
|
||||||
|
|
||||||
if (engine()->state() == Engine::Empty) {
|
if (engine()->state() == Engine::Empty) {
|
||||||
if (ui_->combobox_engine->count() > 1) ui_->combobox_engine->setEnabled(true);
|
if (ui_->combobox_engine->count() > 1) ui_->combobox_engine->setEnabled(true);
|
||||||
@@ -207,7 +207,7 @@ void BackendSettingsPage::Load() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BackendSettingsPage::EngineInitialised() {
|
bool BackendSettingsPage::EngineInitialized() {
|
||||||
|
|
||||||
if (!engine() || engine()->type() == Engine::None) {
|
if (!engine() || engine()->type() == Engine::None) {
|
||||||
errordialog_.ShowMessage("Engine is not initialized! Please restart.");
|
errordialog_.ShowMessage("Engine is not initialized! Please restart.");
|
||||||
@@ -219,7 +219,7 @@ bool BackendSettingsPage::EngineInitialised() {
|
|||||||
|
|
||||||
void BackendSettingsPage::Load_Engine(const Engine::EngineType enginetype) {
|
void BackendSettingsPage::Load_Engine(const Engine::EngineType enginetype) {
|
||||||
|
|
||||||
if (!EngineInitialised()) return;
|
if (!EngineInitialized()) return;
|
||||||
|
|
||||||
QString output = output_current_;
|
QString output = output_current_;
|
||||||
QVariant device = device_current_;
|
QVariant device = device_current_;
|
||||||
@@ -253,7 +253,7 @@ void BackendSettingsPage::Load_Engine(const Engine::EngineType enginetype) {
|
|||||||
|
|
||||||
void BackendSettingsPage::Load_Output(QString output, QVariant device) {
|
void BackendSettingsPage::Load_Output(QString output, QVariant device) {
|
||||||
|
|
||||||
if (!EngineInitialised()) return;
|
if (!EngineInitialized()) return;
|
||||||
|
|
||||||
if (output.isEmpty()) output = engine()->DefaultOutput();
|
if (output.isEmpty()) output = engine()->DefaultOutput();
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ void BackendSettingsPage::Load_Output(QString output, QVariant device) {
|
|||||||
|
|
||||||
void BackendSettingsPage::Load_Device(const QString &output, const QVariant &device) {
|
void BackendSettingsPage::Load_Device(const QString &output, const QVariant &device) {
|
||||||
|
|
||||||
if (!EngineInitialised()) return;
|
if (!EngineInitialized()) return;
|
||||||
|
|
||||||
int devices = 0;
|
int devices = 0;
|
||||||
DeviceFinder::Device df_device;
|
DeviceFinder::Device df_device;
|
||||||
@@ -385,7 +385,7 @@ void BackendSettingsPage::Load_Device(const QString &output, const QVariant &dev
|
|||||||
|
|
||||||
void BackendSettingsPage::Save() {
|
void BackendSettingsPage::Save() {
|
||||||
|
|
||||||
if (!EngineInitialised()) return;
|
if (!EngineInitialized()) return;
|
||||||
|
|
||||||
QVariant enginetype_v = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex());
|
QVariant enginetype_v = ui_->combobox_engine->itemData(ui_->combobox_engine->currentIndex());
|
||||||
Engine::EngineType enginetype = enginetype_v.value<Engine::EngineType>();
|
Engine::EngineType enginetype = enginetype_v.value<Engine::EngineType>();
|
||||||
@@ -447,7 +447,7 @@ void BackendSettingsPage::Cancel() {
|
|||||||
|
|
||||||
void BackendSettingsPage::EngineChanged(const int index) {
|
void BackendSettingsPage::EngineChanged(const int index) {
|
||||||
|
|
||||||
if (!configloaded_ || !EngineInitialised()) return;
|
if (!configloaded_ || !EngineInitialized()) return;
|
||||||
|
|
||||||
QVariant v = ui_->combobox_engine->itemData(index);
|
QVariant v = ui_->combobox_engine->itemData(index);
|
||||||
Engine::EngineType enginetype = v.value<Engine::EngineType>();
|
Engine::EngineType enginetype = v.value<Engine::EngineType>();
|
||||||
@@ -467,7 +467,7 @@ void BackendSettingsPage::EngineChanged(const int index) {
|
|||||||
|
|
||||||
void BackendSettingsPage::OutputChanged(const int index) {
|
void BackendSettingsPage::OutputChanged(const int index) {
|
||||||
|
|
||||||
if (!configloaded_ || !EngineInitialised()) return;
|
if (!configloaded_ || !EngineInitialized()) return;
|
||||||
|
|
||||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(index).value<EngineBase::OutputDetails>();
|
||||||
Load_Device(output.name, QVariant());
|
Load_Device(output.name, QVariant());
|
||||||
@@ -476,7 +476,7 @@ void BackendSettingsPage::OutputChanged(const int index) {
|
|||||||
|
|
||||||
void BackendSettingsPage::DeviceSelectionChanged(int index) {
|
void BackendSettingsPage::DeviceSelectionChanged(int index) {
|
||||||
|
|
||||||
if (!configloaded_ || !EngineInitialised()) return;
|
if (!configloaded_ || !EngineInitialized()) return;
|
||||||
|
|
||||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||||
QVariant device = ui_->combobox_device->itemData(index).value<QVariant>();
|
QVariant device = ui_->combobox_device->itemData(index).value<QVariant>();
|
||||||
@@ -499,7 +499,7 @@ void BackendSettingsPage::DeviceSelectionChanged(int index) {
|
|||||||
|
|
||||||
void BackendSettingsPage::DeviceStringChanged() {
|
void BackendSettingsPage::DeviceStringChanged() {
|
||||||
|
|
||||||
if (!configloaded_ || !EngineInitialised()) return;
|
if (!configloaded_ || !EngineInitialized()) return;
|
||||||
|
|
||||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||||
bool found(false);
|
bool found(false);
|
||||||
@@ -588,7 +588,7 @@ void BackendSettingsPage::radiobutton_alsa_hw_clicked(const bool checked) {
|
|||||||
|
|
||||||
#ifdef HAVE_ALSA
|
#ifdef HAVE_ALSA
|
||||||
|
|
||||||
if (!configloaded_ || !EngineInitialised()) return;
|
if (!configloaded_ || !EngineInitialized()) return;
|
||||||
|
|
||||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||||
if (!engine()->ALSADeviceSupport(output.name)) return;
|
if (!engine()->ALSADeviceSupport(output.name)) return;
|
||||||
@@ -619,7 +619,7 @@ void BackendSettingsPage::radiobutton_alsa_plughw_clicked(const bool checked) {
|
|||||||
|
|
||||||
#ifdef HAVE_ALSA
|
#ifdef HAVE_ALSA
|
||||||
|
|
||||||
if (!configloaded_ || !EngineInitialised()) return;
|
if (!configloaded_ || !EngineInitialized()) return;
|
||||||
|
|
||||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||||
if (!engine()->ALSADeviceSupport(output.name)) return;
|
if (!engine()->ALSADeviceSupport(output.name)) return;
|
||||||
@@ -646,7 +646,7 @@ void BackendSettingsPage::radiobutton_alsa_plughw_clicked(const bool checked) {
|
|||||||
|
|
||||||
void BackendSettingsPage::FadingOptionsChanged() {
|
void BackendSettingsPage::FadingOptionsChanged() {
|
||||||
|
|
||||||
if (!configloaded_ || !EngineInitialised()) return;
|
if (!configloaded_ || !EngineInitialized()) return;
|
||||||
|
|
||||||
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
EngineBase::OutputDetails output = ui_->combobox_output->itemData(ui_->combobox_output->currentIndex()).value<EngineBase::OutputDetails>();
|
||||||
if (engine()->type() == Engine::GStreamer && !(engine()->ALSADeviceSupport(output.name) && !ui_->lineedit_device->text().isEmpty()) && ui_->checkbox_volume_control->isChecked()) {
|
if (engine()->type() == Engine::GStreamer && !(engine()->ALSADeviceSupport(output.name) && !ui_->lineedit_device->text().isEmpty()) && ui_->checkbox_volume_control->isChecked()) {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ private:
|
|||||||
|
|
||||||
Ui_BackendSettingsPage *ui_;
|
Ui_BackendSettingsPage *ui_;
|
||||||
|
|
||||||
bool EngineInitialised();
|
bool EngineInitialized();
|
||||||
|
|
||||||
void EngineChanged(Engine::EngineType enginetype);
|
void EngineChanged(Engine::EngineType enginetype);
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ const QStringList CollectionSettingsPage::cacheUnitNames = { "KB", "MB", "GB", "
|
|||||||
CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog)
|
CollectionSettingsPage::CollectionSettingsPage(SettingsDialog *dialog)
|
||||||
: SettingsPage(dialog),
|
: SettingsPage(dialog),
|
||||||
ui_(new Ui_CollectionSettingsPage),
|
ui_(new Ui_CollectionSettingsPage),
|
||||||
initialised_model_(false)
|
initialized_model_(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
@@ -137,13 +137,13 @@ void CollectionSettingsPage::DiskCacheEnable(const int state) {
|
|||||||
|
|
||||||
void CollectionSettingsPage::Load() {
|
void CollectionSettingsPage::Load() {
|
||||||
|
|
||||||
if (!initialised_model_) {
|
if (!initialized_model_) {
|
||||||
if (ui_->list->selectionModel()) {
|
if (ui_->list->selectionModel()) {
|
||||||
disconnect(ui_->list->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(CurrentRowChanged(QModelIndex)));
|
disconnect(ui_->list->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), this, SLOT(CurrentRowChanged(QModelIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_->list->setModel(dialog()->collection_directory_model());
|
ui_->list->setModel(dialog()->collection_directory_model());
|
||||||
initialised_model_ = true;
|
initialized_model_ = true;
|
||||||
|
|
||||||
connect(ui_->list->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), SLOT(CurrentRowChanged(QModelIndex)));
|
connect(ui_->list->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), SLOT(CurrentRowChanged(QModelIndex)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class CollectionSettingsPage : public SettingsPage {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_CollectionSettingsPage *ui_;
|
Ui_CollectionSettingsPage *ui_;
|
||||||
bool initialised_model_;
|
bool initialized_model_;
|
||||||
|
|
||||||
static const QStringList cacheUnitNames;
|
static const QStringList cacheUnitNames;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const int MoodbarSettingsPage::kMoodbarPreviewHeight = 18;
|
|||||||
MoodbarSettingsPage::MoodbarSettingsPage(SettingsDialog* dialog)
|
MoodbarSettingsPage::MoodbarSettingsPage(SettingsDialog* dialog)
|
||||||
: SettingsPage(dialog),
|
: SettingsPage(dialog),
|
||||||
ui_(new Ui_MoodbarSettingsPage),
|
ui_(new Ui_MoodbarSettingsPage),
|
||||||
initialised_(false)
|
initialized_(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
@@ -96,8 +96,8 @@ void MoodbarSettingsPage::Cancel() {}
|
|||||||
|
|
||||||
void MoodbarSettingsPage::InitMoodbarPreviews() {
|
void MoodbarSettingsPage::InitMoodbarPreviews() {
|
||||||
|
|
||||||
if (initialised_) return;
|
if (initialized_) return;
|
||||||
initialised_ = true;
|
initialized_ = true;
|
||||||
|
|
||||||
const QSize preview_size(kMoodbarPreviewWidth, kMoodbarPreviewHeight);
|
const QSize preview_size(kMoodbarPreviewWidth, kMoodbarPreviewHeight);
|
||||||
ui_->moodbar_style->setIconSize(preview_size);
|
ui_->moodbar_style->setIconSize(preview_size);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class MoodbarSettingsPage : public SettingsPage {
|
|||||||
|
|
||||||
Ui_MoodbarSettingsPage* ui_;
|
Ui_MoodbarSettingsPage* ui_;
|
||||||
|
|
||||||
bool initialised_;
|
bool initialized_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MOODBARSETTINGSPAGE_H
|
#endif // MOODBARSETTINGSPAGE_H
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ const char *GlobalShortcutsSettingsPage::kSettingsGroup = "GlobalShortcuts";
|
|||||||
GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog *dialog)
|
GlobalShortcutsSettingsPage::GlobalShortcutsSettingsPage(SettingsDialog *dialog)
|
||||||
: SettingsPage(dialog),
|
: SettingsPage(dialog),
|
||||||
ui_(new Ui_GlobalShortcutsSettingsPage),
|
ui_(new Ui_GlobalShortcutsSettingsPage),
|
||||||
initialised_(false),
|
initialized_(false),
|
||||||
grabber_(new GlobalShortcutGrabber) {
|
grabber_(new GlobalShortcutGrabber) {
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
@@ -105,8 +105,8 @@ void GlobalShortcutsSettingsPage::Load() {
|
|||||||
|
|
||||||
GlobalShortcuts *manager = dialog()->global_shortcuts_manager();
|
GlobalShortcuts *manager = dialog()->global_shortcuts_manager();
|
||||||
|
|
||||||
if (!initialised_) {
|
if (!initialized_) {
|
||||||
initialised_ = true;
|
initialized_ = true;
|
||||||
|
|
||||||
de_ = Utilities::DesktopEnvironment();
|
de_ = Utilities::DesktopEnvironment();
|
||||||
ui_->widget_warning->hide();
|
ui_->widget_warning->hide();
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class GlobalShortcutsSettingsPage : public SettingsPage {
|
|||||||
private:
|
private:
|
||||||
Ui_GlobalShortcutsSettingsPage *ui_;
|
Ui_GlobalShortcutsSettingsPage *ui_;
|
||||||
|
|
||||||
bool initialised_;
|
bool initialized_;
|
||||||
std::unique_ptr<GlobalShortcutGrabber> grabber_;
|
std::unique_ptr<GlobalShortcutGrabber> grabber_;
|
||||||
|
|
||||||
QMap<QString, Shortcut> shortcuts_;
|
QMap<QString, Shortcut> shortcuts_;
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ Transcoder::Transcoder(QObject *parent, const QString &settings_postfix)
|
|||||||
if (JobFinishedEvent::sEventType == -1)
|
if (JobFinishedEvent::sEventType == -1)
|
||||||
JobFinishedEvent::sEventType = QEvent::registerEventType();
|
JobFinishedEvent::sEventType = QEvent::registerEventType();
|
||||||
|
|
||||||
// Initialise some settings for the lamemp3enc element.
|
// Initialize some settings for the lamemp3enc element.
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup("Transcoder/lamemp3enc" + settings_postfix_);
|
s.beginGroup("Transcoder/lamemp3enc" + settings_postfix_);
|
||||||
|
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ void StretchHeaderView::SetStretchEnabled(const bool enabled) {
|
|||||||
stretch_enabled_ = enabled;
|
stretch_enabled_ = enabled;
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
// Initialise the list of widths from the current state of the widget
|
// Initialize the list of widths from the current state of the widget
|
||||||
column_widths_.resize(count());
|
column_widths_.resize(count());
|
||||||
for (int i = 0; i < count(); ++i) {
|
for (int i = 0; i < count(); ++i) {
|
||||||
column_widths_[i] = ColumnWidthType(sectionSize(i)) / width();
|
column_widths_[i] = ColumnWidthType(sectionSize(i)) / width();
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ class StretchHeaderView : public QHeaderView {
|
|||||||
bool is_stretch_enabled() const { return stretch_enabled_; }
|
bool is_stretch_enabled() const { return stretch_enabled_; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Changes the stretch mode. Enabling stretch mode will initialise the
|
// Changes the stretch mode.
|
||||||
// proportional column widths from the current state of the header.
|
// Enabling stretch mode will initialize the proportional column widths from the current state of the header.
|
||||||
void ToggleStretchEnabled();
|
void ToggleStretchEnabled();
|
||||||
void SetStretchEnabled(const bool enabled);
|
void SetStretchEnabled(const bool enabled);
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class CollectionModelTest : public ::testing::Test {
|
|||||||
bool added_dir_;
|
bool added_dir_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(CollectionModelTest, Initialisation) {
|
TEST_F(CollectionModelTest, Initialization) {
|
||||||
EXPECT_EQ(0, model_->rowCount(QModelIndex()));
|
EXPECT_EQ(0, model_->rowCount(QModelIndex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user