diff options
author | Max Kellermann <max@duempel.org> | 2013-07-30 20:11:57 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-07-30 20:19:53 +0200 |
commit | 06f898cc1240a29b293de0e97ad95a4fdc971254 (patch) | |
tree | 001a6d3db039cdc03323f3bfddc13b94bde31ce4 /src/PlayerThread.cxx | |
parent | 6a9ab8bc0e2f5d34803513bb2d94d041a607a58c (diff) | |
download | mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.tar.gz mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.tar.xz mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.zip |
tag: convert to C++
Diffstat (limited to 'src/PlayerThread.cxx')
-rw-r--r-- | src/PlayerThread.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx index 3033bce51..d838d4ba9 100644 --- a/src/PlayerThread.cxx +++ b/src/PlayerThread.cxx @@ -30,7 +30,7 @@ #include "CrossFade.hxx" #include "PlayerControl.hxx" #include "OutputAll.hxx" -#include "tag.h" +#include "Tag.hxx" #include "Idle.hxx" #include "GlobalEvents.hxx" @@ -38,6 +38,8 @@ #include <glib.h> +#include <string.h> + #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "player_thread" @@ -108,7 +110,7 @@ struct player { * postponed, and sent to the output thread when the new song * really begins. */ - struct tag *cross_fade_tag; + Tag *cross_fade_tag; /** * The current audio format for the audio outputs. @@ -656,18 +658,17 @@ static void player_process_command(struct player *player) } static void -update_song_tag(Song *song, const struct tag *new_tag) +update_song_tag(Song *song, const Tag &new_tag) { if (song->IsFile()) /* don't update tags of local files, only remote streams may change tags dynamically */ return; - struct tag *old_tag = song->tag; - song->tag = tag_dup(new_tag); + Tag *old_tag = song->tag; + song->tag = new Tag(new_tag); - if (old_tag != NULL) - tag_free(old_tag); + delete old_tag; /* the main thread will update the playlist version when he receives this event */ @@ -694,7 +695,7 @@ play_chunk(struct player_control *pc, assert(chunk->CheckFormat(*format)); if (chunk->tag != NULL) - update_song_tag(song, chunk->tag); + update_song_tag(song, *chunk->tag); if (chunk->length == 0) { music_buffer_return(player_buffer, chunk); @@ -760,7 +761,7 @@ play_next_chunk(struct player *player) is being faded in) yet; postpone it until the current song is faded out */ player->cross_fade_tag = - tag_merge_replace(player->cross_fade_tag, + Tag::MergeReplace(player->cross_fade_tag, other_chunk->tag); other_chunk->tag = NULL; @@ -815,7 +816,7 @@ play_next_chunk(struct player *player) /* insert the postponed tag if cross-fading is finished */ if (player->xfade != XFADE_ENABLED && player->cross_fade_tag != NULL) { - chunk->tag = tag_merge_replace(chunk->tag, + chunk->tag = Tag::MergeReplace(chunk->tag, player->cross_fade_tag); player->cross_fade_tag = NULL; } @@ -1080,8 +1081,7 @@ static void do_play(struct player_control *pc, struct decoder_control *dc) music_pipe_clear(player.pipe, player_buffer); music_pipe_free(player.pipe); - if (player.cross_fade_tag != NULL) - tag_free(player.cross_fade_tag); + delete player.cross_fade_tag; if (player.song != NULL) player.song->Free(); |