output/Filtered: add a few OutputPlugin method wrappers
This commit is contained in:
parent
5431fca99b
commit
b3eb8489f3
@ -101,9 +101,9 @@ void
|
|||||||
FilteredAudioOutput::CloseOutput(bool drain) noexcept
|
FilteredAudioOutput::CloseOutput(bool drain) noexcept
|
||||||
{
|
{
|
||||||
if (drain)
|
if (drain)
|
||||||
ao_plugin_drain(*this);
|
Drain();
|
||||||
else
|
else
|
||||||
ao_plugin_cancel(*this);
|
Cancel();
|
||||||
|
|
||||||
ao_plugin_close(*this);
|
ao_plugin_close(*this);
|
||||||
}
|
}
|
||||||
@ -131,10 +131,40 @@ FilteredAudioOutput::Close(bool drain) noexcept
|
|||||||
FormatDebug(output_domain, "closed %s", GetLogName());
|
FormatDebug(output_domain, "closed %s", GetLogName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::chrono::steady_clock::duration
|
||||||
|
FilteredAudioOutput::Delay() noexcept
|
||||||
|
{
|
||||||
|
return ao_plugin_delay(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FilteredAudioOutput::SendTag(const Tag &tag)
|
||||||
|
{
|
||||||
|
ao_plugin_send_tag(*this, tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
FilteredAudioOutput::Play(const void *data, size_t size)
|
||||||
|
{
|
||||||
|
return ao_plugin_play(*this, data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FilteredAudioOutput::Drain()
|
||||||
|
{
|
||||||
|
ao_plugin_drain(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FilteredAudioOutput::Cancel() noexcept
|
||||||
|
{
|
||||||
|
ao_plugin_cancel(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FilteredAudioOutput::BeginPause() noexcept
|
FilteredAudioOutput::BeginPause() noexcept
|
||||||
{
|
{
|
||||||
ao_plugin_cancel(*this);
|
Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "filter/Observer.hxx"
|
#include "filter/Observer.hxx"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
class PreparedFilter;
|
class PreparedFilter;
|
||||||
class MusicPipe;
|
class MusicPipe;
|
||||||
@ -34,6 +35,7 @@ struct MusicChunk;
|
|||||||
struct ConfigBlock;
|
struct ConfigBlock;
|
||||||
struct AudioOutputPlugin;
|
struct AudioOutputPlugin;
|
||||||
struct ReplayGainConfig;
|
struct ReplayGainConfig;
|
||||||
|
struct Tag;
|
||||||
|
|
||||||
struct FilteredAudioOutput {
|
struct FilteredAudioOutput {
|
||||||
/**
|
/**
|
||||||
@ -186,6 +188,16 @@ public:
|
|||||||
*/
|
*/
|
||||||
void CloseSoftwareMixer() noexcept;
|
void CloseSoftwareMixer() noexcept;
|
||||||
|
|
||||||
|
gcc_pure
|
||||||
|
std::chrono::steady_clock::duration Delay() noexcept;
|
||||||
|
|
||||||
|
void SendTag(const Tag &tag);
|
||||||
|
|
||||||
|
size_t Play(const void *data, size_t size);
|
||||||
|
|
||||||
|
void Drain();
|
||||||
|
void Cancel() noexcept;
|
||||||
|
|
||||||
void BeginPause() noexcept;
|
void BeginPause() noexcept;
|
||||||
bool IteratePause() noexcept;
|
bool IteratePause() noexcept;
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include "Control.hxx"
|
#include "Control.hxx"
|
||||||
#include "Filtered.hxx"
|
#include "Filtered.hxx"
|
||||||
#include "Client.hxx"
|
#include "Client.hxx"
|
||||||
#include "OutputPlugin.hxx"
|
|
||||||
#include "Domain.hxx"
|
#include "Domain.hxx"
|
||||||
#include "notify.hxx"
|
#include "notify.hxx"
|
||||||
#include "mixer/MixerInternal.hxx"
|
#include "mixer/MixerInternal.hxx"
|
||||||
@ -217,7 +216,7 @@ inline bool
|
|||||||
AudioOutputControl::WaitForDelay() noexcept
|
AudioOutputControl::WaitForDelay() noexcept
|
||||||
{
|
{
|
||||||
while (true) {
|
while (true) {
|
||||||
const auto delay = ao_plugin_delay(*output);
|
const auto delay = output->Delay();
|
||||||
if (delay <= std::chrono::steady_clock::duration::zero())
|
if (delay <= std::chrono::steady_clock::duration::zero())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -251,7 +250,7 @@ AudioOutputControl::PlayChunk() noexcept
|
|||||||
if (tag != nullptr) {
|
if (tag != nullptr) {
|
||||||
const ScopeUnlock unlock(mutex);
|
const ScopeUnlock unlock(mutex);
|
||||||
try {
|
try {
|
||||||
ao_plugin_send_tag(*output, *tag);
|
output->SendTag(*tag);
|
||||||
} catch (const std::runtime_error &e) {
|
} catch (const std::runtime_error &e) {
|
||||||
FormatError(e, "Failed to send tag to %s",
|
FormatError(e, "Failed to send tag to %s",
|
||||||
GetLogName());
|
GetLogName());
|
||||||
@ -273,7 +272,7 @@ AudioOutputControl::PlayChunk() noexcept
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const ScopeUnlock unlock(mutex);
|
const ScopeUnlock unlock(mutex);
|
||||||
nbytes = ao_plugin_play(*output, data.data, data.size);
|
nbytes = output->Play(data.data, data.size);
|
||||||
assert(nbytes <= data.size);
|
assert(nbytes <= data.size);
|
||||||
} catch (const std::runtime_error &e) {
|
} catch (const std::runtime_error &e) {
|
||||||
FormatError(e, "Failed to play on %s", GetLogName());
|
FormatError(e, "Failed to play on %s", GetLogName());
|
||||||
@ -438,7 +437,7 @@ AudioOutputControl::Task()
|
|||||||
case Command::DRAIN:
|
case Command::DRAIN:
|
||||||
if (open) {
|
if (open) {
|
||||||
const ScopeUnlock unlock(mutex);
|
const ScopeUnlock unlock(mutex);
|
||||||
ao_plugin_drain(*output);
|
output->Drain();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandFinished();
|
CommandFinished();
|
||||||
@ -449,7 +448,7 @@ AudioOutputControl::Task()
|
|||||||
|
|
||||||
if (open) {
|
if (open) {
|
||||||
const ScopeUnlock unlock(mutex);
|
const ScopeUnlock unlock(mutex);
|
||||||
ao_plugin_cancel(*output);
|
output->Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandFinished();
|
CommandFinished();
|
||||||
|
Loading…
Reference in New Issue
Block a user