diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-07-15 22:53:30 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-07-15 22:53:30 +0300 |
| commit | 82c81858c65c80fb667e73ffdcc4ff69007cfa17 (patch) | |
| tree | 455bdf7a85f99c770f97d05d53c8ce340c3f7fa0 /src/configuration.cpp | |
| parent | 3938ba31f633d48bb6f4471a3f49ab696a453aee (diff) | |
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.
Diffstat (limited to 'src/configuration.cpp')
| -rw-r--r-- | src/configuration.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
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) { |
