player: copy stream tag to the song struct
Non-local songs used to have no tags. If the decoder sends us a tag, we should incorporate it into the song struct. This way, clients can always show the correct song name (if provided by the server).
This commit is contained in:
parent
7e7704e42b
commit
fb233df7a9
|
@ -27,6 +27,7 @@
|
|||
#include "crossfade.h"
|
||||
#include "song.h"
|
||||
#include "pipe.h"
|
||||
#include "idle.h"
|
||||
|
||||
enum xfade_state {
|
||||
XFADE_DISABLED = -1,
|
||||
|
@ -213,15 +214,28 @@ static void processDecodeInput(struct player *player)
|
|||
}
|
||||
|
||||
static int
|
||||
playChunk(struct music_chunk *chunk, const struct audio_format *format,
|
||||
double sizeToTime)
|
||||
playChunk(struct song *song, struct music_chunk *chunk,
|
||||
const struct audio_format *format, double sizeToTime)
|
||||
{
|
||||
pc.elapsedTime = chunk->times;
|
||||
pc.bitRate = chunk->bit_rate;
|
||||
|
||||
if (chunk->tag != NULL)
|
||||
if (chunk->tag != NULL) {
|
||||
sendMetadataToAudioDevice(chunk->tag);
|
||||
|
||||
if (!song_is_file(song)) {
|
||||
/* always update the tag of remote streams */
|
||||
|
||||
if (song->tag != NULL)
|
||||
tag_free(song->tag);
|
||||
song->tag = tag_dup(chunk->tag);
|
||||
|
||||
/* notify all clients that the tag of the
|
||||
current song has changed */
|
||||
idle_add(IDLE_PLAYER);
|
||||
}
|
||||
}
|
||||
|
||||
pcm_volume(chunk->data, chunk->length,
|
||||
format, pc.softwareVolume);
|
||||
|
||||
|
@ -409,8 +423,8 @@ static void do_play(void)
|
|||
}
|
||||
|
||||
/* play the current chunk */
|
||||
if (playChunk(beginChunk, &play_audio_format,
|
||||
sizeToTime) < 0)
|
||||
if (playChunk(player.song, beginChunk,
|
||||
&play_audio_format, sizeToTime) < 0)
|
||||
break;
|
||||
music_pipe_shift();
|
||||
|
||||
|
|
Loading…
Reference in New Issue