surroundize

Tool/PipeWire filter to convert stereo audio to surround
git clone https://git.neptards.moe/u3shit/surroundize.git
Log | Files | Refs | README | LICENSE

decoder.hpp (1115B)


      1 #ifndef GUARD_TAPERINGLY_POSTDEPOSITIONAL_FULL_CIRCLE_FALLS_DUE_8972
      2 #define GUARD_TAPERINGLY_POSTDEPOSITIONAL_FULL_CIRCLE_FALLS_DUE_8972
      3 #pragma once
      4 
      5 #include "dummy_decoder.hpp"
      6 #include "ffdshow/ffdshow_decoder.hpp"
      7 #include "freesurround_wrapper.hpp"
      8 #include "pw_decoder.hpp"
      9 
     10 #include <variant>
     11 
     12 class Decoder
     13 {
     14 public:
     15   void Init(float rate) { std::visit([&](auto& x) { x.Init(rate); }, dec); }
     16 
     17   [[nodiscard]] std::span<const float> Decode(std::span<const float> in)
     18   { return std::visit([&](auto& x) { return x.Decode(in); }, dec); }
     19 
     20   [[nodiscard]] unsigned GetBlockSize() const noexcept
     21   { return std::visit([](auto& x) { return x.GetBlockSize(); }, dec); }
     22 
     23   [[nodiscard]] std::vector<Channel::E> GetChannels() const
     24   { return std::visit([](auto& x) { return x.GetChannels(); }, dec); }
     25 
     26   [[nodiscard]] uint32_t GetDelay() const noexcept
     27   { return std::visit([](auto& x) { return x.GetDelay(); }, dec); }
     28 
     29   static void PrintHelp();
     30   [[nodiscard]] std::vector<struct Option> GetOptions();
     31 
     32 private:
     33   std::variant<FreesurroundWrapper, FfdshowDecoder, PWDecoder, DummyDecoder> dec;
     34 };
     35 
     36 #endif