summaryrefslogtreecommitdiff
path: root/src/tangara/audio/fatfs_stream_factory.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-07-09 14:41:02 +1000
committerjacqueline <me@jacqueline.id.au>2024-07-09 14:41:02 +1000
commit370d1853b5d099de28c032def4ce3e53b7d735ad (patch)
tree062b6dea507082d28c7bfc2feb7ced450bcd64c8 /src/tangara/audio/fatfs_stream_factory.cpp
parent41e0605f17a784e8f125b3ad10ddfe5ef63337d9 (diff)
downloadtangara-fw-370d1853b5d099de28c032def4ce3e53b7d735ad.tar.gz
Break FatfsStreamFactory's dep on ServiceLocator
Diffstat (limited to 'src/tangara/audio/fatfs_stream_factory.cpp')
-rw-r--r--src/tangara/audio/fatfs_stream_factory.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tangara/audio/fatfs_stream_factory.cpp b/src/tangara/audio/fatfs_stream_factory.cpp
index 80677b2d..735ec134 100644
--- a/src/tangara/audio/fatfs_stream_factory.cpp
+++ b/src/tangara/audio/fatfs_stream_factory.cpp
@@ -10,7 +10,6 @@
#include <memory>
#include <string>
-#include "database/database.hpp"
#include "esp_log.h"
#include "ff.h"
#include "freertos/portmacro.h"
@@ -19,10 +18,10 @@
#include "audio/audio_source.hpp"
#include "audio/fatfs_source.hpp"
#include "codec.hpp"
+#include "database/database.hpp"
#include "database/tag_parser.hpp"
#include "database/track.hpp"
#include "drivers/spi.hpp"
-#include "system_fsm/service_locator.hpp"
#include "tasks.hpp"
#include "types.hpp"
@@ -30,12 +29,13 @@
namespace audio {
-FatfsStreamFactory::FatfsStreamFactory(system_fsm::ServiceLocator& services)
- : services_(services) {}
+FatfsStreamFactory::FatfsStreamFactory(database::Handle&& handle,
+ database::ITagParser& parser)
+ : db_(handle), tag_parser_(parser) {}
auto FatfsStreamFactory::create(database::TrackId id, uint32_t offset)
-> std::shared_ptr<TaggedStream> {
- auto db = services_.database().lock();
+ auto db = db_.lock();
if (!db) {
return {};
}
@@ -48,7 +48,7 @@ auto FatfsStreamFactory::create(database::TrackId id, uint32_t offset)
auto FatfsStreamFactory::create(std::string path, uint32_t offset)
-> std::shared_ptr<TaggedStream> {
- auto tags = services_.tag_parser().ReadAndParseTags(path);
+ auto tags = tag_parser_.ReadAndParseTags(path);
if (!tags) {
ESP_LOGE(kTag, "failed to read tags");
return {};