diff options
author | Denis Krjuchkov <denis@crazydev.net> | 2013-05-12 19:03:42 +0600 |
---|---|---|
committer | Denis Krjuchkov <denis@crazydev.net> | 2013-05-12 19:03:42 +0600 |
commit | 49a3845135142ada6d581d5a6f4a5192aaed49be (patch) | |
tree | 67dd709c03fb8cc18377ad74d09da512a217f42a /src/output/FifoOutputPlugin.cxx | |
parent | 21dac6c05ddff1ce130843a82127618f9ed766a7 (diff) | |
download | mpd-49a3845135142ada6d581d5a6f4a5192aaed49be.tar.gz mpd-49a3845135142ada6d581d5a6f4a5192aaed49be.tar.xz mpd-49a3845135142ada6d581d5a6f4a5192aaed49be.zip |
timer: convert to class
Diffstat (limited to '')
-rw-r--r-- | src/output/FifoOutputPlugin.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/output/FifoOutputPlugin.cxx b/src/output/FifoOutputPlugin.cxx index ebebc254f..15b107c45 100644 --- a/src/output/FifoOutputPlugin.cxx +++ b/src/output/FifoOutputPlugin.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "FifoOutputPlugin.hxx" #include "output_api.h" -#include "timer.h" +#include "Timer.hxx" #include "fd_util.h" #include "open.h" @@ -44,7 +44,7 @@ struct FifoOutput { int input; int output; bool created; - struct timer *timer; + Timer *timer; FifoOutput() :path(nullptr), input(-1), output(-1), created(false) {} @@ -232,7 +232,7 @@ fifo_output_open(struct audio_output *ao, struct audio_format *audio_format, { FifoOutput *fd = (FifoOutput *)ao; - fd->timer = timer_new(audio_format); + fd->timer = new Timer(*audio_format); return true; } @@ -242,7 +242,7 @@ fifo_output_close(struct audio_output *ao) { FifoOutput *fd = (FifoOutput *)ao; - timer_free(fd->timer); + delete fd->timer; } static void @@ -252,7 +252,7 @@ fifo_output_cancel(struct audio_output *ao) char buf[FIFO_BUFFER_SIZE]; int bytes = 1; - timer_reset(fd->timer); + fd->timer->Reset(); while (bytes > 0 && errno != EINTR) bytes = read(fd->input, buf, FIFO_BUFFER_SIZE); @@ -268,8 +268,8 @@ fifo_output_delay(struct audio_output *ao) { FifoOutput *fd = (FifoOutput *)ao; - return fd->timer->started - ? timer_delay(fd->timer) + return fd->timer->IsStarted() + ? fd->timer->GetDelay() : 0; } @@ -280,9 +280,9 @@ fifo_output_play(struct audio_output *ao, const void *chunk, size_t size, FifoOutput *fd = (FifoOutput *)ao; ssize_t bytes; - if (!fd->timer->started) - timer_start(fd->timer); - timer_add(fd->timer, size); + if (!fd->timer->IsStarted()) + fd->timer->Start(); + fd->timer->Add(size); while (true) { bytes = write(fd->output, chunk, size); |