output/fifo: use AudioOutputWrapper::Open(),Close()

This commit is contained in:
Max Kellermann 2015-08-06 09:50:02 +02:00
parent 7dfe841876
commit 4647448399

View File

@ -70,6 +70,9 @@ struct FifoOutput {
bool OpenFifo(Error &error); bool OpenFifo(Error &error);
void CloseFifo(); void CloseFifo();
bool Open(AudioFormat &audio_format, Error &error);
void Close();
unsigned Delay() const; unsigned Delay() const;
size_t Play(const void *chunk, size_t size, Error &error); size_t Play(const void *chunk, size_t size, Error &error);
void Cancel(); void Cancel();
@ -204,23 +207,17 @@ FifoOutput::Create(const ConfigBlock &block, Error &error)
return fd; return fd;
} }
static bool bool
fifo_output_open(AudioOutput *ao, AudioFormat &audio_format, FifoOutput::Open(AudioFormat &audio_format, gcc_unused Error &error)
gcc_unused Error &error)
{ {
FifoOutput *fd = (FifoOutput *)ao; timer = new Timer(audio_format);
fd->timer = new Timer(audio_format);
return true; return true;
} }
static void void
fifo_output_close(AudioOutput *ao) FifoOutput::Close()
{ {
FifoOutput *fd = (FifoOutput *)ao; delete timer;
delete fd->timer;
} }
inline void inline void
@ -287,8 +284,8 @@ const struct AudioOutputPlugin fifo_output_plugin = {
&Wrapper::Finish, &Wrapper::Finish,
nullptr, nullptr,
nullptr, nullptr,
fifo_output_open, &Wrapper::Open,
fifo_output_close, &Wrapper::Close,
&Wrapper::Delay, &Wrapper::Delay,
nullptr, nullptr,
&Wrapper::Play, &Wrapper::Play,