MixerPlugin: add EventLoop& init() parameter
This commit is contained in:
@@ -35,8 +35,6 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
EventLoop *main_loop;
|
||||
|
||||
#ifdef HAVE_PULSE
|
||||
#include "output/plugins/PulseOutputPlugin.hxx"
|
||||
|
||||
@@ -115,10 +113,10 @@ int main(int argc, gcc_unused char **argv)
|
||||
g_thread_init(NULL);
|
||||
#endif
|
||||
|
||||
main_loop = new EventLoop;
|
||||
EventLoop event_loop;
|
||||
|
||||
Error error;
|
||||
Mixer *mixer = mixer_new(&alsa_mixer_plugin, nullptr,
|
||||
Mixer *mixer = mixer_new(event_loop, &alsa_mixer_plugin, nullptr,
|
||||
config_param(), error);
|
||||
if (mixer == NULL) {
|
||||
LogError(error, "mixer_new() failed");
|
||||
@@ -135,8 +133,6 @@ int main(int argc, gcc_unused char **argv)
|
||||
mixer_close(mixer);
|
||||
mixer_free(mixer);
|
||||
|
||||
delete main_loop;
|
||||
|
||||
assert(volume >= -1 && volume <= 100);
|
||||
|
||||
if (volume < 0) {
|
||||
|
@@ -45,8 +45,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
EventLoop *main_loop;
|
||||
|
||||
void
|
||||
GlobalEvents::Emit(gcc_unused Event event)
|
||||
{
|
||||
@@ -80,7 +78,7 @@ PlayerControl::PlayerControl(gcc_unused MultipleOutputs &_outputs,
|
||||
PlayerControl::~PlayerControl() {}
|
||||
|
||||
static AudioOutput *
|
||||
load_audio_output(const char *name)
|
||||
load_audio_output(EventLoop &event_loop, const char *name)
|
||||
{
|
||||
const struct config_param *param;
|
||||
|
||||
@@ -95,7 +93,8 @@ load_audio_output(const char *name)
|
||||
|
||||
Error error;
|
||||
AudioOutput *ao =
|
||||
audio_output_new(*param, dummy_player_control, error);
|
||||
audio_output_new(event_loop, *param, dummy_player_control,
|
||||
error);
|
||||
if (ao == nullptr)
|
||||
LogError(error);
|
||||
|
||||
@@ -189,14 +188,14 @@ int main(int argc, char **argv)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
main_loop = new EventLoop();
|
||||
EventLoop event_loop;
|
||||
|
||||
io_thread_init();
|
||||
io_thread_start();
|
||||
|
||||
/* initialize the audio output */
|
||||
|
||||
AudioOutput *ao = load_audio_output(argv[2]);
|
||||
AudioOutput *ao = load_audio_output(event_loop, argv[2]);
|
||||
if (ao == NULL)
|
||||
return 1;
|
||||
|
||||
@@ -219,8 +218,6 @@ int main(int argc, char **argv)
|
||||
|
||||
io_thread_deinit();
|
||||
|
||||
delete main_loop;
|
||||
|
||||
config_global_finish();
|
||||
|
||||
return success ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
|
Reference in New Issue
Block a user