From 1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 2 May 2024 19:12:26 +1000 Subject: WIP merge cyclically dependent components into one big component --- src/tangara/audio/audio_decoder.hpp | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/tangara/audio/audio_decoder.hpp (limited to 'src/tangara/audio/audio_decoder.hpp') diff --git a/src/tangara/audio/audio_decoder.hpp b/src/tangara/audio/audio_decoder.hpp new file mode 100644 index 00000000..8e955f74 --- /dev/null +++ b/src/tangara/audio/audio_decoder.hpp @@ -0,0 +1,56 @@ +/* + * Copyright 2023 jacqueline + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma once + +#include +#include + +#include "audio_converter.hpp" +#include "audio_events.hpp" +#include "audio_sink.hpp" +#include "audio_source.hpp" +#include "codec.hpp" +#include "track.hpp" +#include "types.hpp" + +namespace audio { + +/* + * Handle to a persistent task that takes bytes from the given source, decodes + * them into sample::Sample (normalised to 16 bit signed PCM), and then + * forwards the resulting stream to the given converter. + */ +class Decoder { + public: + static auto Start(std::shared_ptr source, + std::shared_ptr converter) -> Decoder*; + + auto Main() -> void; + + Decoder(const Decoder&) = delete; + Decoder& operator=(const Decoder&) = delete; + + private: + Decoder(std::shared_ptr source, + std::shared_ptr converter); + + auto BeginDecoding(std::shared_ptr) -> bool; + auto ContinueDecoding() -> bool; + + std::shared_ptr source_; + std::shared_ptr converter_; + + std::shared_ptr stream_; + std::unique_ptr codec_; + + std::optional current_format_; + std::optional current_sink_format_; + + std::span codec_buffer_; +}; + +} // namespace audio -- cgit v1.2.3 From 7d7f7755d17e1e0a2348d75d797097f166b70471 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 2 May 2024 21:41:56 +1000 Subject: start moving include files into subdirs --- src/tangara/audio/audio_decoder.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/tangara/audio/audio_decoder.hpp') diff --git a/src/tangara/audio/audio_decoder.hpp b/src/tangara/audio/audio_decoder.hpp index 8e955f74..dfd6f403 100644 --- a/src/tangara/audio/audio_decoder.hpp +++ b/src/tangara/audio/audio_decoder.hpp @@ -9,12 +9,12 @@ #include #include -#include "audio_converter.hpp" -#include "audio_events.hpp" -#include "audio_sink.hpp" -#include "audio_source.hpp" +#include "audio/audio_converter.hpp" +#include "audio/audio_events.hpp" +#include "audio/audio_sink.hpp" +#include "audio/audio_source.hpp" #include "codec.hpp" -#include "track.hpp" +#include "database/track.hpp" #include "types.hpp" namespace audio { -- cgit v1.2.3