aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/output/FifoOutputPlugin.cxx20
-rw-r--r--src/output/HttpdInternal.hxx6
-rw-r--r--src/output/HttpdOutputPlugin.cxx16
-rw-r--r--src/output/NullOutputPlugin.cxx22
4 files changed, 32 insertions, 32 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);
diff --git a/src/output/HttpdInternal.hxx b/src/output/HttpdInternal.hxx
index e79b9a224..b79a22905 100644
--- a/src/output/HttpdInternal.hxx
+++ b/src/output/HttpdInternal.hxx
@@ -26,7 +26,7 @@
#define MPD_OUTPUT_HTTPD_INTERNAL_H
#include "OutputInternal.hxx"
-#include "timer.h"
+#include "Timer.hxx"
#include "thread/Mutex.hxx"
#include "event/ServerSocket.hxx"
@@ -72,10 +72,10 @@ struct HttpdOutput final : private ServerSocket {
mutable Mutex mutex;
/**
- * A #timer object to synchronize this output with the
+ * A #Timer object to synchronize this output with the
* wallclock.
*/
- struct timer *timer;
+ Timer *timer;
/**
* The header page, which is sent to every client on connect.
diff --git a/src/output/HttpdOutputPlugin.cxx b/src/output/HttpdOutputPlugin.cxx
index bb644c318..2c4884827 100644
--- a/src/output/HttpdOutputPlugin.cxx
+++ b/src/output/HttpdOutputPlugin.cxx
@@ -320,7 +320,7 @@ HttpdOutput::Open(struct audio_format *audio_format, GError **error_r)
/* initialize other attributes */
clients_cnt = 0;
- timer = timer_new(audio_format);
+ timer = new Timer(*audio_format);
open = true;
@@ -346,7 +346,7 @@ HttpdOutput::Close()
open = false;
- timer_free(timer);
+ delete timer;
clients.clear();
@@ -398,7 +398,7 @@ httpd_output_delay(struct audio_output *ao)
then httpd_output_pause() will not do anything, it
will not fill the buffer and it will not update the
timer; therefore, we reset the timer here */
- timer_reset(httpd->timer);
+ httpd->timer->Reset();
/* some arbitrary delay that is long enough to avoid
consuming too much CPU, and short enough to notice
@@ -406,8 +406,8 @@ httpd_output_delay(struct audio_output *ao)
return 1000;
}
- return httpd->timer->started
- ? timer_delay(httpd->timer)
+ return httpd->timer->IsStarted()
+ ? httpd->timer->GetDelay()
: 0;
}
@@ -463,9 +463,9 @@ httpd_output_play(struct audio_output *ao, const void *chunk, size_t size,
return 0;
}
- if (!httpd->timer->started)
- timer_start(httpd->timer);
- timer_add(httpd->timer, size);
+ if (!httpd->timer->IsStarted())
+ httpd->timer->Start();
+ httpd->timer->Add(size);
return size;
}
diff --git a/src/output/NullOutputPlugin.cxx b/src/output/NullOutputPlugin.cxx
index bbcf26c00..b167032b6 100644
--- a/src/output/NullOutputPlugin.cxx
+++ b/src/output/NullOutputPlugin.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "NullOutputPlugin.hxx"
#include "output_api.h"
-#include "timer.h"
+#include "Timer.hxx"
#include <assert.h>
@@ -29,7 +29,7 @@ struct NullOutput {
bool sync;
- struct timer *timer;
+ Timer *timer;
bool Initialize(const config_param *param, GError **error_r) {
return ao_base_init(&base, &null_output_plugin, param,
@@ -72,7 +72,7 @@ null_open(struct audio_output *ao, struct audio_format *audio_format,
NullOutput *nd = (NullOutput *)ao;
if (nd->sync)
- nd->timer = timer_new(audio_format);
+ nd->timer = new Timer(*audio_format);
return true;
}
@@ -83,7 +83,7 @@ null_close(struct audio_output *ao)
NullOutput *nd = (NullOutput *)ao;
if (nd->sync)
- timer_free(nd->timer);
+ delete nd->timer;
}
static unsigned
@@ -91,8 +91,8 @@ null_delay(struct audio_output *ao)
{
NullOutput *nd = (NullOutput *)ao;
- return nd->sync && nd->timer->started
- ? timer_delay(nd->timer)
+ return nd->sync && nd->timer->IsStarted()
+ ? nd->timer->GetDelay()
: 0;
}
@@ -101,14 +101,14 @@ null_play(struct audio_output *ao, gcc_unused const void *chunk, size_t size,
gcc_unused GError **error)
{
NullOutput *nd = (NullOutput *)ao;
- struct timer *timer = nd->timer;
+ Timer *timer = nd->timer;
if (!nd->sync)
return size;
- if (!timer->started)
- timer_start(timer);
- timer_add(timer, size);
+ if (!timer->IsStarted())
+ timer->Start();
+ timer->Add(size);
return size;
}
@@ -121,7 +121,7 @@ null_cancel(struct audio_output *ao)
if (!nd->sync)
return;
- timer_reset(nd->timer);
+ nd->timer->Reset();
}
const struct audio_output_plugin null_output_plugin = {