diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-04-26 08:49:02 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-04-26 08:49:02 +1000 |
| commit | 7972bd4567a99179338259e9e6ce19168c2c0db3 (patch) | |
| tree | f46642afd36011d3d064e022232e77744b82c6ae /src/codecs/include | |
| parent | 4887f3789817f87bf1272af0b52684e3364270c2 (diff) | |
| parent | 5575378c1c8171cd716b79d3ab89df1e56ceb9d3 (diff) | |
| download | tangara-fw-7972bd4567a99179338259e9e6ce19168c2c0db3.tar.gz | |
Merge branch 'main' into leveldb
Diffstat (limited to 'src/codecs/include')
| -rw-r--r-- | src/codecs/include/codec.hpp | 7 | ||||
| -rw-r--r-- | src/codecs/include/mad.hpp | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/codecs/include/codec.hpp b/src/codecs/include/codec.hpp index 6897acf2..4595f877 100644 --- a/src/codecs/include/codec.hpp +++ b/src/codecs/include/codec.hpp @@ -10,6 +10,7 @@ #include "result.hpp" #include "span.hpp" +#include "types.hpp" namespace codecs { @@ -17,7 +18,7 @@ class ICodec { public: virtual ~ICodec() {} - virtual auto CanHandleFile(const std::string& path) -> bool = 0; + virtual auto CanHandleType(StreamType type) -> bool = 0; struct OutputFormat { uint8_t num_channels; @@ -31,7 +32,7 @@ class ICodec { virtual auto ResetForNewStream() -> void = 0; - virtual auto SetInput(cpp::span<std::byte> input) -> void = 0; + virtual auto SetInput(cpp::span<const std::byte> input) -> void = 0; /* * Returns the codec's next read position within the input buffer. If the @@ -63,7 +64,7 @@ class ICodec { enum CreateCodecError { UNKNOWN_EXTENSION }; -auto CreateCodecForFile(const std::string& file) +auto CreateCodecForType(StreamType type) -> cpp::result<std::unique_ptr<ICodec>, CreateCodecError>; } // namespace codecs diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp index 1f5791b9..074784fb 100644 --- a/src/codecs/include/mad.hpp +++ b/src/codecs/include/mad.hpp @@ -17,10 +17,10 @@ class MadMp3Decoder : public ICodec { MadMp3Decoder(); ~MadMp3Decoder(); - auto CanHandleFile(const std::string& path) -> bool override; + auto CanHandleType(StreamType type) -> bool override; auto GetOutputFormat() -> OutputFormat override; auto ResetForNewStream() -> void override; - auto SetInput(cpp::span<std::byte> input) -> void override; + auto SetInput(cpp::span<const std::byte> input) -> void override; auto GetInputPosition() -> std::size_t override; auto ProcessNextFrame() -> cpp::result<bool, ProcessingError> override; auto WriteOutputSamples(cpp::span<std::byte> output) |
