Remove xine
This commit is contained in:
@@ -28,7 +28,6 @@ namespace Engine {
|
||||
Engine::EngineType EngineTypeFromName(QString enginename) {
|
||||
QString lower = enginename.toLower();
|
||||
if (lower == "gstreamer") return Engine::GStreamer;
|
||||
else if (lower == "xine") return Engine::Xine;
|
||||
else if (lower == "vlc") return Engine::VLC;
|
||||
else return Engine::None;
|
||||
}
|
||||
@@ -36,7 +35,6 @@ Engine::EngineType EngineTypeFromName(QString enginename) {
|
||||
QString EngineName(Engine::EngineType enginetype) {
|
||||
switch (enginetype) {
|
||||
case Engine::GStreamer: return QString("gstreamer");
|
||||
case Engine::Xine: return QString("xine");
|
||||
case Engine::VLC: return QString("vlc");
|
||||
case Engine::None:
|
||||
default: return QString("None");
|
||||
@@ -46,7 +44,6 @@ QString EngineName(Engine::EngineType enginetype) {
|
||||
QString EngineDescription(Engine::EngineType enginetype) {
|
||||
switch (enginetype) {
|
||||
case Engine::GStreamer: return QString("GStreamer");
|
||||
case Engine::Xine: return QString("Xine");
|
||||
case Engine::VLC: return QString("VLC");
|
||||
case Engine::None:
|
||||
default: return QString("None");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,154 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2017-2018 Jonas Kvinge <jonas@jkvinge.net> *
|
||||
* Copyright (C) 2005 Christophe Thommeret <hftom@free.fr> *
|
||||
* (C) 2005 Ian Monroe <ian@monroe.nu> *
|
||||
* (C) 2005-2006 Mark Kretschmann <markey@web.de> *
|
||||
* (C) 2004-2005 Max Howell <max.howell@methylblue.com> *
|
||||
* (C) 2003-2004 J. Kofler <kaffeine@gmx.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 *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef XINEENGINE_H
|
||||
#define XINEENGINE_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef XINE_ENGINE_INTERNAL
|
||||
# define XINE_ENGINE_INTERNAL
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
#include <sys/types.h>
|
||||
#include <xine.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "engine_fwd.h"
|
||||
#include "enginebase.h"
|
||||
|
||||
class TaskManager;
|
||||
class PruneScopeThread;
|
||||
|
||||
class XineEngine : public Engine::Base {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit XineEngine(TaskManager *task_manager);
|
||||
~XineEngine() override;
|
||||
|
||||
bool Init() override;
|
||||
Engine::State state() const override;
|
||||
bool Load(const QUrl &stream_url, const QUrl &original_url, Engine::TrackChangeFlags change, bool force_stop_at_end, quint64 beginning_nanosec, qint64 end_nanosec) override;
|
||||
bool Play(quint64 offset_nanosec) override;
|
||||
void Stop(bool stop_after = false) override;
|
||||
void Pause() override;
|
||||
void Unpause() override;
|
||||
void Seek(quint64 offset_nanosec) override;
|
||||
void SetVolumeSW(uint) override;
|
||||
|
||||
qint64 position_nanosec() const override;
|
||||
qint64 length_nanosec() const override;
|
||||
|
||||
const Engine::Scope& scope(int chunk_length);
|
||||
|
||||
OutputDetailsList GetOutputsList() const override;
|
||||
bool ValidOutput(const QString &output) override;
|
||||
QString DefaultOutput() override { return "auto"; }
|
||||
bool CustomDeviceSupport(const QString &output) override;
|
||||
bool ALSADeviceSupport(const QString &output) override;
|
||||
|
||||
void ReloadSettings() override;
|
||||
|
||||
bool CanDecode(const QUrl &);
|
||||
|
||||
void SetEqualizerEnabled(bool enabled) override;
|
||||
void SetEqualizerParameters(int preamp, const QList<int>&) override;
|
||||
|
||||
// Simple accessors
|
||||
|
||||
xine_stream_t *stream() { return stream_; }
|
||||
float preamp() { return preamp_; }
|
||||
|
||||
private:
|
||||
static const char *kAutoOutput;
|
||||
|
||||
QString current_output_;
|
||||
QVariant current_device_;
|
||||
|
||||
xine_t *xine_;
|
||||
xine_audio_port_t *audioport_;
|
||||
xine_stream_t *stream_;
|
||||
xine_event_queue_t *eventqueue_;
|
||||
xine_post_t *post_;
|
||||
std::unique_ptr<PruneScopeThread> prune_;
|
||||
|
||||
float preamp_;
|
||||
|
||||
QUrl stream_url_;
|
||||
QUrl original_url_;
|
||||
bool have_metadata_;
|
||||
|
||||
uint log_buffer_count_ = 0;
|
||||
uint log_scope_call_count_ = 1; // Prevent divideByZero
|
||||
uint log_no_suitable_buffer_ = 0;
|
||||
|
||||
int int_preamp_;
|
||||
QMutex init_mutex_;
|
||||
int64_t current_vpts_;
|
||||
QList<int> equalizer_gains_;
|
||||
|
||||
mutable Engine::SimpleMetaBundle current_bundle_;
|
||||
|
||||
void SetEnvironment();
|
||||
|
||||
void Cleanup();
|
||||
void SetDevice();
|
||||
bool OpenAudioDriver();
|
||||
void CloseAudioDriver();
|
||||
bool CreateStream();
|
||||
void CloseStream();
|
||||
bool EnsureStream();
|
||||
|
||||
uint length() const;
|
||||
uint position() const;
|
||||
|
||||
static void XineEventListener(void*, const xine_event_t*);
|
||||
|
||||
void DetermineAndShowErrorMessage();
|
||||
Engine::SimpleMetaBundle FetchMetaData() const;
|
||||
|
||||
PluginDetailsList GetPluginList() const;
|
||||
|
||||
private slots:
|
||||
void PruneScope();
|
||||
|
||||
signals:
|
||||
void InfoMessage(const QString&);
|
||||
};
|
||||
|
||||
class PruneScopeThread : public QThread {
|
||||
public:
|
||||
PruneScopeThread(XineEngine *parent);
|
||||
|
||||
protected:
|
||||
void run();
|
||||
|
||||
private:
|
||||
XineEngine *engine_;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,173 +0,0 @@
|
||||
/* Author: Max Howell <max.howell@methylblue.com>, (C) 2004
|
||||
Copyright: See COPYING file that comes with this distribution
|
||||
|
||||
This has to be a c file or for some reason it won't link! (GCC 3.4.1)
|
||||
|
||||
*/
|
||||
|
||||
/* need access to port_ticket */
|
||||
#ifndef XINE_ENGINE_INTERNAL
|
||||
# define XINE_ENGINE_INTERNAL
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "xinescope.h"
|
||||
#include <xine/post.h>
|
||||
#include <xine/xine_internal.h>
|
||||
|
||||
typedef struct scope_plugin_s scope_plugin_t;
|
||||
|
||||
struct scope_plugin_s {
|
||||
post_plugin_t post;
|
||||
|
||||
metronom_t metronom;
|
||||
int channels;
|
||||
MyNode *list;
|
||||
};
|
||||
|
||||
/*************************
|
||||
* 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) {
|
||||
|
||||
#define port ((post_audio_port_t*)port_gen)
|
||||
#define this ((scope_plugin_t*)((post_audio_port_t*)port_gen)->post)
|
||||
|
||||
_x_post_rewire((post_plugin_t*)port->post);
|
||||
_x_post_inc_usage(port);
|
||||
|
||||
port->stream = stream;
|
||||
port->bits = bits;
|
||||
port->rate = rate;
|
||||
port->mode = mode;
|
||||
|
||||
this->channels = _x_ao_mode2channels(mode);
|
||||
|
||||
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) {
|
||||
|
||||
MyNode *node;
|
||||
|
||||
/* ensure the buffers are deleted during the next XineEngine::timerEvent() */
|
||||
for(node = this->list->next; node != this->list; node = node->next)
|
||||
node->vpts = node->vpts_end = -1;
|
||||
|
||||
port->stream = NULL;
|
||||
port->original_port->close(port->original_port, 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) {
|
||||
/* 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) */
|
||||
|
||||
const int num_samples = buf->num_frames * this->channels;
|
||||
metronom_t *myMetronom = &this->metronom;
|
||||
MyNode *new_node;
|
||||
|
||||
/* I keep my own metronom because xine wouldn't for some reason */
|
||||
memcpy(&this->metronom, stream->metronom, sizeof(metronom_t));
|
||||
|
||||
new_node = (MyNode *) malloc(sizeof(MyNode));
|
||||
new_node->vpts = myMetronom->got_audio_samples(myMetronom, buf->vpts, buf->num_frames);
|
||||
new_node->num_frames = buf->num_frames;
|
||||
new_node->mem = (int16_t *) malloc(num_samples * 2);
|
||||
memcpy(new_node->mem, buf->mem, num_samples * 2);
|
||||
|
||||
{
|
||||
int64_t
|
||||
K = 32768; /*smpls = 1<<16 samples*/
|
||||
K *= num_samples;
|
||||
K /= (1<<16);
|
||||
K += new_node->vpts;
|
||||
|
||||
new_node->vpts_end = K;
|
||||
}
|
||||
|
||||
port->original_port->put_buffer(port->original_port, buf, stream);
|
||||
|
||||
/* Finally we should append the current buffer to the list
|
||||
* This is thread-safe due to the way we handle the list in the GUI thread */
|
||||
new_node->next = this->list->next;
|
||||
this->list->next = new_node;
|
||||
|
||||
#undef port
|
||||
#undef this
|
||||
}
|
||||
|
||||
static void scope_dispose(post_plugin_t *post) {
|
||||
|
||||
MyNode *list = ((scope_plugin_t*)post)->list;
|
||||
MyNode *prev;
|
||||
MyNode *node = list;
|
||||
|
||||
/* Free all elements of the list (a ring buffer) */
|
||||
do {
|
||||
prev = node->next;
|
||||
|
||||
free(node->mem);
|
||||
free(node);
|
||||
|
||||
node = prev;
|
||||
}
|
||||
while(node != list);
|
||||
|
||||
|
||||
free(post);
|
||||
}
|
||||
|
||||
|
||||
/************************
|
||||
* plugin init function *
|
||||
************************/
|
||||
|
||||
xine_post_t *scope_plugin_new(xine_t *xine, xine_audio_port_t *audio_target) {
|
||||
|
||||
scope_plugin_t *scope_plugin = (scope_plugin_t *) calloc(1, sizeof(scope_plugin_t));
|
||||
post_plugin_t *post_plugin = (post_plugin_t *)scope_plugin;
|
||||
|
||||
{
|
||||
post_in_t *input;
|
||||
post_out_t *output;
|
||||
post_audio_port_t *port;
|
||||
|
||||
_x_post_init(post_plugin, 1, 0);
|
||||
|
||||
port = _x_post_intercept_audio_port(post_plugin, audio_target, &input, &output);
|
||||
port->new_port.open = scope_port_open;
|
||||
port->new_port.close = scope_port_close;
|
||||
port->new_port.put_buffer = scope_port_put_buffer;
|
||||
|
||||
post_plugin->xine_post.audio_input[0] = &port->new_port;
|
||||
post_plugin->xine_post.type = PLUGIN_POST;
|
||||
|
||||
post_plugin->dispose = scope_dispose;
|
||||
}
|
||||
|
||||
// code is straight from xine_init_post() can't use that function as it only dlopens the plugins and our plugin is statically linked in
|
||||
|
||||
post_plugin->running_ticket = xine->port_ticket;
|
||||
post_plugin->xine = xine;
|
||||
|
||||
/* scope_plugin_t init */
|
||||
scope_plugin->list = (MyNode *) calloc(1, sizeof(MyNode));
|
||||
scope_plugin->list->next = scope_plugin->list;
|
||||
|
||||
return &post_plugin->xine_post;
|
||||
}
|
||||
|
||||
MyNode *scope_plugin_list(void *post) {
|
||||
return ((scope_plugin_t*)post)->list;
|
||||
}
|
||||
|
||||
int scope_plugin_channels(void *post) {
|
||||
return ((scope_plugin_t*)post)->channels;
|
||||
}
|
||||
|
||||
metronom_t* scope_plugin_metronom(void *post) {
|
||||
return &((scope_plugin_t*)post)->metronom;
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/* Author: Max Howell <max.howell@methylblue.com>, (C) 2004
|
||||
Copyright: See COPYING file that comes with this distribution
|
||||
|
||||
This has to be a c file or for some reason it won't link! (GCC 3.4.1)
|
||||
*/
|
||||
|
||||
#ifndef XINESCOPE_H
|
||||
#define XINESCOPE_H
|
||||
|
||||
/* need access to some stuff for scope time stamping */
|
||||
#ifndef METRONOM_INTERNAL
|
||||
# define METRONOM_INTERNAL
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <xine/metronom.h>
|
||||
|
||||
typedef struct my_node_s MyNode;
|
||||
|
||||
struct my_node_s {
|
||||
MyNode *next;
|
||||
int16_t *mem;
|
||||
int num_frames;
|
||||
int64_t vpts;
|
||||
int64_t vpts_end;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
xine_post_t *scope_plugin_new( xine_t*, xine_audio_port_t* );
|
||||
|
||||
/* we sacrifice type-safety here because some GCCs appear broken and choke on redefining the xine_post_t typedef */
|
||||
|
||||
MyNode *scope_plugin_list(void*);
|
||||
int scope_plugin_channels(void*);
|
||||
metronom_t *scope_plugin_metronom(void*);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user