Commit 77436474 authored by François Revol's avatar François Revol Committed by Max Kellermann

output: add native Haiku audio output and mixer support

Also uses the notification system to display tags.
parent 352ec364
......@@ -1355,6 +1355,14 @@ liboutput_plugins_a_SOURCES += \
src/output/plugins/FifoOutputPlugin.hxx
endif
if HAVE_HAIKU
liboutput_plugins_a_SOURCES += \
src/output/plugins/HaikuOutputPlugin.cxx \
src/output/plugins/HaikuOutputPlugin.hxx
libmixer_plugins_a_SOURCES += \
src/mixer/plugins/HaikuMixerPlugin.cxx src/mixer/plugins/HaikuMixerPlugin.hxx
endif
if ENABLE_PIPE_OUTPUT
liboutput_plugins_a_SOURCES += \
src/output/plugins/PipeOutputPlugin.cxx \
......
......@@ -333,6 +333,11 @@ AC_ARG_ENABLE(fifo,
[disable support for writing audio to a FIFO (default: enable)]),,
enable_fifo=yes)
AC_ARG_ENABLE(haiku,
AS_HELP_STRING([--enable-haiku],
[enable the Haiku output plugin (default: auto)]),,
enable_haiku=auto)
AC_ARG_ENABLE(httpd-output,
AS_HELP_STRING([--enable-httpd-output],
[enables the HTTP server output]),,
......@@ -1129,6 +1134,19 @@ fi
MPD_DEFINE_CONDITIONAL(enable_fifo, HAVE_FIFO,
[support for writing audio to a FIFO])
dnl ----------------------------------- Haiku ---------------------------------
if test x$enable_haiku = xauto; then
AC_CHECK_HEADER(media/MediaDefs.h,
[enable_haiku=yes],
[enable_haiku=no])
fi
if test x$enable_haiku = xyes; then
AC_DEFINE(HAVE_HAIKU,1,[Define for compiling Haiku support])
LIBS="$LIBS -lbe -lmedia"
fi
AM_CONDITIONAL(HAVE_HAIKU, test x$enable_haiku = xyes)
dnl ------------------------------- HTTPD Output ------------------------------
if test x$enable_httpd_output = xauto; then
# handle HTTPD auto-detection: disable if no encoder is
......@@ -1422,6 +1440,7 @@ printf '\nPlayback support:\n\t'
results(alsa,ALSA)
results(fifo,FIFO)
results(recorder_output,[File Recorder])
results(haiku,[Haiku])
results(httpd_output,[HTTP Daemon])
results(jack,[JACK])
printf '\n\t'
......
......@@ -30,6 +30,7 @@ struct MixerPlugin;
extern const MixerPlugin null_mixer_plugin;
extern const MixerPlugin software_mixer_plugin;
extern const MixerPlugin alsa_mixer_plugin;
extern const MixerPlugin haiku_mixer_plugin;
extern const MixerPlugin oss_mixer_plugin;
extern const MixerPlugin roar_mixer_plugin;
extern const MixerPlugin pulse_mixer_plugin;
......
/*
* Copyright (C) 2003-2015 The Music Player Daemon Project
* Copyright (C) 2010-2011 Philipp 'ph3-der-loewe' Schafft
* Copyright (C) 2010-2011 Hans-Kristian 'maister' Arntzen
* Copyright (C) 2014-2015 François 'mmu_man' Revol
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include "mixer/MixerInternal.hxx"
#include "output/plugins/HaikuOutputPlugin.hxx"
#include "Compiler.h"
class HaikuMixer final : public Mixer {
/** the base mixer class */
HaikuOutput &self;
public:
HaikuMixer(HaikuOutput &_output, MixerListener &_listener)
:Mixer(haiku_mixer_plugin, _listener),
self(_output) {}
/* virtual methods from class Mixer */
virtual bool Open(gcc_unused Error &error) override {
return true;
}
virtual void Close() override {
}
virtual int GetVolume(Error &error) override;
virtual bool SetVolume(unsigned volume, Error &error) override;
};
static Mixer *
haiku_mixer_init(gcc_unused EventLoop &event_loop, AudioOutput &ao,
MixerListener &listener,
gcc_unused const ConfigBlock &block,
gcc_unused Error &error)
{
return new HaikuMixer((HaikuOutput &)ao, listener);
}
int
HaikuMixer::GetVolume(gcc_unused Error &error)
{
return haiku_output_get_volume(self);
}
bool
HaikuMixer::SetVolume(unsigned volume, gcc_unused Error &error)
{
return haiku_output_set_volume(self, volume);
}
const MixerPlugin haiku_mixer_plugin = {
haiku_mixer_init,
false,
};
......@@ -24,6 +24,7 @@
#include "plugins/AoOutputPlugin.hxx"
#include "plugins/FifoOutputPlugin.hxx"
#include "plugins/httpd/HttpdOutputPlugin.hxx"
#include "plugins/HaikuOutputPlugin.hxx"
#include "plugins/JackOutputPlugin.hxx"
#include "plugins/NullOutputPlugin.hxx"
#include "plugins/OpenALOutputPlugin.hxx"
......@@ -51,6 +52,9 @@ const AudioOutputPlugin *const audio_output_plugins[] = {
#ifdef HAVE_FIFO
&fifo_output_plugin,
#endif
#ifdef HAVE_HAIKU
&haiku_output_plugin,
#endif
#ifdef ENABLE_PIPE_OUTPUT
&pipe_output_plugin,
#endif
......
/*
* Copyright (C) 2003-2015 The Music Player Daemon Project
* http://www.musicpd.org
* Copyright (C) 2014-2015 François 'mmu_man' Revol
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_HAIKU_OUTPUT_PLUGIN_HXX
#define MPD_HAIKU_OUTPUT_PLUGIN_HXX
class HaikuOutput;
extern const struct AudioOutputPlugin haiku_output_plugin;
int
haiku_output_get_volume(HaikuOutput &haiku);
bool
haiku_output_set_volume(HaikuOutput &haiku, unsigned volume);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment