On Wed, Jun 22, 2016 at 11:02:44AM +0200, Max Kellermann wrote:
> On 2016/06/22 10:57, Dimitris Papastamos <[email protected]> wrote:
> > >From 43cb9a089363301636317446765f7ca689d6b8c5 Mon Sep 17 00:00:00 2001
> > From: sin <[email protected]>
> > Date: Wed, 22 Jun 2016 09:41:54 +0100
> > Subject: [PATCH] sndio: Add option to select output device
> 
> Merged.
> 
> I just noticed that you're using a Timer in your plugin code.  Why?

Thanks.

Must have been an oversight when I looked at other plugin code.
The patch below removes the timer usage.

From f451c6d5d57c6a715256520e5bcbea681210f923 Mon Sep 17 00:00:00 2001
From: Dimitris Papastamos <[email protected]>
Date: Wed, 22 Jun 2016 10:07:52 +0100
Subject: [PATCH] sndio: No need to use a timer so get rid of it

---
 src/output/plugins/SndioOutputPlugin.cxx | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/src/output/plugins/SndioOutputPlugin.cxx 
b/src/output/plugins/SndioOutputPlugin.cxx
index 0109126..e9e839e 100644
--- a/src/output/plugins/SndioOutputPlugin.cxx
+++ b/src/output/plugins/SndioOutputPlugin.cxx
@@ -27,7 +27,6 @@
 #include "config/ConfigError.hxx"
 #include "../OutputAPI.hxx"
 #include "../Wrapper.hxx"
-#include "../Timer.hxx"
 #include "util/Error.hxx"
 #include "util/Domain.hxx"
 #include "Log.hxx"
@@ -37,7 +36,6 @@ class SndioOutput {
        AudioOutput base;
        const char *device;
        struct sio_hdl *sio_hdl;
-       Timer *timer;
 
 public:
        SndioOutput()
@@ -156,7 +154,6 @@ SndioOutput::Open(AudioFormat &audio_format, gcc_unused 
Error &error)
                goto err;
        }
 
-       timer = new Timer(audio_format);
        return true;
 err:
        sio_close(sio_hdl);
@@ -169,15 +166,6 @@ SndioOutput::Close()
 {
        if (sio_hdl)
                sio_close(sio_hdl);
-       delete timer;
-}
-
-unsigned
-SndioOutput::Delay() const
-{
-       return timer->IsStarted()
-               ? timer->GetDelay()
-               : 0;
 }
 
 size_t
@@ -185,10 +173,6 @@ SndioOutput::Play(const void *chunk, size_t size, Error 
&error)
 {
        ssize_t n;
 
-       if (!timer->IsStarted())
-               timer->Start();
-       timer->Add(size);
-
        while (1) {
                n = sio_write(sio_hdl, chunk, size);
                if (n < 0) {
@@ -201,12 +185,6 @@ SndioOutput::Play(const void *chunk, size_t size, Error 
&error)
        }
 }
 
-void
-SndioOutput::Cancel()
-{
-       timer->Reset();
-}
-
 typedef AudioOutputWrapper<SndioOutput> Wrapper;
 
 const struct AudioOutputPlugin sndio_output_plugin = {
@@ -218,11 +196,11 @@ const struct AudioOutputPlugin sndio_output_plugin = {
        nullptr,
        &Wrapper::Open,
        &Wrapper::Close,
-       &Wrapper::Delay,
+       nullptr,
        nullptr,
        &Wrapper::Play,
        nullptr,
-       &Wrapper::Cancel,
+       nullptr,
        nullptr,
        nullptr,
 };
-- 
2.8.4


_______________________________________________
mpd-devel mailing list
[email protected]
http://mailman.blarg.de/listinfo/mpd-devel

Reply via email to