output/Client: new interface to replace direct access to class PlayerControl
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "config.h"
|
||||
#include "output/Internal.hxx"
|
||||
#include "output/OutputPlugin.hxx"
|
||||
#include "output/Client.hxx"
|
||||
#include "config/Param.hxx"
|
||||
#include "config/ConfigGlobal.hxx"
|
||||
#include "config/ConfigOption.hxx"
|
||||
@@ -32,7 +33,6 @@
|
||||
#include "ReplayGainConfig.hxx"
|
||||
#include "pcm/PcmConvert.hxx"
|
||||
#include "filter/FilterRegistry.hxx"
|
||||
#include "player/Control.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
#include "util/ScopeExit.hxx"
|
||||
#include "Log.hxx"
|
||||
@@ -43,6 +43,16 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
class DummyAudioOutputClient final : public AudioOutputClient {
|
||||
public:
|
||||
/* virtual methods from AudioOutputClient */
|
||||
void ChunksConsumed() override {
|
||||
}
|
||||
|
||||
void ApplyEnabled() override {
|
||||
}
|
||||
};
|
||||
|
||||
const FilterPlugin *
|
||||
filter_plugin_by_name(gcc_unused const char *name)
|
||||
{
|
||||
@@ -50,21 +60,9 @@ filter_plugin_by_name(gcc_unused const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PlayerControl::PlayerControl(PlayerListener &_listener,
|
||||
MultipleOutputs &_outputs,
|
||||
unsigned _buffer_chunks,
|
||||
unsigned _buffered_before_play,
|
||||
AudioFormat _configured_audio_format,
|
||||
const ReplayGainConfig &_replay_gain_config)
|
||||
:listener(_listener), outputs(_outputs),
|
||||
buffer_chunks(_buffer_chunks),
|
||||
buffered_before_play(_buffered_before_play),
|
||||
configured_audio_format(_configured_audio_format),
|
||||
replay_gain_config(_replay_gain_config) {}
|
||||
PlayerControl::~PlayerControl() {}
|
||||
|
||||
static AudioOutput *
|
||||
load_audio_output(EventLoop &event_loop, const char *name)
|
||||
load_audio_output(EventLoop &event_loop, AudioOutputClient &client,
|
||||
const char *name)
|
||||
{
|
||||
const auto *param = config_find_block(ConfigBlockOption::AUDIO_OUTPUT,
|
||||
"name", name);
|
||||
@@ -72,15 +70,9 @@ load_audio_output(EventLoop &event_loop, const char *name)
|
||||
throw FormatRuntimeError("No such configured audio output: %s\n",
|
||||
name);
|
||||
|
||||
static struct PlayerControl dummy_player_control(*(PlayerListener *)nullptr,
|
||||
*(MultipleOutputs *)nullptr,
|
||||
32, 4,
|
||||
AudioFormat::Undefined(),
|
||||
ReplayGainConfig());
|
||||
|
||||
return audio_output_new(event_loop, ReplayGainConfig(), *param,
|
||||
*(MixerListener *)nullptr,
|
||||
dummy_player_control);
|
||||
client);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -150,7 +142,8 @@ try {
|
||||
|
||||
/* initialize the audio output */
|
||||
|
||||
AudioOutput *ao = load_audio_output(event_loop, argv[2]);
|
||||
DummyAudioOutputClient client;
|
||||
AudioOutput *ao = load_audio_output(event_loop, client, argv[2]);
|
||||
|
||||
/* parse the audio format */
|
||||
|
||||
|
Reference in New Issue
Block a user