Make xine analyzer optional
This commit is contained in:
parent
20f9108ebf
commit
8b05af7ca3
|
@ -357,6 +357,19 @@ if (APPLE AND USE_BUNDLE AND NOT USE_BUNDLE_DIR)
|
||||||
set(USE_BUNDLE_DIR "../PlugIns")
|
set(USE_BUNDLE_DIR "../PlugIns")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_XINE)
|
||||||
|
check_cxx_source_compiles("
|
||||||
|
#define METRONOM_INTERNAL
|
||||||
|
#include <iostream>
|
||||||
|
#include <xine/metronom.h>
|
||||||
|
int main() {
|
||||||
|
metronom_t metronom;
|
||||||
|
std::cout << metronom.pts_per_smpls;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
XINE_ANALYZER)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Set up definitions and paths
|
# Set up definitions and paths
|
||||||
|
|
||||||
|
|
|
@ -579,6 +579,9 @@ optional_source(HAVE_XINE
|
||||||
SOURCES engine/xineengine.cpp engine/xinescope.c
|
SOURCES engine/xineengine.cpp engine/xinescope.c
|
||||||
HEADERS engine/xineengine.h
|
HEADERS engine/xineengine.h
|
||||||
)
|
)
|
||||||
|
optional_source(XINE_ANALYZER
|
||||||
|
SOURCES engine/xinescope.c
|
||||||
|
)
|
||||||
|
|
||||||
# VLC
|
# VLC
|
||||||
optional_source(HAVE_VLC
|
optional_source(HAVE_VLC
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#cmakedefine HAVE_VLC
|
#cmakedefine HAVE_VLC
|
||||||
#cmakedefine HAVE_XINE
|
#cmakedefine HAVE_XINE
|
||||||
#cmakedefine HAVE_PHONON
|
#cmakedefine HAVE_PHONON
|
||||||
|
#cmakedefine XINE_ANALYZER
|
||||||
|
|
||||||
#cmakedefine HAVE_TIDAL
|
#cmakedefine HAVE_TIDAL
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <xine.h>
|
#include <xine.h>
|
||||||
#include <xine/metronom.h>
|
#ifdef XINE_ANALYZER
|
||||||
|
# include <xine/metronom.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -63,7 +65,9 @@
|
||||||
#include "enginebase.h"
|
#include "enginebase.h"
|
||||||
#include "enginetype.h"
|
#include "enginetype.h"
|
||||||
#include "xineengine.h"
|
#include "xineengine.h"
|
||||||
#include "xinescope.h"
|
#ifdef XINE_ANALYZER
|
||||||
|
# include "xinescope.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "settings/backendsettingspage.h"
|
#include "settings/backendsettingspage.h"
|
||||||
|
|
||||||
|
@ -84,9 +88,11 @@ XineEngine::XineEngine(TaskManager *task_manager)
|
||||||
audioport_(nullptr),
|
audioport_(nullptr),
|
||||||
stream_(nullptr),
|
stream_(nullptr),
|
||||||
eventqueue_(nullptr),
|
eventqueue_(nullptr),
|
||||||
|
#ifdef XINE_ANALYZER
|
||||||
post_(nullptr),
|
post_(nullptr),
|
||||||
preamp_(1.0),
|
|
||||||
prune_(nullptr),
|
prune_(nullptr),
|
||||||
|
#endif
|
||||||
|
preamp_(1.0),
|
||||||
have_metadata_(false) {
|
have_metadata_(false) {
|
||||||
|
|
||||||
type_ = Engine::Xine;
|
type_ = Engine::Xine;
|
||||||
|
@ -118,7 +124,7 @@ bool XineEngine::Init() {
|
||||||
|
|
||||||
xine_init(xine_);
|
xine_init(xine_);
|
||||||
|
|
||||||
#ifndef XINE_SAFE_MODE
|
#if !defined(XINE_SAFE_MODE) && defined(XINE_ANALYZER)
|
||||||
prune_.reset(new PruneScopeThread(this));
|
prune_.reset(new PruneScopeThread(this));
|
||||||
prune_->start();
|
prune_->start();
|
||||||
#endif
|
#endif
|
||||||
|
@ -172,7 +178,7 @@ bool XineEngine::OpenAudioDriver() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef XINE_SAFE_MODE
|
#if !defined(XINE_SAFE_MODE) && defined(XINE_ANALYZER)
|
||||||
post_ = scope_plugin_new(xine_, audioport_);
|
post_ = scope_plugin_new(xine_, audioport_);
|
||||||
if (!post_) {
|
if (!post_) {
|
||||||
xine_close_audio_driver(xine_, audioport_);
|
xine_close_audio_driver(xine_, audioport_);
|
||||||
|
@ -190,10 +196,12 @@ bool XineEngine::OpenAudioDriver() {
|
||||||
|
|
||||||
void XineEngine::CloseAudioDriver() {
|
void XineEngine::CloseAudioDriver() {
|
||||||
|
|
||||||
|
#ifdef XINE_ANALYZER
|
||||||
if (post_) {
|
if (post_) {
|
||||||
xine_post_dispose(xine_, post_);
|
xine_post_dispose(xine_, post_);
|
||||||
post_ = nullptr;
|
post_ = nullptr;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (audioport_) {
|
if (audioport_) {
|
||||||
xine_close_audio_driver(xine_, audioport_);
|
xine_close_audio_driver(xine_, audioport_);
|
||||||
|
@ -260,12 +268,14 @@ bool XineEngine::EnsureStream() {
|
||||||
|
|
||||||
void XineEngine::Cleanup() {
|
void XineEngine::Cleanup() {
|
||||||
|
|
||||||
|
#ifdef XINE_ANALYZER
|
||||||
// Wait until the prune scope thread is done
|
// Wait until the prune scope thread is done
|
||||||
if (prune_) {
|
if (prune_) {
|
||||||
prune_->exit();
|
prune_->exit();
|
||||||
prune_->wait();
|
prune_->wait();
|
||||||
}
|
}
|
||||||
prune_.reset();
|
prune_.reset();
|
||||||
|
#endif
|
||||||
|
|
||||||
CloseStream();
|
CloseStream();
|
||||||
CloseAudioDriver();
|
CloseAudioDriver();
|
||||||
|
@ -309,7 +319,7 @@ bool XineEngine::Load(const QUrl &media_url, const QUrl &original_url, Engine::T
|
||||||
int result = xine_open(stream_, media_url.toString().toUtf8());
|
int result = xine_open(stream_, media_url.toString().toUtf8());
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
||||||
#ifndef XINE_SAFE_MODE
|
#if !defined(XINE_SAFE_MODE) && defined(XINE_ANALYZER)
|
||||||
xine_post_out_t *source = xine_get_audio_source(stream_);
|
xine_post_out_t *source = xine_get_audio_source(stream_);
|
||||||
xine_post_in_t *target = (xine_post_in_t*)xine_post_input(post_, const_cast<char*>("audio in"));
|
xine_post_in_t *target = (xine_post_in_t*)xine_post_input(post_, const_cast<char*>("audio in"));
|
||||||
xine_post_wire(source, target);
|
xine_post_wire(source, target);
|
||||||
|
@ -890,6 +900,8 @@ void XineEngine::DetermineAndShowErrorMessage() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XINE_ANALYZER
|
||||||
|
|
||||||
const Engine::Scope &XineEngine::scope(int chunk_length) {
|
const Engine::Scope &XineEngine::scope(int chunk_length) {
|
||||||
|
|
||||||
if (!post_ || !stream_ || xine_get_status(stream_) != XINE_STATUS_PLAY)
|
if (!post_ || !stream_ || xine_get_status(stream_) != XINE_STATUS_PLAY)
|
||||||
|
@ -995,8 +1007,11 @@ void PruneScopeThread::run() {
|
||||||
timer.start(1000);
|
timer.start(1000);
|
||||||
|
|
||||||
exec();
|
exec();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
EngineBase::PluginDetailsList XineEngine::GetPluginList() const {
|
EngineBase::PluginDetailsList XineEngine::GetPluginList() const {
|
||||||
|
|
||||||
PluginDetailsList ret;
|
PluginDetailsList ret;
|
||||||
|
|
|
@ -65,7 +65,9 @@ class XineEngine : public Engine::Base {
|
||||||
qint64 position_nanosec() const;
|
qint64 position_nanosec() const;
|
||||||
qint64 length_nanosec() const;
|
qint64 length_nanosec() const;
|
||||||
|
|
||||||
|
#ifdef XINE_ANALYZER
|
||||||
const Engine::Scope& scope(int chunk_length);
|
const Engine::Scope& scope(int chunk_length);
|
||||||
|
#endif
|
||||||
|
|
||||||
OutputDetailsList GetOutputsList() const;
|
OutputDetailsList GetOutputsList() const;
|
||||||
bool ValidOutput(const QString &output);
|
bool ValidOutput(const QString &output);
|
||||||
|
@ -95,9 +97,11 @@ class XineEngine : public Engine::Base {
|
||||||
xine_audio_port_t *audioport_;
|
xine_audio_port_t *audioport_;
|
||||||
xine_stream_t *stream_;
|
xine_stream_t *stream_;
|
||||||
xine_event_queue_t *eventqueue_;
|
xine_event_queue_t *eventqueue_;
|
||||||
|
#ifdef XINE_ANALYZER
|
||||||
xine_post_t *post_;
|
xine_post_t *post_;
|
||||||
float preamp_;
|
|
||||||
std::unique_ptr<PruneScopeThread> prune_;
|
std::unique_ptr<PruneScopeThread> prune_;
|
||||||
|
#endif
|
||||||
|
float preamp_;
|
||||||
|
|
||||||
QUrl media_url_;
|
QUrl media_url_;
|
||||||
QUrl original_url_;
|
QUrl original_url_;
|
||||||
|
@ -134,13 +138,16 @@ class XineEngine : public Engine::Base {
|
||||||
|
|
||||||
PluginDetailsList GetPluginList() const;
|
PluginDetailsList GetPluginList() const;
|
||||||
|
|
||||||
private slots:
|
#ifdef XINE_ANALYZER
|
||||||
|
private slots:
|
||||||
void PruneScope();
|
void PruneScope();
|
||||||
|
#endif
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void InfoMessage(const QString&);
|
void InfoMessage(const QString&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef XINE_ANALYZER
|
||||||
class PruneScopeThread : public QThread {
|
class PruneScopeThread : public QThread {
|
||||||
public:
|
public:
|
||||||
PruneScopeThread(XineEngine *parent);
|
PruneScopeThread(XineEngine *parent);
|
||||||
|
@ -152,5 +159,6 @@ private:
|
||||||
XineEngine *engine_;
|
XineEngine *engine_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue