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:
@@ -28,7 +28,8 @@ DetachedSong::DetachedSong(const LightSong &other) noexcept
|
||||
tag(other.tag),
|
||||
mtime(other.mtime),
|
||||
start_time(other.start_time),
|
||||
end_time(other.end_time) {}
|
||||
end_time(other.end_time),
|
||||
audio_format(other.audio_format) {}
|
||||
|
||||
DetachedSong::operator LightSong() const noexcept
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define MPD_DETACHED_SONG_HXX
|
||||
|
||||
#include "tag/Tag.hxx"
|
||||
#include "pcm/AudioFormat.hxx"
|
||||
#include "Chrono.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
@@ -79,6 +80,12 @@ class DetachedSong {
|
||||
*/
|
||||
SongTime end_time = SongTime::zero();
|
||||
|
||||
/**
|
||||
* The audio format of the song, if given by the decoder
|
||||
* plugin. May be undefined if unknown.
|
||||
*/
|
||||
AudioFormat audio_format = AudioFormat::Undefined();
|
||||
|
||||
public:
|
||||
explicit DetachedSong(const char *_uri) noexcept
|
||||
:uri(_uri) {}
|
||||
@@ -231,6 +238,14 @@ public:
|
||||
gcc_pure
|
||||
SignedSongTime GetDuration() const noexcept;
|
||||
|
||||
const AudioFormat &GetAudioFormat() const noexcept {
|
||||
return audio_format;
|
||||
}
|
||||
|
||||
void SetAudioFormat(const AudioFormat &src) noexcept {
|
||||
audio_format = src;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the #tag and #mtime.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user