decoder_api: submit the song tag to the music pipe
When a new song starts playing, send its tag (song->tag) to the music pipe. This allows output plugins to render tags for all songs, not only those with embedded tags understood by the decoder plugin.
This commit is contained in:
parent
99a88988d5
commit
200be26371
@ -189,12 +189,18 @@ update_stream_tag(struct decoder *decoder, struct input_stream *is)
|
|||||||
{
|
{
|
||||||
struct tag *tag;
|
struct tag *tag;
|
||||||
|
|
||||||
if (is == NULL)
|
tag = is != NULL
|
||||||
return false;
|
? input_stream_tag(is)
|
||||||
|
: NULL;
|
||||||
|
if (tag == NULL) {
|
||||||
|
tag = decoder->song_tag;
|
||||||
|
if (tag == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
tag = input_stream_tag(is);
|
/* no stream tag present - submit the song tag
|
||||||
if (tag == NULL)
|
instead */
|
||||||
return false;
|
decoder->song_tag = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (decoder->stream_tag != NULL)
|
if (decoder->stream_tag != NULL)
|
||||||
tag_free(decoder->stream_tag);
|
tag_free(decoder->stream_tag);
|
||||||
|
@ -30,6 +30,13 @@ struct decoder {
|
|||||||
|
|
||||||
bool seeking;
|
bool seeking;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The tag from the song object. This is only used for local
|
||||||
|
* files, because we expect the stream server to send us a new
|
||||||
|
* tag each time we play it.
|
||||||
|
*/
|
||||||
|
struct tag *song_tag;
|
||||||
|
|
||||||
/** the last tag received from the stream */
|
/** the last tag received from the stream */
|
||||||
struct tag *stream_tag;
|
struct tag *stream_tag;
|
||||||
|
|
||||||
|
@ -95,6 +95,8 @@ static void decoder_run_song(const struct song *song, const char *uri)
|
|||||||
}
|
}
|
||||||
|
|
||||||
decoder.seeking = false;
|
decoder.seeking = false;
|
||||||
|
decoder.song_tag = song->tag != NULL && song_is_file(song)
|
||||||
|
? tag_dup(song->tag) : NULL;
|
||||||
decoder.stream_tag = NULL;
|
decoder.stream_tag = NULL;
|
||||||
decoder.decoder_tag = NULL;
|
decoder.decoder_tag = NULL;
|
||||||
decoder.chunk = NULL;
|
decoder.chunk = NULL;
|
||||||
@ -201,6 +203,9 @@ static void decoder_run_song(const struct song *song, const char *uri)
|
|||||||
if (close_instream)
|
if (close_instream)
|
||||||
input_stream_close(&input_stream);
|
input_stream_close(&input_stream);
|
||||||
|
|
||||||
|
if (decoder.song_tag != NULL)
|
||||||
|
tag_free(decoder.song_tag);
|
||||||
|
|
||||||
if (decoder.stream_tag != NULL)
|
if (decoder.stream_tag != NULL)
|
||||||
tag_free(decoder.stream_tag);
|
tag_free(decoder.stream_tag);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user