song/DetachedSong: copy the AudioFormat from LightSong

Enables the "Format" row in "playlistinfo" responses.

https://github.com/MusicPlayerDaemon/MPD/issues/1094
This commit is contained in:
Max Kellermann
2021-02-18 21:59:47 +01:00
parent 81d0c04ed4
commit c729f16dcd
10 changed files with 40 additions and 18 deletions

View File

@@ -168,15 +168,12 @@ directory_load(TextFile &file, Directory &directory)
throw FormatRuntimeError("Duplicate song '%s'", name);
std::string target;
auto audio_format = AudioFormat::Undefined();
auto detached_song = song_load(file, name,
&target,
&audio_format);
&target);
auto song = std::make_unique<Song>(std::move(detached_song),
directory);
song->target = std::move(target);
song->audio_format = audio_format;
directory.AddSong(std::move(song));
} else if ((p = StringAfterPrefix(line, PLAYLIST_META_BEGIN))) {