From 82c81858c65c80fb667e73ffdcc4ff69007cfa17 Mon Sep 17 00:00:00 2001 From: Vasile Vilvoiu Date: Thu, 15 Jul 2021 22:53:30 +0300 Subject: Support "-" for input/output files as stdin/stdout. Support dumping output file to stdout. Switch logger to stderr, make it multithreaded. Log input/output files. Closes #8, closes #10, closes #13. --- src/configuration.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/configuration.cpp') diff --git a/src/configuration.cpp b/src/configuration.cpp index eeb4da4..abfecfa 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -18,6 +18,7 @@ Configuration::Configuration() { this->input_filename_ = {}; this->output_filename_ = {}; + this->dump_to_stdout_ = false; this->block_size_ = 256; this->rate_ = 44100; @@ -207,14 +208,20 @@ Configuration::FromArgs(int argc, char **argv) /* check and store command line arguments */ if (outfile) { - conf.output_filename_ = args::get(outfile); + if (args::get(outfile) != "-") { /* "-" denotes stdout */ + conf.output_filename_ = args::get(outfile); + } else { + conf.dump_to_stdout_ = true; + } } else if (!live) { - std::cerr << "Either specify file or '--live', otherwise nothing to do." << std::endl; + std::cerr << "Either specify output file name or '--live', otherwise nothing to do." << std::endl; return std::make_tuple(conf, 1, true); } if (infile) { - conf.input_filename_ = args::get(infile); + if (args::get(infile) != "-") { /* "-" denotes stdin */ + conf.input_filename_ = args::get(infile); + } } if (block_size) { if (args::get(block_size) <= 0) { -- cgit v1.2.3