aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderControl.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-07 21:39:47 +0100
committerMax Kellermann <max@duempel.org>2014-01-09 09:05:58 +0100
commit322b0616322760dc162447563d8f4da7e024ca90 (patch)
tree2f87cb3ce061556161797aba9f57ee08de5b9e21 /src/DecoderControl.cxx
parent43847f2244a34064af24704aac4cfad4a3c76f7d (diff)
downloadmpd-322b0616322760dc162447563d8f4da7e024ca90.tar.gz
mpd-322b0616322760dc162447563d8f4da7e024ca90.tar.xz
mpd-322b0616322760dc162447563d8f4da7e024ca90.zip
DetachedSong: fork of struct Song
From now on, struct Song will be used by the database only, and DetachedSong will be used by everybody else. DetachedSong is easier to use, but Song has lower overhead.
Diffstat (limited to 'src/DecoderControl.cxx')
-rw-r--r--src/DecoderControl.cxx15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/DecoderControl.cxx b/src/DecoderControl.cxx
index b63dba3a0..4e5e894e3 100644
--- a/src/DecoderControl.cxx
+++ b/src/DecoderControl.cxx
@@ -20,7 +20,7 @@
#include "config.h"
#include "DecoderControl.hxx"
#include "MusicPipe.hxx"
-#include "Song.hxx"
+#include "DetachedSong.hxx"
#include <assert.h>
@@ -36,8 +36,7 @@ DecoderControl::~DecoderControl()
{
ClearError();
- if (song != nullptr)
- song->Free();
+ delete song;
}
void
@@ -53,7 +52,7 @@ DecoderControl::WaitForDecoder()
}
bool
-DecoderControl::IsCurrentSong(const Song &_song) const
+DecoderControl::IsCurrentSong(const DetachedSong &_song) const
{
switch (state) {
case DecoderState::STOP:
@@ -62,7 +61,7 @@ DecoderControl::IsCurrentSong(const Song &_song) const
case DecoderState::START:
case DecoderState::DECODE:
- return SongEquals(*song, _song);
+ return song->IsSame(_song);
}
assert(false);
@@ -70,16 +69,14 @@ DecoderControl::IsCurrentSong(const Song &_song) const
}
void
-DecoderControl::Start(Song *_song,
+DecoderControl::Start(DetachedSong *_song,
unsigned _start_ms, unsigned _end_ms,
MusicBuffer &_buffer, MusicPipe &_pipe)
{
assert(_song != nullptr);
assert(_pipe.IsEmpty());
- if (song != nullptr)
- song->Free();
-
+ delete song;
song = _song;
start_ms = _start_ms;
end_ms = _end_ms;