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,14 +20,19 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <QFile>
#include <errno.h>
#include <alsa/asoundlib.h>
#include "alsadevicefinder.h"
#include <QList>
#include <QVariant>
#include <QString>
#include <QtDebug>
#include <core/logging.h>
#include "devicefinder.h"
#include "alsadevicefinder.h"
AlsaDeviceFinder::AlsaDeviceFinder()
: DeviceFinder("alsa") {

View File

@@ -22,7 +22,10 @@
#include "config.h"
#include "engine/devicefinder.h"
#include <stdbool.h>
#include <QList>
#include "devicefinder.h"
class AlsaDeviceFinder : public DeviceFinder {
public:

View File

@@ -19,9 +19,9 @@
#include "config.h"
#include "devicefinder.h"
#include <QString>
#include "core/logging.h"
#include "devicefinder.h"
DeviceFinder::DeviceFinder(const QString &name): name_(name) {
}

View File

@@ -23,8 +23,11 @@
#include "config.h"
#include <QStringList>
#include <stdbool.h>
#include <QList>
#include <QVariant>
#include <QString>
// Finds audio output devices
class DeviceFinder {

View File

@@ -26,9 +26,13 @@
#include <dsound.h>
#include <QList>
#include <QVariant>
#include <QString>
#include <QUuid>
#include "directsounddevicefinder.h"
#include "core/logging.h"
DirectSoundDeviceFinder::DirectSoundDeviceFinder()
: DeviceFinder("directsoundsink") {
@@ -45,8 +49,9 @@ BOOL DirectSoundDeviceFinder::EnumerateCallback(LPGUID guid, LPCSTR description,
State *state = reinterpret_cast<State*>(state_voidptr);
Device dev;
dev.description = QString::fromUtf8(description);
if (guid) dev.value = QUuid(*guid).toByteArray();
dev.description = QString::fromLatin1(description);
//if (guid) dev.value = QUuid(*guid).toByteArray();
if (guid) dev.value = QUuid(*guid).toString();
else dev.value = QVariant();
dev.iconname = GuessIconName(dev.description);
state->devices.append(dev);

View File

@@ -25,7 +25,7 @@
#include <rpc.h>
#include "engine/devicefinder.h"
#include "devicefinder.h"
class DirectSoundDeviceFinder : public DeviceFinder {
public:

View File

@@ -1,8 +1,6 @@
#ifndef ENGINE_FWD_H
#define ENGINE_FWD_H
#include <QString>
/// Used by eg engineobserver.h, and thus we reduce header dependencies on enginebase.h
namespace Engine {

View File

@@ -23,13 +23,14 @@
#include "config.h"
#include <cmath>
#include <QtGlobal>
#include <QUrl>
#include <QSettings>
#include "enginebase.h"
#include "enginedevice.h"
#include "core/timeconstants.h"
#include "core/logging.h"
#include "engine_fwd.h"
#include "enginebase.h"
#include "settings/playbacksettingspage.h"
Engine::Base::Base()

View File

@@ -25,22 +25,25 @@
#include "config.h"
#include <stdint.h>
#include <sys/types.h>
#include <cstdint>
#include <vector>
#include <stdbool.h>
#include <QList>
#include <QtGlobal>
#include <QObject>
#include <QList>
#include <QMetaType>
#include <QString>
#include <QUrl>
#include <QVariant>
#include <QByteArray>
#include "enginetype.h"
#include "engine_fwd.h"
#include "enginetype.h"
namespace Engine {
struct SimpleMetaBundle;
typedef std::vector<int16_t> Scope;
class Base : public QObject {
@@ -72,10 +75,8 @@ class Base : public QObject {
end_nanosec_ = end_nanosec;
}
// Plays a media stream represented with the URL 'u' from the given 'beginning'
// to the given 'end' (usually from 0 to a song's length). Both markers
// should be passed in nanoseconds. 'end' can be negative, indicating that the
// real length of 'u' stream is unknown.
// Plays a media stream represented with the URL 'u' from the given 'beginning' to the given 'end' (usually from 0 to a song's length).
// Both markers should be passed in nanoseconds. 'end' can be negative, indicating that the real length of 'u' stream is unknown.
bool Play(const QUrl &u, TrackChangeFlags c, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec);
void SetVolume(uint value);
@@ -90,6 +91,9 @@ class Base : public QObject {
bool crossfade_same_album() const { return crossfade_same_album_; }
static const int kScopeSize = 1024;
virtual void SetVolumeSW(uint percent) = 0;
static uint MakeVolumeLogarithmic(uint volume);
struct OutputDetails {
QString name;
@@ -131,8 +135,6 @@ signals:
protected:
Base();
virtual void SetVolumeSW(uint percent) = 0;
static uint MakeVolumeLogarithmic(uint volume);
void EmitAboutToEnd();
protected:
@@ -164,8 +166,6 @@ signals:
Q_DISABLE_COPY(Base);
};
//Q_DECLARE_METATYPE(EngineBase::PluginDetails);
Q_DECLARE_METATYPE(EngineBase::OutputDetails);
struct SimpleMetaBundle {
QString title;
@@ -183,4 +183,6 @@ struct SimpleMetaBundle {
} // namespace
Q_DECLARE_METATYPE(EngineBase::OutputDetails);
#endif

View File

@@ -20,50 +20,41 @@
#include "config.h"
#include "enginedevice.h"
#include "devicefinder.h"
#include <QtGlobal>
#include <QtAlgorithms>
#include <QObject>
#include <QList>
#include <QtDebug>
#include "core/logging.h"
#include <QMutex>
#include <QList>
#include "devicefinder.h"
#include "enginedevice.h"
#ifdef Q_OS_LINUX
#include "engine/alsadevicefinder.h"
# include "alsadevicefinder.h"
#endif
#ifdef HAVE_LIBPULSE
#include "engine/pulsedevicefinder.h"
# include "pulsedevicefinder.h"
#endif
#ifdef Q_OS_DARWIN
#include "engine/osxdevicefinder.h"
# include "osxdevicefinder.h"
#endif
#ifdef Q_OS_WIN32
#include "engine/directsounddevicefinder.h"
# include "directsounddevicefinder.h"
#endif
#include "settings/backendsettingspage.h"
EngineDevice::EngineDevice(QObject *parent) : QObject(parent) {
//qLog(Debug) << __PRETTY_FUNCTION__;
}
EngineDevice::~EngineDevice() {
//qLog(Debug) << __PRETTY_FUNCTION__;
qDeleteAll(device_finders_);
}
void EngineDevice::Init() {
//qLog(Debug) << __PRETTY_FUNCTION__;
QList<DeviceFinder*> device_finders;
#ifdef Q_OS_LINUX

View File

@@ -23,11 +23,9 @@
#include "config.h"
#include <QStringList>
#include <QVariant>
#include "enginebase.h"
#include "devicefinder.h"
#include <QObject>
#include <QList>
#include <QString>
class DeviceFinder;

View File

@@ -19,8 +19,8 @@
#include "config.h"
#include <QString>
#include <QObject>
#include <QString>
#include "enginetype.h"

View File

@@ -22,8 +22,8 @@
#include "config.h"
#include <QMetaType>
#include <QString>
#include <QObject>
namespace Engine {
@@ -34,11 +34,11 @@ enum EngineType {
Xine,
Phonon
};
Q_DECLARE_METATYPE(Engine::EngineType);
QString EngineNameFromType(Engine::EngineType enginetype);
Engine::EngineType EngineTypeFromName(QString enginename);
}
Q_DECLARE_METATYPE(Engine::EngineType);
#endif

View File

@@ -18,8 +18,8 @@
*
*/
#ifndef BUFFERCONSUMER_H
#define BUFFERCONSUMER_H
#ifndef GSTBUFFERCONSUMER_H
#define GSTBUFFERCONSUMER_H
#include "config.h"
@@ -27,14 +27,13 @@
class GstEnginePipeline;
class BufferConsumer {
class GstBufferConsumer {
public:
virtual ~BufferConsumer() {}
virtual ~GstBufferConsumer() {}
// This is called in some unspecified GStreamer thread.
// Ownership of the buffer is transferred to the BufferConsumer and it should
// gst_buffer_unref it.
virtual void ConsumeBuffer(GstBuffer* buffer, int pipeline_id) = 0;
// Ownership of the buffer is transferred to the BufferConsumer and it should gst_buffer_unref it.
virtual void ConsumeBuffer(GstBuffer *buffer, int pipeline_id) = 0;
};
#endif // BUFFERCONSUMER_H
#endif // GSTBUFFERCONSUMER_H

View File

@@ -18,9 +18,9 @@
*
*/
#include "config.h"
#include <QObject>
#include <QtDebug>
#include "config.h"
#include "gstelementdeleter.h"

View File

@@ -18,14 +18,15 @@
*
*/
#ifndef GSTBINDELETER_H
#define GSTBINDELETER_H
#ifndef GSTELEMENTDELETER_H
#define GSTELEMENTDELETER_H
#include "config.h"
#include <gst/gst.h>
#include <QObject>
#include <QString>
class GstElementDeleter : public QObject {
Q_OBJECT
@@ -33,16 +34,14 @@ class GstElementDeleter : public QObject {
public:
GstElementDeleter(QObject *parent = nullptr);
// If you call this function with any gstreamer element, the element will get
// deleted in the main thread. This is useful if you need to delete an
// element from its own callback.
// It's in a separate object so *your* object (GstEnginePipeline) can be
// destroyed, and the element that you scheduled for deletion is still
// deleted later regardless.
// If you call this function with any gstreamer element, the element will get deleted in the main thread.
// This is useful if you need to delete an element from its own callback.
// It's in a separate object so *your* object (GstEnginePipeline) can be destroyed,
// and the element that you scheduled for deletion is still deleted later regardless.
void DeleteElementLater(GstElement *element);
private slots:
void DeleteElement(GstElement *element);
};
#endif // GSTBINDELETER_H
#endif // GSTELEMENTDELETER_H

View File

@@ -21,55 +21,65 @@
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <memory>
#include <vector>
#include <math.h>
#include <cmath>
#include <string>
#include <gst/gst.h>
#include <gst/pbutils/pbutils.h>
#include <iostream>
#include <memory>
#include <vector>
#include <QtGlobal>
#include <QCoreApplication>
#include <QStandardPaths>
#include <QtConcurrentRun>
#include <QSettings>
#include <QDir>
#include <QFile>
#include <QRegExp>
#include <QFuture>
#include <QTimer>
#include <QDir>
#include <QList>
#include <QByteArray>
#include <QChar>
#include <QString>
#include <QStringBuilder>
#include <QStringList>
#include <QUrl>
#include <QTimeLine>
#include <QTimerEvent>
#include <QMetaObject>
#include <QFlags>
#include <QSettings>
#include <QtDebug>
#include "enginetype.h"
#include "enginebase.h"
#include "gstengine.h"
#include "devicefinder.h"
#include "gstenginepipeline.h"
#include "core/closure.h"
#include "core/utilities.h"
#include "core/logging.h"
#include "core/taskmanager.h"
#include "core/timeconstants.h"
#include "core/utilities.h"
#include "enginebase.h"
#include "enginetype.h"
#include "gstengine.h"
#include "gstenginepipeline.h"
#include "gstbufferconsumer.h"
#ifdef HAVE_IMOBILEDEVICE_ // FIXME
# include "ext/gstafc/gstafcsrc.h"
#endif
#ifdef Q_OS_LINUX
#include "engine/alsadevicefinder.h"
# include "alsadevicefinder.h"
#endif
#ifdef HAVE_LIBPULSE
#include "engine/pulsedevicefinder.h"
# include "pulsedevicefinder.h"
#endif
#ifdef Q_OS_DARWIN
#include "engine/osxdevicefinder.h"
# include "osxdevicefinder.h"
#endif
#ifdef Q_OS_WIN32
#include "engine/directsounddevicefinder.h"
# include "directsounddevicefinder.h"
#endif
#include "settings/backendsettingspage.h"
@@ -117,7 +127,7 @@ GstEngine::GstEngine(TaskManager *task_manager)
#ifdef Q_OS_DARWIN
QDir resources_dir(mac::GetResourcesPath());
QString ca_cert_path = resources_dir.filePath("cacert.pem");
GError* error = nullptr;
GError *error = nullptr;
tls_database_ = g_tls_file_database_new(ca_cert_path.toUtf8().data(), &error);
#endif
@@ -149,6 +159,10 @@ void GstEngine::InitialiseGStreamer() {
gst_init(nullptr, nullptr);
gst_pb_utils_init();
#ifdef HAVE_IMOBILEDEVICE_ // FIXME
afcsrc_register_static();
#endif
}
void GstEngine::SetEnvironment() {
@@ -162,7 +176,7 @@ void GstEngine::SetEnvironment() {
scanner_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gst-plugin-scanner";
plugin_path = QCoreApplication::applicationDirPath() + "/../PlugIns/gstreamer";
#elif defined(Q_OS_WIN32)
plugin_path = QCoreApplication::applicationDirPath() + "/gstreamer-plugins";
plugin_path = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/gstreamer-plugins");
#endif
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
@@ -301,6 +315,7 @@ const Engine::Scope &GstEngine::scope(int chunk_length) {
}
return scope_;
}
void GstEngine::UpdateScope(int chunk_length) {
@@ -348,6 +363,7 @@ void GstEngine::UpdateScope(int chunk_length) {
gst_buffer_unref(latest_buffer_);
latest_buffer_ = nullptr;
}
}
void GstEngine::StartPreloading(const QUrl &url, bool force_stop_at_end, qint64 beginning_nanosec, qint64 end_nanosec) {
@@ -464,6 +480,7 @@ void GstEngine::StartFadeoutPause() {
}
connect(fadeout_pause_pipeline_.get(), SIGNAL(FaderFinished()), SLOT(FadeoutPauseFinished()));
is_fading_out_to_pause_ = true;
}
bool GstEngine::Play(quint64 offset_nanosec) {
@@ -480,6 +497,7 @@ bool GstEngine::Play(quint64 offset_nanosec) {
}
return true;
}
void GstEngine::PlayDone(QFuture<GstStateChangeReturn> future, const quint64 offset_nanosec, const int pipeline_id) {
@@ -517,6 +535,7 @@ void GstEngine::PlayDone(QFuture<GstStateChangeReturn> future, const quint64 off
emit StateChanged(Engine::Playing);
// we've successfully started playing a media stream with this url
emit ValidSongRequested(url_);
}
void GstEngine::Stop(bool stop_after) {
@@ -541,6 +560,7 @@ void GstEngine::Stop(bool stop_after) {
current_pipeline_.reset();
BufferingFinished();
emit StateChanged(Engine::Empty);
}
void GstEngine::FadeoutFinished() {
@@ -549,6 +569,7 @@ void GstEngine::FadeoutFinished() {
}
void GstEngine::FadeoutPauseFinished() {
fadeout_pause_pipeline_->SetState(GST_STATE_PAUSED);
current_pipeline_->SetState(GST_STATE_PAUSED);
emit StateChanged(Engine::Paused);
@@ -560,6 +581,7 @@ void GstEngine::FadeoutPauseFinished() {
fadeout_pipeline_.reset();
emit FadeoutFinishedSignal();
}
void GstEngine::Pause() {
@@ -586,6 +608,7 @@ void GstEngine::Pause() {
StopTimers();
}
}
}
void GstEngine::Unpause() {
@@ -792,7 +815,7 @@ shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline() {
ret->set_mono_playback(mono_playback_);
ret->AddBufferConsumer(this);
for (BufferConsumer *consumer : buffer_consumers_) {
for (GstBufferConsumer *consumer : buffer_consumers_) {
ret->AddBufferConsumer(consumer);
}
@@ -832,12 +855,12 @@ bool GstEngine::ALSADeviceSupport(const QString &name) {
}
void GstEngine::AddBufferConsumer(BufferConsumer *consumer) {
void GstEngine::AddBufferConsumer(GstBufferConsumer *consumer) {
buffer_consumers_ << consumer;
if (current_pipeline_) current_pipeline_->AddBufferConsumer(consumer);
}
void GstEngine::RemoveBufferConsumer(BufferConsumer *consumer) {
void GstEngine::RemoveBufferConsumer(GstBufferConsumer *consumer) {
buffer_consumers_.removeAll(consumer);
if (current_pipeline_) current_pipeline_->RemoveBufferConsumer(consumer);
}

View File

@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2003-2005 by Mark Kretschmann <markey@web.de> *
* Copyright (C) 2005 by Jakub Stachowski <qbast@go2.pl> *
* Portions Copyright (C) 2006 Paul Cifarelli <paul@cifarelli.net> *
* Copyright (C) 2006 Paul Cifarelli <paul@cifarelli.net> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -25,25 +25,28 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <gst/gst.h>
#include <QtGlobal>
#include <QObject>
#include <QFuture>
#include <QHash>
#include <QByteArray>
#include <QList>
#include <QVariant>
#include <QString>
#include <QStringList>
#include <QUrl>
#include <QTimer>
#include <QTimerEvent>
#include "bufferconsumer.h"
#include "enginebase.h"
#include "core/timeconstants.h"
#include "engine_fwd.h"
#include "enginebase.h"
#include "gstbufferconsumer.h"
class QTimer;
class QTimerEvent;
class GstEnginePipeline;
class TaskManager;
class GstEnginePipeline;
#ifdef Q_OS_DARWIN
struct _GTlsDatabase;
@@ -55,7 +58,7 @@ typedef struct _GTlsDatabase GTlsDatabase;
* @short GStreamer engine plugin
* @author Mark Kretschmann <markey@web.de>
*/
class GstEngine : public Engine::Base, public BufferConsumer {
class GstEngine : public Engine::Base, public GstBufferConsumer {
Q_OBJECT
public:
@@ -112,8 +115,8 @@ class GstEngine : public Engine::Base, public BufferConsumer {
void ReloadSettings();
void AddBufferConsumer(BufferConsumer *consumer);
void RemoveBufferConsumer(BufferConsumer *consumer);
void AddBufferConsumer(GstBufferConsumer *consumer);
void RemoveBufferConsumer(GstBufferConsumer *consumer);
#ifdef Q_OS_DARWIN
GTlsDatabase *tls_database() const { return tls_database_; }
@@ -172,7 +175,7 @@ class GstEngine : public Engine::Base, public BufferConsumer {
std::shared_ptr<GstEnginePipeline> fadeout_pause_pipeline_;
QUrl preloaded_url_;
QList<BufferConsumer*> buffer_consumers_;
QList<GstBufferConsumer*> buffer_consumers_;
GstBuffer *latest_buffer_;

View File

@@ -20,28 +20,32 @@
#include "config.h"
#include <limits>
#include <stdlib.h>
#include <glib.h>
#include <glib-object.h>
#include <gst/gst.h>
#include <QtGlobal>
#include <QObject>
#include <QCoreApplication>
#include <QDir>
#include <QPair>
#include <QMutex>
#include <QByteArray>
#include <QList>
#include <QVariant>
#include <QString>
#include <QUuid>
#include <QList>
#include <QTimeLine>
#include <QMetaObject>
#include <QMutexLocker>
#include <QtDebug>
#include "bufferconsumer.h"
#include "gstelementdeleter.h"
#include "gstengine.h"
#include "gstenginepipeline.h"
#include "core/concurrentrun.h"
#include "core/logging.h"
#include "core/mac_startup.h"
#include "core/signalchecker.h"
#include "core/utilities.h"
#include "core/timeconstants.h"
#include "enginebase.h"
#include "gstengine.h"
#include "gstenginepipeline.h"
#include "gstbufferconsumer.h"
#include "gstelementdeleter.h"
const int GstEnginePipeline::kGstStateTimeoutNanosecs = 10000000;
const int GstEnginePipeline::kFaderFudgeMsec = 2000;
@@ -112,11 +116,12 @@ void GstEnginePipeline::set_output_device(const QString &sink, const QVariant &d
}
void GstEnginePipeline::set_replaygain(bool enabled, int mode, float preamp, bool compression) {
rg_enabled_ = enabled;
rg_mode_ = mode;
rg_preamp_ = preamp;
rg_compression_ = compression;
}
void GstEnginePipeline::set_buffer_duration_nanosec(qint64 buffer_duration_nanosec) {
@@ -203,13 +208,10 @@ bool GstEnginePipeline::InitAudioBin() {
if (device_.toString().isEmpty()) break;
g_object_set(G_OBJECT(audiosink_), "device", device_.toString().toUtf8().constData(), nullptr);
break;
#ifdef Q_OS_WIN32
case QVariant::ByteArray: {
GUID guid = QUuid(device_.toByteArray());
g_object_set(G_OBJECT(audiosink_), "device", &guid, nullptr);
g_object_set(G_OBJECT(audiosink_), "device", device_.toByteArray().constData(), nullptr);
break;
}
#endif // Q_OS_WIN32
default:
qLog(Warning) << "Unknown device type" << device_;
break;
@@ -536,8 +538,8 @@ void GstEnginePipeline::ElementMessageReceived(GstMessage *msg) {
void GstEnginePipeline::ErrorMessageReceived(GstMessage *msg) {
GError *error;
gchar *debugs;
GError *error = nullptr;
gchar *debugs = nullptr;
gst_message_parse_error(msg, &error, &debugs);
QString message = QString::fromLocal8Bit(error->message);
@@ -736,13 +738,13 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad*, GstPadProbeInfo *i
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
GstBuffer *buf = gst_pad_probe_info_get_buffer(info);
QList<BufferConsumer*> consumers;
QList<GstBufferConsumer*> consumers;
{
QMutexLocker l(&instance->buffer_consumers_mutex_);
consumers = instance->buffer_consumers_;
}
for (BufferConsumer *consumer : consumers) {
for (GstBufferConsumer *consumer : consumers) {
gst_buffer_ref(buf);
consumer->ConsumeBuffer(buf, instance->id());
}
@@ -1038,12 +1040,12 @@ void GstEnginePipeline::timerEvent(QTimerEvent *e) {
}
void GstEnginePipeline::AddBufferConsumer(BufferConsumer *consumer) {
void GstEnginePipeline::AddBufferConsumer(GstBufferConsumer *consumer) {
QMutexLocker l(&buffer_consumers_mutex_);
buffer_consumers_ << consumer;
}
void GstEnginePipeline::RemoveBufferConsumer(BufferConsumer *consumer) {
void GstEnginePipeline::RemoveBufferConsumer(GstBufferConsumer *consumer) {
QMutexLocker l(&buffer_consumers_mutex_);
buffer_consumers_.removeAll(consumer);
}

View File

@@ -24,25 +24,32 @@
#include "config.h"
#include <memory>
#include <stdbool.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gtypes.h>
#include <gst/gst.h>
#include <QBasicTimer>
#include <QFuture>
#include <QMutex>
#include <QtGlobal>
#include <QObject>
#include <QMutex>
#include <QThreadPool>
#include <QFuture>
#include <QTimeLine>
#include <QBasicTimer>
#include <QByteArray>
#include <QList>
#include <QVariant>
#include <QString>
#include <QTimerEvent>
#include "engine_fwd.h"
class GstElementDeleter;
class GstEngine;
class BufferConsumer;
class GstBufferConsumer;
class GstElementDeleter;
struct GstQueue;
namespace Engine {
struct SimpleMetaBundle;
} // namespace Engine
struct GstPlayBin;
class GstEnginePipeline : public QObject {
@@ -66,9 +73,9 @@ class GstEnginePipeline : public QObject {
bool InitFromUrl(const QByteArray &url, qint64 end_nanosec);
bool InitFromString(const QString &pipeline);
// BufferConsumers get fed audio data. Thread-safe.
void AddBufferConsumer(BufferConsumer *consumer);
void RemoveBufferConsumer(BufferConsumer *consumer);
// GstBufferConsumers get fed audio data. Thread-safe.
void AddBufferConsumer(GstBufferConsumer *consumer);
void RemoveBufferConsumer(GstBufferConsumer *consumer);
void RemoveAllBufferConsumers();
// Control the music playback
@@ -176,7 +183,7 @@ signals:
QVariant device_;
// These get called when there is a new audio buffer available
QList<BufferConsumer*> buffer_consumers_;
QList<GstBufferConsumer*> buffer_consumers_;
QMutex buffer_consumers_mutex_;
qint64 segment_start_;
bool segment_start_received_;

View File

@@ -24,6 +24,9 @@
#include <CoreAudio/AudioHardware.h>
#include <QList>
#include <QString>
#include "osxdevicefinder.h"
#include "core/logging.h"
#include "core/scoped_cftyperef.h"

View File

@@ -23,7 +23,9 @@
#include "config.h"
#include "engine/devicefinder.h"
#include <QList>
#include "devicefinder.h"
class OsxDeviceFinder : public DeviceFinder {
public:
@@ -34,4 +36,3 @@ class OsxDeviceFinder : public DeviceFinder {
};
#endif // OSXDEVICEFINDER_H

View File

@@ -16,12 +16,14 @@
#include "config.h"
#include <QtGlobal>
#include <QUrl>
#include <QTimer>
#include "phononengine.h"
#include "core/logging.h"
#include "core/taskmanager.h"
#include "taskmanager.h"
PhononEngine::PhononEngine(TaskManager *task_manager)
: media_object_(new Phonon::MediaObject(this)),
@@ -63,8 +65,7 @@ bool PhononEngine::Load(const QUrl &url, Engine::TrackChangeFlags change, bool f
bool PhononEngine::Play(quint64 offset_nanosec) {
// The seek happens in PhononStateChanged - phonon doesn't seem to change
// currentTime() if we seek before we start playing :S
// The seek happens in PhononStateChanged - phonon doesn't seem to change currentTime() if we seek before we start playing :S
seek_offset_ = offset_nanosec;
media_object_->play();
@@ -144,16 +145,12 @@ void PhononEngine::StateTimeoutExpired() {
qint64 PhononEngine::position_nanosec() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
return 0;
}
qint64 PhononEngine::length_nanosec() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
return 0;
}

View File

@@ -19,11 +19,15 @@
#include "config.h"
#include "enginebase.h"
#include <phonon/mediaobject.h>
#include <phonon/audiooutput.h>
#include <QtGlobal>
#include <QObject>
#include <QUrl>
#include "enginebase.h"
class QTimer;
class TaskManager;
@@ -49,7 +53,7 @@ class PhononEngine : public Engine::Base {
uint length() const;
void Seek(quint64 offset_nanosec);
qint64 position_nanosec() const;
qint64 length_nanosec() const;

View File

@@ -20,14 +20,19 @@
#include "config.h"
#include <QMutex>
#include <pulse/context.h>
#include <pulse/def.h>
#include <pulse/introspect.h>
#include <pulse/mainloop.h>
#include <pulse/proplist.h>
#include <QtGlobal>
#include <QVariant>
#include <QString>
#include "core/logging.h"
#include "engine/pulsedevicefinder.h"
#include "devicefinder.h"
#include "pulsedevicefinder.h"
PulseDeviceFinder::PulseDeviceFinder() : DeviceFinder("pulseaudio"), mainloop_(nullptr), context_(nullptr) {
}

View File

@@ -23,14 +23,14 @@
#include "config.h"
#include <QMutex>
#include <QList>
#include <stdbool.h>
#include <pulse/context.h>
#include <pulse/introspect.h>
#include <pulse/mainloop.h>
#include "engine/devicefinder.h"
#include <QList>
#include "devicefinder.h"
class PulseDeviceFinder : public DeviceFinder {
public:

View File

@@ -16,20 +16,21 @@
#include "config.h"
#include <boost/bind.hpp>
#include <stddef.h>
#include <vlc/vlc.h>
#include <QTimer>
#include <QtDebug>
#include <QMutexLocker>
#include <QTime>
#include <QtGlobal>
#include <QMutex>
#include <QByteArray>
#include <QUrl>
#include "engine_fwd.h"
#include "enginebase.h"
#include "enginetype.h"
#include "vlcengine.h"
#include "vlcscopedref.h"
#include "core/taskmanager.h"
#include "core/logging.h"
VLCEngine* VLCEngine::sInstance = NULL;
VLCEngine *VLCEngine::sInstance = NULL;
VLCEngine::VLCEngine(TaskManager *task_manager)
: instance_(NULL),
@@ -38,10 +39,8 @@ VLCEngine::VLCEngine(TaskManager *task_manager)
state_(Engine::Empty)
{
//qLog(Debug) << __PRETTY_FUNCTION__;
#if 1
static const char * const args[] = {
static const char *const args[] = {
"-I", "dummy", // Don't use any interface
"--ignore-config", // Don't use VLC's config
"--extraintf=logger", // log anything
@@ -71,7 +70,7 @@ VLCEngine::VLCEngine(TaskManager *task_manager)
HandleErrors();
// Add event handlers
libvlc_event_manager_t* player_em = libvlc_media_player_event_manager(player_);
libvlc_event_manager_t *player_em = libvlc_media_player_event_manager(player_);
HandleErrors();
AttachCallback(player_em, libvlc_MediaPlayerEncounteredError, StateChangedCallback);
@@ -89,27 +88,23 @@ VLCEngine::VLCEngine(TaskManager *task_manager)
VLCEngine::~VLCEngine() {
//qLog(Debug) << __PRETTY_FUNCTION__;
libvlc_media_player_stop(player_);
libvlc_media_player_release(player_);
libvlc_release(instance_);
HandleErrors();
}
void VLCEngine::AttachCallback(libvlc_event_manager_t* em, libvlc_event_type_t type, libvlc_callback_t callback) {
//qLog(Debug) << __PRETTY_FUNCTION__;
void VLCEngine::AttachCallback(libvlc_event_manager_t *em, libvlc_event_type_t type, libvlc_callback_t callback) {
libvlc_event_attach(em, type, callback, this);
HandleErrors();
}
void VLCEngine::StateChangedCallback(const libvlc_event_t* e, void* data) {
void VLCEngine::StateChangedCallback(const libvlc_event_t *e, void *data) {
//qLog(Debug) << __PRETTY_FUNCTION__;
VLCEngine* engine = reinterpret_cast<VLCEngine*>(data);
VLCEngine *engine = reinterpret_cast<VLCEngine*>(data);
switch (e->type) {
case libvlc_MediaPlayerNothingSpecial:
@@ -135,11 +130,10 @@ void VLCEngine::StateChangedCallback(const libvlc_event_t* e, void* data) {
}
emit engine->StateChanged(engine->state_);
}
bool VLCEngine::Init() {
//qLog(Debug) << __PRETTY_FUNCTION__;
type_ = Engine::VLC;
@@ -148,16 +142,12 @@ bool VLCEngine::Init() {
bool VLCEngine::CanDecode(const QUrl &url) {
//qLog(Debug) << __PRETTY_FUNCTION__;
// TODO
return true;
}
bool VLCEngine::Load(const QUrl &url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec) {
//qLog(Debug) << __PRETTY_FUNCTION__;
// Create the media object
VlcScopedRef<libvlc_media_t> media(libvlc_media_new_location(instance_, url.toEncoded().constData()));
//if (libvlc_exception_raised(&exception_))
@@ -168,11 +158,10 @@ bool VLCEngine::Load(const QUrl &url, Engine::TrackChangeFlags change, bool forc
//return false;
return true;
}
bool VLCEngine::Play(quint64 offset_nanosec) {
//qLog(Debug) << __PRETTY_FUNCTION__;
libvlc_media_player_play(player_);
//if (libvlc_exception_raised(&exception_))
@@ -187,31 +176,23 @@ bool VLCEngine::Play(quint64 offset_nanosec) {
void VLCEngine::Stop(bool stop_after) {
//qLog(Debug) << __PRETTY_FUNCTION__;
libvlc_media_player_stop(player_);
HandleErrors();
}
void VLCEngine::Pause() {
//qLog(Debug) << __PRETTY_FUNCTION__;
libvlc_media_player_pause(player_);
HandleErrors();
}
void VLCEngine::Unpause() {
//qLog(Debug) << __PRETTY_FUNCTION__;
libvlc_media_player_play(player_);
HandleErrors();
}
uint VLCEngine::position() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
//bool is_playing = libvlc_media_player_is_playing(player_, const_cast<libvlc_exception_t*>(&exception_));
bool is_playing = libvlc_media_player_is_playing(player_);
@@ -229,8 +210,6 @@ uint VLCEngine::position() const {
}
uint VLCEngine::length() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
//bool is_playing = libvlc_media_player_is_playing(player_, const_cast<libvlc_exception_t*>(&exception_));
bool is_playing = libvlc_media_player_is_playing(player_);
@@ -248,8 +227,6 @@ uint VLCEngine::length() const {
}
void VLCEngine::Seek(quint64 offset_nanosec) {
//qLog(Debug) << __PRETTY_FUNCTION__;
uint len = length();
if (len == 0)
@@ -264,15 +241,11 @@ void VLCEngine::Seek(quint64 offset_nanosec) {
void VLCEngine::SetVolumeSW(uint percent) {
//qLog(Debug) << __PRETTY_FUNCTION__;
libvlc_audio_set_volume(player_, percent);
HandleErrors();
}
void VLCEngine::HandleErrors() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
//if (libvlc_exception_raised(&exception_)) {
//qFatal("libvlc error: %s", libvlc_exception_get_message(&exception_));
@@ -280,9 +253,7 @@ void VLCEngine::HandleErrors() const {
}
void VLCEngine::SetScopeData(float* data, int size) {
//qLog(Debug) << __PRETTY_FUNCTION__;
void VLCEngine::SetScopeData(float *data, int size) {
if (!sInstance)
return;
@@ -297,8 +268,6 @@ void VLCEngine::SetScopeData(float* data, int size) {
}
const Engine::Scope& VLCEngine::Scope() {
//qLog(Debug) << __PRETTY_FUNCTION__;
QMutexLocker l(&scope_mutex_);
@@ -319,17 +288,12 @@ const Engine::Scope& VLCEngine::Scope() {
qint64 VLCEngine::position_nanosec() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
return 0;
}
qint64 VLCEngine::length_nanosec() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
return 0;
}

View File

@@ -19,14 +19,21 @@
#include "config.h"
#include <stdbool.h>
#include <boost/circular_buffer.hpp>
#include <vlc/vlc.h>
#include <QtGlobal>
#include <QObject>
#include <QMutex>
#include <QString>
#include <QUrl>
#include "engine_fwd.h"
#include "enginebase.h"
#include <vlc/vlc.h>
#include <boost/circular_buffer.hpp>
struct libvlc_event_t;
#include <QMutex>
class QTimer;
class TaskManager;
class VLCEngine : public Engine::Base {

View File

@@ -16,30 +16,40 @@
#include "config.h"
#include <cstdlib>
#include <algorithm>
#include <climits>
#include <vector>
#include <QtGlobal>
#include <QApplication>
#include <QThread>
#include <QMutex>
#include <QByteArray>
#include <QChar>
#include <QFile>
#include <QFileInfo>
#include <QDateTime>
#include <QLocale>
#include <QVariant>
#include <QString>
#include <QStringBuilder>
#include <QStringList>
#include <QUrl>
#include <QTimer>
#include <QtDebug>
#include <QSettings>
#include "core/logging.h"
#include "engine_fwd.h"
#include "enginebase.h"
#include "enginetype.h"
#include "xineengine.h"
#include "xinescope.h"
#include <climits>
#include <cstdlib>
#include <cmath>
#include <QtDebug>
#include <QMessageBox>
#include <QApplication>
#include <QDir>
#include <QTime>
#include <QMutex>
#include <QMutexLocker>
#include <QLocale>
#include <QTimer>
#include "enginetype.h"
#include "enginebase.h"
#include "core/logging.h"
extern "C"
{
#include <time.h>
#include <unistd.h>
}
@@ -81,15 +91,11 @@ XineEngine::XineEngine(TaskManager *task_manager)
, equalizerEnabled_( false )
, prune_(NULL)
{
//qLog(Debug) << __PRETTY_FUNCTION__;
ReloadSettings();
}
XineEngine::~XineEngine() {
//qLog(Debug) << __PRETTY_FUNCTION__;
// Wait until the fader thread is done
if( s_fader ) {
@@ -133,8 +139,6 @@ void XineEngine::ReloadSettings() {
QSettings s;
//qLog(Debug) << __PRETTY_FUNCTION__;
Engine::Base::ReloadSettings();
s.beginGroup(BackendSettingsPage::kSettingsGroup);
@@ -153,8 +157,6 @@ void XineEngine::ReloadSettings() {
bool XineEngine::Init() {
//qLog(Debug) << __PRETTY_FUNCTION__;
type_ = Engine::Xine;
#ifdef Q_OS_WIN32
@@ -195,8 +197,6 @@ bool XineEngine::Init() {
bool XineEngine::makeNewStream() {
//qLog(Debug) << __PRETTY_FUNCTION__;
audioPort_ = xine_open_audio_driver(xine_, currentAudioPlugin_.toLocal8Bit().constData(), NULL);
if( !audioPort_ ) {
//TODO make engine method that is the same but parents the dialog for us
@@ -215,10 +215,7 @@ bool XineEngine::makeNewStream() {
if( eventQueue_ )
xine_event_dispose_queue( eventQueue_ );
xine_event_create_listener_thread(
eventQueue_ = xine_event_new_queue( stream_ ),
&XineEngine::XineEventListener,
(void*)this );
xine_event_create_listener_thread(eventQueue_ = xine_event_new_queue( stream_ ), &XineEngine::XineEventListener, (void*)this );
#ifndef XINE_SAFE_MODE
//implemented in xine-scope.h
@@ -240,8 +237,6 @@ bool XineEngine::makeNewStream() {
// Makes sure an audio port and a stream exist.
bool XineEngine::ensureStream() {
//qLog(Debug) << __PRETTY_FUNCTION__;
if(!stream_) return makeNewStream();
return true;
@@ -249,8 +244,6 @@ bool XineEngine::ensureStream() {
}
bool XineEngine::Load(const QUrl &url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec) {
//qLog(Debug) << __PRETTY_FUNCTION__;
if( !ensureStream() )
return false;
@@ -301,10 +294,6 @@ bool XineEngine::Load(const QUrl &url, Engine::TrackChangeFlags change, bool for
}
else
{
#ifdef XINE_PARAM_GAPLESS_SWITCH
//if ( xine_check_version(1,1,1) && !(xfadeLength_ > 0) )
//xine_set_param( stream_, XINE_PARAM_GAPLESS_SWITCH, 0);
#endif
}
// FAILURE to load!
@@ -315,8 +304,6 @@ bool XineEngine::Load(const QUrl &url, Engine::TrackChangeFlags change, bool for
}
bool XineEngine::Play(quint64 offset_nanosec) {
//qLog(Debug) << __PRETTY_FUNCTION__;
if( !ensureStream() )
return false;
@@ -345,8 +332,6 @@ bool XineEngine::Play(quint64 offset_nanosec) {
}
void XineEngine::determineAndShowErrorMessage() {
//qLog(Debug) << __PRETTY_FUNCTION__;
QString body;
@@ -396,8 +381,6 @@ void XineEngine::determineAndShowErrorMessage() {
}
void XineEngine::Stop(bool stop_after) {
//qLog(Debug) << __PRETTY_FUNCTION__;
if( s_fader && s_fader->isRunning())
s_fader->resume(); // safety call if the engine is in the pause state
@@ -425,8 +408,6 @@ void XineEngine::Stop(bool stop_after) {
}
void XineEngine::Pause() {
//qLog(Debug) << __PRETTY_FUNCTION__;
if ( !stream_ )
return;
@@ -444,8 +425,6 @@ void XineEngine::Pause() {
}
void XineEngine::Unpause() {
//qLog(Debug) << __PRETTY_FUNCTION__;
if ( !stream_ )
return;
@@ -461,8 +440,6 @@ void XineEngine::Unpause() {
}
Engine::State XineEngine::state() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
if ( !stream_ || fadeOutRunning_ )
return Engine::Empty;
@@ -512,8 +489,6 @@ uint XineEngine::position() const {
}
uint XineEngine::length() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
if ( !stream_ )
return 0;
@@ -539,8 +514,6 @@ uint XineEngine::length() const {
void XineEngine::Seek(quint64 offset_nanosec) {
//qLog(Debug) << __PRETTY_FUNCTION__;
if( !ensureStream() )
return;
@@ -562,8 +535,6 @@ void XineEngine::SetVolumeSW( uint vol ) {
}
void XineEngine::fadeOut( uint fadeLength, bool* terminate, bool exiting ) {
//qLog(Debug) << __PRETTY_FUNCTION__;
if( fadeOutRunning_ ) //Let us not start another fadeout...
return;
@@ -608,8 +579,6 @@ void XineEngine::fadeOut( uint fadeLength, bool* terminate, bool exiting ) {
}
void XineEngine::setEqualizerEnabled( bool enable ) {
//qLog(Debug) << __PRETTY_FUNCTION__;
if ( !stream_ )
return;
@@ -637,8 +606,6 @@ pre: (-100..100)
post: (1..200) - (1 = down, 100 = middle, 200 = up, 0 = off)
*/
void XineEngine::setEqualizerParameters( int preamp, const QList<int> &gains ) {
//qLog(Debug) << __PRETTY_FUNCTION__;
if ( !stream_ )
return;
@@ -663,8 +630,6 @@ void XineEngine::setEqualizerParameters( int preamp, const QList<int> &gains ) {
}
bool XineEngine::CanDecode( const QUrl &url ) {
//qLog(Debug) << __PRETTY_FUNCTION__;
static QStringList list;
if (list.isEmpty()) {
@@ -702,8 +667,7 @@ bool XineEngine::CanDecode( const QUrl &url ) {
QString path = url.path();
// partial downloads from Konqi and other browsers
// tend to have a .part extension
// partial downloads from Konqi and other browsers tend to have a .part extension
if (path.endsWith( ".part" ))
path = path.left( path.length() - 5 );
@@ -713,8 +677,6 @@ bool XineEngine::CanDecode( const QUrl &url ) {
}
const Engine::Scope & XineEngine::scope(int chunk_length) {
//qLog(Debug) << __PRETTY_FUNCTION__;
if( !post_ || !stream_ || xine_get_status( stream_ ) != XINE_STATUS_PLAY )
return scope_;
@@ -780,8 +742,6 @@ const Engine::Scope & XineEngine::scope(int chunk_length) {
}
void XineEngine::PruneScope() {
//qLog(Debug) << __PRETTY_FUNCTION__;
if (!stream_) return;
@@ -818,8 +778,6 @@ void XineEngine::PruneScope() {
}
bool XineEngine::event( QEvent *e ) {
//qLog(Debug) << __PRETTY_FUNCTION__;
#define message static_cast<QString*>(static_cast<XineEvent*>(e)->data())
#if 0
@@ -870,8 +828,6 @@ bool XineEngine::event( QEvent *e ) {
//SLOT
void XineEngine::playlistChanged() {
//qLog(Debug) << __PRETTY_FUNCTION__;
// TODO
/*#ifdef XINE_PARAM_EARLY_FINISHED_EVENT
@@ -896,8 +852,6 @@ static time_t last_error_time = 0; // hysteresis on xine errors
static int last_error = XINE_MSG_NO_ERROR;
void XineEngine::XineEventListener( void *p, const xine_event_t* xineEvent ) {
//qLog(Debug) << __PRETTY_FUNCTION__;
time_t current;
@@ -917,16 +871,6 @@ void XineEngine::XineEventListener( void *p, const xine_event_t* xineEvent ) {
case XINE_EVENT_UI_PLAYBACK_FINISHED:
qDebug() << "XINE_EVENT_UI_PLAYBACK_FINISHED";
#ifdef XINE_PARAM_GAPLESS_SWITCH
// TODO
/*if ( xine_check_version(1,1,1) && xe->url_.isLocalFile() //Remote media break with gapless
//don't prepare for a track that isn't coming
&& Playlist::instance()
&& Playlist::instance()->isTrackAfter()
&& !AmarokConfig::crossfade() )
xine_set_param( xe->stream_, XINE_PARAM_GAPLESS_SWITCH, 1);*/
#endif
//emit signal from GUI thread
QApplication::postEvent( xe, new XineEvent(XineEvent::PlaybackFinished) );
break;
@@ -934,10 +878,8 @@ void XineEngine::XineEventListener( void *p, const xine_event_t* xineEvent ) {
case XINE_EVENT_PROGRESS: {
xine_progress_data_t* pd = (xine_progress_data_t*)xineEvent->data;
QString
msg = "%1 %2%";
msg = msg.arg( QString::fromUtf8( pd->description ) )
.arg( QString::number(pd->percent) + QLocale::system().percent() );
QString msg = "%1 %2%";
msg = msg.arg( QString::fromUtf8( pd->description ) ).arg( QString::number(pd->percent) + QLocale::system().percent() );
XineEvent *e = new XineEvent( XineEvent::StatusMessage );
e->setData( new QString( msg ) );
@@ -950,8 +892,7 @@ void XineEngine::XineEventListener( void *p, const xine_event_t* xineEvent ) {
/// xine has read the stream and found it actually links to something else
/// so we need to play that instead
QString message = QString::fromUtf8(
static_cast<xine_mrl_reference_data_ext_t*>(xineEvent->data)->mrl);
QString message = QString::fromUtf8(static_cast<xine_mrl_reference_data_ext_t*>(xineEvent->data)->mrl);
XineEvent *e = new XineEvent( XineEvent::Redirecting );
e->setData( new QString( message ) );
@@ -1088,36 +1029,24 @@ XineEngine::fetchMetaData() const
bool XineEngine::metaDataForUrl(const QUrl &url, Engine::SimpleMetaBundle &b) {
//qLog(Debug) << __PRETTY_FUNCTION__;
bool result = false;
xine_stream_t* tmpstream = xine_stream_new(xine_, NULL, NULL);
if (xine_open(tmpstream, QFile::encodeName(url.toString()))) {
QString audioCodec = QString::fromUtf8(xine_get_meta_info(tmpstream, XINE_META_INFO_SYSTEMLAYER));
if (audioCodec == "CDDA") {
QString title = QString::fromUtf8(
xine_get_meta_info(tmpstream, XINE_META_INFO_TITLE));
QString title = QString::fromUtf8(xine_get_meta_info(tmpstream, XINE_META_INFO_TITLE));
if ((!title.isNull()) && (!title.isEmpty())) { //no meta info
b.title = title;
b.artist =
QString::fromUtf8(
xine_get_meta_info(tmpstream, XINE_META_INFO_ARTIST));
b.album =
QString::fromUtf8(
xine_get_meta_info(tmpstream, XINE_META_INFO_ALBUM));
b.genre =
QString::fromUtf8(
xine_get_meta_info(tmpstream, XINE_META_INFO_GENRE));
b.year =
QString::fromUtf8(
xine_get_meta_info(tmpstream, XINE_META_INFO_YEAR));
b.tracknr =
QString::fromUtf8(
xine_get_meta_info(tmpstream, XINE_META_INFO_TRACK_NUMBER));
b.artist = QString::fromUtf8(xine_get_meta_info(tmpstream, XINE_META_INFO_ARTIST));
b.album = QString::fromUtf8(xine_get_meta_info(tmpstream, XINE_META_INFO_ALBUM));
b.genre = QString::fromUtf8(xine_get_meta_info(tmpstream, XINE_META_INFO_GENRE));
b.year = QString::fromUtf8(xine_get_meta_info(tmpstream, XINE_META_INFO_YEAR));
b.tracknr = QString::fromUtf8(xine_get_meta_info(tmpstream, XINE_META_INFO_TRACK_NUMBER));
if( b.tracknr.isEmpty() )
b.tracknr = QFileInfo(url.path()).fileName();
} else {
}
else {
b.title = QString("Track %1").arg(QFileInfo(url.path()).fileName());
b.album = "AudioCD";
}
@@ -1127,8 +1056,7 @@ bool XineEngine::metaDataForUrl(const QUrl &url, Engine::SimpleMetaBundle &b) {
result = true;
int samplerate = xine_get_stream_info( tmpstream, XINE_STREAM_INFO_AUDIO_SAMPLERATE );
// xine would provide a XINE_STREAM_INFO_AUDIO_BITRATE, but unfortunately not for CDDA or WAV
// so we calculate the bitrate by our own
// xine would provide a XINE_STREAM_INFO_AUDIO_BITRATE, but unfortunately not for CDDA or WAV so we calculate the bitrate by our own
int bitsPerSample = xine_get_stream_info( tmpstream, XINE_STREAM_INFO_AUDIO_BITS );
int nbrChannels = xine_get_stream_info( tmpstream, XINE_STREAM_INFO_AUDIO_CHANNELS );
int bitrate = (samplerate * bitsPerSample * nbrChannels) / 1000;
@@ -1146,8 +1074,6 @@ bool XineEngine::metaDataForUrl(const QUrl &url, Engine::SimpleMetaBundle &b) {
}
bool XineEngine::getAudioCDContents(const QString &device, QList<QUrl> &urls) {
//qLog(Debug) << __PRETTY_FUNCTION__;
const char * const *xine_urls = NULL;
int num;
@@ -1205,8 +1131,6 @@ Fader::Fader( XineEngine *engine, uint fadeMs )
, terminated_( false )
{
//qLog(Debug) << __PRETTY_FUNCTION__;
if( engine->makeNewStream() ) {
increase_ = engine->stream_;
@@ -1219,8 +1143,6 @@ Fader::Fader( XineEngine *engine, uint fadeMs )
}
Fader::~Fader() {
//qLog(Debug) << __PRETTY_FUNCTION__;
wait();
@@ -1237,8 +1159,6 @@ Fader::~Fader() {
}
void Fader::run() {
//qLog(Debug) << __PRETTY_FUNCTION__;
// do a volume change in 100 steps (or every 10ms)
uint stepsCount = fadeLength_ < 1000 ? fadeLength_ / 10 : 100;
@@ -1246,8 +1166,7 @@ void Fader::run() {
float mix = 0.0;
float elapsedUs = 0.0;
while ( mix < 1.0 )
{
while ( mix < 1.0 ) {
if ( terminated_ )
break;
// sleep a constant amount of time
@@ -1322,8 +1241,6 @@ OutFader::~OutFader() {
}
void OutFader::run() {
//qLog(Debug) << __PRETTY_FUNCTION__;
engine_->fadeOut( fadeLength_, &terminated_ );
@@ -1336,8 +1253,6 @@ void OutFader::run() {
void OutFader::finish() {
//qLog(Debug) << __PRETTY_FUNCTION__;
terminated_ = true;
}
@@ -1347,8 +1262,6 @@ PruneScopeThread::PruneScopeThread(XineEngine *parent)
}
void PruneScopeThread::run() {
//qLog(Debug) << __PRETTY_FUNCTION__;
QTimer timer;
connect(&timer, SIGNAL(timeout()), engine_, SLOT(PruneScope()), Qt::DirectConnection);
@@ -1367,8 +1280,6 @@ qint64 XineEngine::length_nanosec() const {
EngineBase::PluginDetailsList XineEngine::GetPluginList() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
PluginDetailsList ret;
const char *const *plugins = xine_list_audio_output_plugins(xine_);
@@ -1398,8 +1309,6 @@ EngineBase::PluginDetailsList XineEngine::GetPluginList() const {
EngineBase::OutputDetailsList XineEngine::GetOutputsList() const {
//qLog(Debug) << __PRETTY_FUNCTION__;
OutputDetailsList ret;
PluginDetailsList plugins = GetPluginList();

View File

@@ -13,20 +13,27 @@
#include "config.h"
#include "enginebase.h"
#include <QtGlobal>
#include <QObject>
#include <QMutex>
#include <QThread>
#include <QEvent>
#include <QSettings>
#include <QMutex>
#include <QList>
#include <QString>
#include <QUrl>
extern "C"
{
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include <xine.h>
}
class XineConfigDialog;
//class DeviceFinder;
#include "engine_fwd.h"
#include "enginebase.h"
class TaskManager;
class XineEvent : public QEvent {
@@ -127,7 +134,6 @@ public:
QMutex initMutex_;
//QSettings settings_;
bool fadeoutOnExit_;
bool fadeoutEnabled_;
bool crossfadeEnabled_;

View File

@@ -17,8 +17,7 @@
typedef struct scope_plugin_s scope_plugin_t;
struct scope_plugin_s
{
struct scope_plugin_s {
post_plugin_t post;
metronom_t metronom;
@@ -30,9 +29,8 @@ struct scope_plugin_s
* post plugin functions *
*************************/
static int
scope_port_open( xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode )
{
static int scope_port_open( xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode ) {
#define port ((post_audio_port_t*)port_gen)
#define this ((scope_plugin_t*)((post_audio_port_t*)port_gen)->post)
@@ -49,9 +47,8 @@ scope_port_open( xine_audio_port_t *port_gen, xine_stream_t *stream, uint32_t bi
return port->original_port->open( port->original_port, stream, bits, rate, mode );
}
static void
scope_port_close( xine_audio_port_t *port_gen, xine_stream_t *stream )
{
static void scope_port_close( xine_audio_port_t *port_gen, xine_stream_t *stream ) {
MyNode *node;
/* ensure the buffers are deleted during the next XineEngine::timerEvent() */
@@ -64,9 +61,7 @@ scope_port_close( xine_audio_port_t *port_gen, xine_stream_t *stream )
_x_post_dec_usage( port );
}
static void
scope_port_put_buffer( xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream )
{
static void scope_port_put_buffer( xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_stream_t *stream ) {
/* FIXME With 8-bit samples the scope won't work correctly. For a special 8-bit code path,
the sample size could be checked like this: if( port->bits == 8 ) */
@@ -104,9 +99,7 @@ scope_port_put_buffer( xine_audio_port_t *port_gen, audio_buffer_t *buf, xine_st
#undef this
}
static void
scope_dispose( post_plugin_t *this )
{
static void scope_dispose( post_plugin_t *this ) {
MyNode *list = ((scope_plugin_t*)this)->list;
MyNode *prev;
MyNode *node = list;
@@ -131,9 +124,8 @@ scope_dispose( post_plugin_t *this )
* plugin init function *
************************/
xine_post_t*
scope_plugin_new( xine_t *xine, xine_audio_port_t *audio_target )
{
xine_post_t* scope_plugin_new( xine_t *xine, xine_audio_port_t *audio_target ) {
scope_plugin_t *scope_plugin = calloc( 1, sizeof(scope_plugin_t) );
post_plugin_t *post_plugin = (post_plugin_t*)scope_plugin;
@@ -169,20 +161,14 @@ scope_plugin_new( xine_t *xine, xine_audio_port_t *audio_target )
return &post_plugin->xine_post;
}
MyNode*
scope_plugin_list( void *post )
{
MyNode* scope_plugin_list( void *post ) {
return ((scope_plugin_t*)post)->list;
}
int
scope_plugin_channels( void *post )
{
int scope_plugin_channels( void *post ) {
return ((scope_plugin_t*)post)->channels;
}
metronom_t*
scope_plugin_metronom( void *post )
{
metronom_t* scope_plugin_metronom( void *post ) {
return &((scope_plugin_t*)post)->metronom;
}