aboutsummaryrefslogtreecommitdiffstats
path: root/src/DecoderThread.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/DecoderThread.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/DecoderThread.cxx')
-rw-r--r--src/DecoderThread.cxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/DecoderThread.cxx b/src/DecoderThread.cxx
index f71462bdf..7099b3bd4 100644
--- a/src/DecoderThread.cxx
+++ b/src/DecoderThread.cxx
@@ -23,7 +23,7 @@
#include "DecoderInternal.hxx"
#include "DecoderError.hxx"
#include "DecoderPlugin.hxx"
-#include "Song.hxx"
+#include "DetachedSong.hxx"
#include "system/FatalError.hxx"
#include "Mapper.hxx"
#include "fs/Traits.hxx"
@@ -347,11 +347,10 @@ decoder_run_file(Decoder &decoder, const char *path_fs)
static void
decoder_run_song(DecoderControl &dc,
- const Song &song, const char *uri)
+ const DetachedSong &song, const char *uri)
{
Decoder decoder(dc, dc.start_ms > 0,
- song.tag != nullptr && song.IsFile()
- ? new Tag(*song.tag) : nullptr);
+ new Tag(song.GetTag()));
int ret;
dc.state = DecoderState::START;
@@ -381,7 +380,7 @@ decoder_run_song(DecoderControl &dc,
else {
dc.state = DecoderState::ERROR;
- const char *error_uri = song.uri;
+ const char *error_uri = song.GetURI();
const std::string allocated = uri_remove_auth(error_uri);
if (!allocated.empty())
error_uri = allocated.c_str();
@@ -399,10 +398,10 @@ decoder_run(DecoderControl &dc)
dc.ClearError();
assert(dc.song != nullptr);
- const Song &song = *dc.song;
+ const DetachedSong &song = *dc.song;
const std::string uri = song.IsFile()
- ? std::string(map_song_fs(song).c_str())
+ ? map_song_fs(song).c_str()
: song.GetURI();
if (uri.empty()) {