You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
954 B
C++

#include "decoder.hpp"
#include <iostream>
using namespace std::string_literals;
void Decoder::PrintHelp()
{
std::cerr <<
"--decoder=DECODER: Select decoder (freesurround, ffdshow, dummy)\n\n"
"Freesurround options:\n";
::PrintHelp(FreesurroundWrapper{}.GetOptions());
std::cerr << "\nFfdshow options:\n";
::PrintHelp(FfdshowDecoder{}.GetOptions());
}
std::vector<struct Option> Decoder::GetOptions()
{
std::vector<Option> res{
{
"decoder", "DECODER", "",
[&](std::string_view sv)
{
if (sv == "freesurround") dec.emplace<FreesurroundWrapper>();
else if (sv == "ffdshow") dec.emplace<FfdshowDecoder>();
else if (sv == "dummy") dec.emplace<DummyDecoder>();
else throw ParseError{"Invalid decoder "s + std::string{sv}};
},
}
};
auto next = std::visit([](auto& x) { return x.GetOptions(); }, dec);
res.insert(res.end(), next.begin(), next.end());
return res;
}