2011-09-16 23:31:48 +02:00
|
|
|
/*
|
2017-01-03 20:48:59 +01:00
|
|
|
* Copyright 2003-2017 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"
|
2017-08-07 21:50:13 +02:00
|
|
|
#include "Filtered.hxx"
|
2011-09-16 23:31:48 +02:00
|
|
|
|
2017-08-07 18:47:39 +02:00
|
|
|
FilteredAudioOutput *
|
2017-01-25 09:47:43 +01:00
|
|
|
ao_plugin_init(EventLoop &event_loop,
|
|
|
|
const AudioOutputPlugin &plugin,
|
2016-11-09 11:56:01 +01:00
|
|
|
const ConfigBlock &block)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
assert(plugin.init != nullptr);
|
2011-09-16 23:31:48 +02:00
|
|
|
|
2017-01-25 09:47:43 +01:00
|
|
|
return plugin.init(event_loop, block);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_finish(FilteredAudioOutput *ao) noexcept
|
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
|
|
|
}
|
|
|
|
|
2016-11-09 11:56:01 +01:00
|
|
|
void
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_enable(FilteredAudioOutput &ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
if (ao.plugin.enable != nullptr)
|
|
|
|
ao.plugin.enable(&ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_disable(FilteredAudioOutput &ao) noexcept
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
if (ao.plugin.disable != nullptr)
|
|
|
|
ao.plugin.disable(&ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
2016-11-09 11:56:01 +01:00
|
|
|
void
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_open(FilteredAudioOutput &ao, AudioFormat &audio_format)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
ao.plugin.open(&ao, audio_format);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_close(FilteredAudioOutput &ao) noexcept
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
ao.plugin.close(&ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
2016-12-28 21:44:18 +01:00
|
|
|
std::chrono::steady_clock::duration
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_delay(FilteredAudioOutput &ao) noexcept
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
return ao.plugin.delay != nullptr
|
|
|
|
? ao.plugin.delay(&ao)
|
2016-12-28 21:44:18 +01:00
|
|
|
: std::chrono::steady_clock::duration::zero();
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_send_tag(FilteredAudioOutput &ao, const Tag &tag)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
if (ao.plugin.send_tag != nullptr)
|
|
|
|
ao.plugin.send_tag(&ao, tag);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_play(FilteredAudioOutput &ao, const void *chunk, size_t size)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
return ao.plugin.play(&ao, chunk, size);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_drain(FilteredAudioOutput &ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
if (ao.plugin.drain != nullptr)
|
|
|
|
ao.plugin.drain(&ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_cancel(FilteredAudioOutput &ao) noexcept
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
if (ao.plugin.cancel != nullptr)
|
|
|
|
ao.plugin.cancel(&ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2017-08-07 18:47:39 +02:00
|
|
|
ao_plugin_pause(FilteredAudioOutput &ao)
|
2011-09-16 23:31:48 +02:00
|
|
|
{
|
2017-01-25 09:48:59 +01:00
|
|
|
return ao.plugin.pause != nullptr && ao.plugin.pause(&ao);
|
2011-09-16 23:31:48 +02:00
|
|
|
}
|