diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-06-07 15:39:28 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-06-07 15:39:28 +1000 |
| commit | e12ac1d9632856237388614bf393c7338500e00a (patch) | |
| tree | 9f353c516427225906eafa9704f312dd12174a46 /src/database | |
| parent | 7e96482087632278c3d9e4a5db6bad25374ada8f (diff) | |
| download | tangara-fw-e12ac1d9632856237388614bf393c7338500e00a.tar.gz | |
Do some prep cleanup for multiple filetypes
Diffstat (limited to 'src/database')
| -rw-r--r-- | src/database/include/song.hpp | 7 | ||||
| -rw-r--r-- | src/database/tag_parser.cpp | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/database/include/song.hpp b/src/database/include/song.hpp index 2791c0ca..d03660dc 100644 --- a/src/database/include/song.hpp +++ b/src/database/include/song.hpp @@ -36,6 +36,9 @@ typedef uint32_t SongId; enum class Encoding { kUnsupported = 0, kMp3 = 1, + kWav = 2, + kOgg = 3, + kFlac = 4, }; /* @@ -53,6 +56,10 @@ struct SongTags { std::optional<std::string> artist; std::optional<std::string> album; + std::optional<int> channels; + std::optional<int> sample_rate; + std::optional<int> bits_per_sample; + /* * Returns a hash of the 'identifying' tags of this song. That is, a hash that * can be used to determine if one song is likely the same as another, across diff --git a/src/database/tag_parser.cpp b/src/database/tag_parser.cpp index d6109671..27d4163f 100644 --- a/src/database/tag_parser.cpp +++ b/src/database/tag_parser.cpp @@ -107,6 +107,16 @@ auto TagParserImpl::ReadAndParseTags(const std::string& path, SongTags* out) out->encoding = Encoding::kUnsupported; } + if (ctx.channels > 0) { + out->channels = ctx.channels; + } + if (ctx.samplerate > 0) { + out->sample_rate = ctx.samplerate; + } + if (ctx.bitrate > 0) { + out->bits_per_sample = ctx.bitrate; + } + return true; } |
