Subsonic API: added bitDepth, samplingRate and channelCount, see https://github.com/opensubsonic/open-subsonic-api/pull/83

This commit is contained in:
emeric
2024-04-14 16:17:45 +02:00
parent b23f38facf
commit 0cda12a8bf
19 changed files with 161 additions and 65 deletions
+10 -2
View File
@@ -88,6 +88,16 @@ namespace lms::metadata
std::unique_ptr<Track> track{ parser.parse(testTags) };
// Audio properties
{
const AudioProperties& audioProperties{ testTags.getAudioProperties() };
EXPECT_EQ(track->audioProperties.bitrate, audioProperties.bitrate);
EXPECT_EQ(track->audioProperties.bitsPerSample, audioProperties.bitsPerSample);
EXPECT_EQ(track->audioProperties.channelCount, audioProperties.channelCount);
EXPECT_EQ(track->audioProperties.duration, audioProperties.duration);
EXPECT_EQ(track->audioProperties.sampleRate, audioProperties.sampleRate);
}
EXPECT_EQ(track->acoustID, core::UUID::fromString("e987a441-e134-4960-8019-274eddacc418"));
EXPECT_EQ(track->artistDisplayName, "MyArtist1 & MyArtist2");
ASSERT_EQ(track->artists.size(), 2);
@@ -97,7 +107,6 @@ namespace lms::metadata
EXPECT_EQ(track->artists[1].name, "MyArtist2");
EXPECT_EQ(track->artists[1].sortName, "MyArtist2SortName");
EXPECT_EQ(track->artists[1].mbid, core::UUID::fromString("5e2cf87f-c8d7-4504-8a86-954dc0840229"));
EXPECT_EQ(track->bitrate, TestTagReader::trackBitrate);
ASSERT_EQ(track->composerArtists.size(), 2);
EXPECT_EQ(track->composerArtists[0].name, "MyComposer1");
EXPECT_EQ(track->composerArtists[0].sortName, "MyComposerSortOrder1");
@@ -112,7 +121,6 @@ namespace lms::metadata
EXPECT_EQ(track->date.year(), 2020);
EXPECT_EQ(track->date.month(), 3);
EXPECT_EQ(track->date.day(), 4);
EXPECT_EQ(track->duration, TestTagReader::trackDuration);
EXPECT_FALSE(track->hasCover);
ASSERT_EQ(track->genres.size(), 2);
EXPECT_EQ(track->genres[0], "Genre1");
+9 -8
View File
@@ -28,10 +28,14 @@ namespace lms::metadata
class TestTagReader : public ITagReader
{
public:
static constexpr std::chrono::milliseconds trackDuration{ 180 };
static constexpr std::size_t trackBitrate{ 128000 };
static constexpr std::size_t trackBitsPerSample{ 16 };
static constexpr std::size_t trackSampleRate{ 44000 };
static constexpr AudioProperties audioProperties
{
.bitrate = 128000,
.bitsPerSample = 16,
.channelCount = 2,
.duration = std::chrono::seconds{180},
.sampleRate = 44000,
};
using Tags = std::unordered_map<TagType, std::vector<std::string_view>>;
using Performers = std::unordered_map<std::string_view, std::vector<std::string_view>>;
@@ -73,10 +77,7 @@ namespace lms::metadata
bool hasEmbeddedCover() const override { return false; };
std::chrono::milliseconds getDuration() const override { return trackDuration; }
std::size_t getBitrate() const override { return trackBitrate; }
std::size_t getBitsPerSample() const override { return trackBitsPerSample; }
std::size_t getSampleRate() const override { return trackSampleRate; }
const AudioProperties& getAudioProperties() const override { return audioProperties; }
private:
const Tags _tags;