2011-09-16 23:31:48 +02:00
|
|
|
/*
|
2014-01-13 22:30:36 +01:00
|
|
|
* Copyright (C) 2003-2014 The Music Player Daemon Project
|
2011-09-16 23:31:48 +02:00
|
|
|
* http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2011-12-13 19:47:52 +01:00
|
|
|
#include "config.h"
|
2013-04-17 01:12:05 +02:00
|
|
|
#include "OutputPlugin.hxx"
|
2014-01-28 11:42:54 +01:00
|
|
|
#include "Internal.hxx"
|
2011-09-16 23:31:48 +02:00
|
|
|
|
2014-01-28 11:34:09 +01:00
|
|
|
AudioOutput *
|
2014-01-28 11:22:27 +01:00
|
|
|
ao_plugin_init(const AudioOutputPlugin *plugin,
|
2013-08-04 12:25:08 +02:00
|
|
|
const config_param ¶m,
|
2013-08-10 18:02:44 +02:00
|
|
|
Error &error)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2013-10-19 18:19:03 +02:00
|
|
|
assert(plugin != nullptr);
|
|
|
|
assert(plugin->init != nullptr);
|
2011-09-16 23:31:48 +02:00
|
|
|
|
|
|
|
return plugin->init(param, error);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_finish(AudioOutput *ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
ao->plugin.finish(ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_enable(AudioOutput *ao, Error &error_r)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
return ao->plugin.enable != nullptr
|
|
|
|
? ao->plugin.enable(ao, error_r)
|
2011-09-16 23:31:48 +02:00
|
|
|
: true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_disable(AudioOutput *ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
if (ao->plugin.disable != nullptr)
|
|
|
|
ao->plugin.disable(ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_open(AudioOutput *ao, AudioFormat &audio_format,
|
2013-08-10 18:02:44 +02:00
|
|
|
Error &error)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
return ao->plugin.open(ao, audio_format, error);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_close(AudioOutput *ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
ao->plugin.close(ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_delay(AudioOutput *ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
return ao->plugin.delay != nullptr
|
|
|
|
? ao->plugin.delay(ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_send_tag(AudioOutput *ao, const Tag *tag)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
if (ao->plugin.send_tag != nullptr)
|
|
|
|
ao->plugin.send_tag(ao, tag);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_play(AudioOutput *ao, const void *chunk, size_t size,
|
2013-08-10 18:02:44 +02:00
|
|
|
Error &error)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
return ao->plugin.play(ao, chunk, size, error);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_drain(AudioOutput *ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
if (ao->plugin.drain != nullptr)
|
|
|
|
ao->plugin.drain(ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_cancel(AudioOutput *ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
if (ao->plugin.cancel != nullptr)
|
|
|
|
ao->plugin.cancel(ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-01-28 11:34:09 +01:00
|
|
|
ao_plugin_pause(AudioOutput *ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2014-01-29 00:53:49 +01:00
|
|
|
return ao->plugin.pause != nullptr && ao->plugin.pause(ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|