From a231fd1c8afedbeb14b0bc77d76bad61db986059 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 2 May 2024 17:06:25 +1000 Subject: Replace cpp::span shim with std::span --- src/codecs/include/codec.hpp | 13 +++++-------- src/codecs/include/dr_flac.hpp | 8 ++++---- src/codecs/include/mad.hpp | 4 ++-- src/codecs/include/opus.hpp | 6 +++--- src/codecs/include/source_buffer.hpp | 9 ++++----- src/codecs/include/vorbis.hpp | 6 +++--- src/codecs/include/wav.hpp | 2 +- 7 files changed, 22 insertions(+), 26 deletions(-) (limited to 'src/codecs/include') diff --git a/src/codecs/include/codec.hpp b/src/codecs/include/codec.hpp index e48e3c58..4d588a98 100644 --- a/src/codecs/include/codec.hpp +++ b/src/codecs/include/codec.hpp @@ -6,19 +6,16 @@ #pragma once -#include -#include - #include #include #include #include +#include #include #include #include "result.hpp" #include "sample.hpp" -#include "span.hpp" #include "types.hpp" #include "memory_resource.hpp" @@ -35,7 +32,7 @@ class IStream { auto type() -> StreamType { return t_; } - virtual auto Read(cpp::span dest) -> ssize_t = 0; + virtual auto Read(std::span dest) -> ssize_t = 0; virtual auto CanSeek() -> bool = 0; @@ -54,7 +51,7 @@ class IStream { /* * Called by codecs to indicate that they've finished parsing any header data * within this stream, and are about to begin decoding. - * + * * Currently used as a hint to the readahead stream to begin prefetching file * data. */ @@ -117,7 +114,7 @@ class ICodec { * Decodes metadata or headers from the given input stream, and returns the * format for the samples that will be decoded from it. */ - virtual auto OpenStream(std::shared_ptr input,uint32_t offset) + virtual auto OpenStream(std::shared_ptr input, uint32_t offset) -> cpp::result = 0; struct OutputInfo { @@ -128,7 +125,7 @@ class ICodec { /* * Writes PCM samples to the given output buffer. */ - virtual auto DecodeTo(cpp::span destination) + virtual auto DecodeTo(std::span destination) -> cpp::result = 0; }; diff --git a/src/codecs/include/dr_flac.hpp b/src/codecs/include/dr_flac.hpp index 547876f4..ac46e92f 100644 --- a/src/codecs/include/dr_flac.hpp +++ b/src/codecs/include/dr_flac.hpp @@ -10,13 +10,13 @@ #include #include #include +#include #include #include #include "dr_flac.h" #include "sample.hpp" #include "source_buffer.hpp" -#include "span.hpp" #include "codec.hpp" @@ -27,10 +27,10 @@ class DrFlacDecoder : public ICodec { DrFlacDecoder(); ~DrFlacDecoder(); - auto OpenStream(std::shared_ptr input,uint32_t offset) + auto OpenStream(std::shared_ptr input, uint32_t offset) -> cpp::result override; - auto DecodeTo(cpp::span destination) + auto DecodeTo(std::span destination) -> cpp::result override; DrFlacDecoder(const DrFlacDecoder&) = delete; @@ -38,7 +38,7 @@ class DrFlacDecoder : public ICodec { private: std::shared_ptr input_; - drflac *flac_; + drflac* flac_; }; } // namespace codecs diff --git a/src/codecs/include/mad.hpp b/src/codecs/include/mad.hpp index ead0b2a2..d1d0aac5 100644 --- a/src/codecs/include/mad.hpp +++ b/src/codecs/include/mad.hpp @@ -11,11 +11,11 @@ #include #include #include +#include #include "mad.h" #include "sample.hpp" #include "source_buffer.hpp" -#include "span.hpp" #include "codec.hpp" @@ -29,7 +29,7 @@ class MadMp3Decoder : public ICodec { auto OpenStream(std::shared_ptr input,uint32_t offset) -> cpp::result override; - auto DecodeTo(cpp::span destination) + auto DecodeTo(std::span destination) -> cpp::result override; MadMp3Decoder(const MadMp3Decoder&) = delete; diff --git a/src/codecs/include/opus.hpp b/src/codecs/include/opus.hpp index de2f7131..200b2d44 100644 --- a/src/codecs/include/opus.hpp +++ b/src/codecs/include/opus.hpp @@ -10,12 +10,12 @@ #include #include #include +#include #include #include #include "opusfile.h" #include "sample.hpp" -#include "span.hpp" #include "codec.hpp" @@ -26,10 +26,10 @@ class XiphOpusDecoder : public ICodec { XiphOpusDecoder(); ~XiphOpusDecoder(); - auto OpenStream(std::shared_ptr input,uint32_t offset) + auto OpenStream(std::shared_ptr input, uint32_t offset) -> cpp::result override; - auto DecodeTo(cpp::span destination) + auto DecodeTo(std::span destination) -> cpp::result override; XiphOpusDecoder(const XiphOpusDecoder&) = delete; diff --git a/src/codecs/include/source_buffer.hpp b/src/codecs/include/source_buffer.hpp index 7834834d..6444dd2c 100644 --- a/src/codecs/include/source_buffer.hpp +++ b/src/codecs/include/source_buffer.hpp @@ -9,8 +9,7 @@ #include #include #include - -#include "span.hpp" +#include #include "codec.hpp" @@ -22,15 +21,15 @@ class SourceBuffer { ~SourceBuffer(); auto Refill(IStream* src) -> bool; - auto AddBytes(std::function)> writer) -> void; - auto ConsumeBytes(std::function)> reader) -> void; + auto AddBytes(std::function)> writer) -> void; + auto ConsumeBytes(std::function)> reader) -> void; auto Empty() -> void; SourceBuffer(const SourceBuffer&) = delete; SourceBuffer& operator=(const SourceBuffer&) = delete; private: - const cpp::span buffer_; + const std::span buffer_; size_t bytes_in_buffer_; size_t offset_of_bytes_; }; diff --git a/src/codecs/include/vorbis.hpp b/src/codecs/include/vorbis.hpp index 3cf0f9ce..e6f393dc 100644 --- a/src/codecs/include/vorbis.hpp +++ b/src/codecs/include/vorbis.hpp @@ -10,12 +10,12 @@ #include #include #include +#include #include #include #include "ivorbisfile.h" #include "sample.hpp" -#include "span.hpp" #include "codec.hpp" @@ -26,10 +26,10 @@ class TremorVorbisDecoder : public ICodec { TremorVorbisDecoder(); ~TremorVorbisDecoder(); - auto OpenStream(std::shared_ptr input,uint32_t offset) + auto OpenStream(std::shared_ptr input, uint32_t offset) -> cpp::result override; - auto DecodeTo(cpp::span destination) + auto DecodeTo(std::span destination) -> cpp::result override; TremorVorbisDecoder(const TremorVorbisDecoder&) = delete; diff --git a/src/codecs/include/wav.hpp b/src/codecs/include/wav.hpp index 40138968..c09a3bb3 100644 --- a/src/codecs/include/wav.hpp +++ b/src/codecs/include/wav.hpp @@ -34,7 +34,7 @@ class WavDecoder : public ICodec { auto OpenStream(std::shared_ptr input,uint32_t offset) -> cpp::result override; - auto DecodeTo(cpp::span destination) + auto DecodeTo(std::span destination) -> cpp::result override; WavDecoder(const WavDecoder&) = delete; -- cgit v1.2.3