diff options
author | Max Kellermann <max@musicpd.org> | 2017-12-20 14:43:29 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-12-20 15:02:14 +0100 |
commit | 25fa3ccade6aa9ab0d03c58ffbe8fee4945a3a3c (patch) | |
tree | 38e1c77cf073a21e6ea7ef4f077b185635461c61 /src/player | |
parent | c6a95395b57e6925d683339c969fa43d2f6b48e3 (diff) |
MusicChunk, player/Thread: use std::unique_ptr<Tag>
Diffstat (limited to 'src/player')
-rw-r--r-- | src/player/Thread.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/player/Thread.cxx b/src/player/Thread.cxx index 6ffa3d128..eeb406fce 100644 --- a/src/player/Thread.cxx +++ b/src/player/Thread.cxx @@ -131,7 +131,7 @@ class Player { * postponed, and sent to the output thread when the new song * really begins. */ - Tag *cross_fade_tag = nullptr; + std::unique_ptr<Tag> cross_fade_tag; /** * The current audio format for the audio outputs. @@ -837,10 +837,8 @@ Player::PlayNextChunk() noexcept /* don't send the tags of the new song (which is being faded in) yet; postpone it until the current song is faded out */ - cross_fade_tag = - Tag::MergeReplace(cross_fade_tag, - other_chunk->tag); - other_chunk->tag = nullptr; + cross_fade_tag = Tag::Merge(std::move(cross_fade_tag), + std::move(other_chunk->tag)); if (pc.cross_fade.mixramp_delay <= 0) { chunk->mix_ratio = ((float)cross_fade_position) @@ -889,7 +887,8 @@ Player::PlayNextChunk() noexcept /* insert the postponed tag if cross-fading is finished */ if (xfade_state != CrossFadeState::ACTIVE && cross_fade_tag != nullptr) { - chunk->tag = Tag::MergeReplace(chunk->tag, cross_fade_tag); + chunk->tag = Tag::Merge(std::move(chunk->tag), + std::move(cross_fade_tag)); cross_fade_tag = nullptr; } @@ -1114,7 +1113,7 @@ Player::Run() noexcept ClearAndDeletePipe(); - delete cross_fade_tag; + cross_fade_tag.reset(); if (song != nullptr) { FormatDefault(player_domain, "played \"%s\"", song->GetURI()); |