output/alsa: add attributes "dop" and "allowed_formats"
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "AllowedFormat.hxx"
|
||||
#include "AudioParser.hxx"
|
||||
#include "util/IterableSplitString.hxx"
|
||||
#include "util/StringBuffer.hxx"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
@@ -65,4 +66,24 @@ AllowedFormat::ParseList(StringView s)
|
||||
return list;
|
||||
}
|
||||
|
||||
std::string
|
||||
ToString(const std::forward_list<AllowedFormat> &allowed_formats) noexcept
|
||||
{
|
||||
std::string result;
|
||||
|
||||
for (const auto &i : allowed_formats) {
|
||||
if (!result.empty())
|
||||
result.push_back(' ');
|
||||
|
||||
result += ::ToString(i.format);
|
||||
|
||||
#ifdef ENABLE_DSD
|
||||
if (i.dop)
|
||||
result += "=dop";
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Alsa
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "AudioFormat.hxx"
|
||||
|
||||
#include <forward_list>
|
||||
#include <string>
|
||||
|
||||
struct StringView;
|
||||
|
||||
@@ -54,6 +55,9 @@ struct AllowedFormat {
|
||||
static std::forward_list<AllowedFormat> ParseList(StringView s);
|
||||
};
|
||||
|
||||
std::string
|
||||
ToString(const std::forward_list<AllowedFormat> &allowed_formats) noexcept;
|
||||
|
||||
} // namespace Alsa
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user