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.cpp (1094B)


      1 #include "decoder.hpp"
      2 
      3 #include <iostream>
      4 
      5 using namespace std::string_literals;
      6 
      7 void Decoder::PrintHelp()
      8 {
      9   std::cerr <<
     10     "--decoder=DECODER: Select decoder (freesurround, ffdshow, pw, dummy)\n\n"
     11     "Freesurround options:\n";
     12   ::PrintHelp(FreesurroundWrapper{}.GetOptions());
     13 
     14   std::cerr << "\nFfdshow options:\n";
     15   ::PrintHelp(FfdshowDecoder{}.GetOptions());
     16 
     17   std::cerr << "\nPW options:\n";
     18   ::PrintHelp(PWDecoder{}.GetOptions());
     19 }
     20 
     21 std::vector<struct Option> Decoder::GetOptions()
     22 {
     23   std::vector<Option> res{
     24     {
     25       "decoder", "DECODER", "",
     26       [&](std::string_view sv)
     27       {
     28         if (sv == "freesurround") dec.emplace<FreesurroundWrapper>();
     29         else if (sv == "ffdshow") dec.emplace<FfdshowDecoder>();
     30         else if (sv == "pw")      dec.emplace<PWDecoder>();
     31         else if (sv == "dummy")   dec.emplace<DummyDecoder>();
     32         else throw ParseError{"Invalid decoder "s + std::string{sv}};
     33       },
     34     }
     35   };
     36   auto next = std::visit([](auto& x) { return x.GetOptions(); }, dec);
     37   res.insert(res.end(), next.begin(), next.end());
     38   return res;
     39 }