diff options
author | Stefan Pöschel <github@basicmaster.de> | 2017-08-23 22:04:41 +0200 |
---|---|---|
committer | Stefan Pöschel <github@basicmaster.de> | 2017-08-23 22:04:41 +0200 |
commit | 6a835162ecafe48609aa866a800289670a0c9f3c (patch) | |
tree | ec787be45c247f868e69bd524420c45eb8b03c2d /src | |
parent | 0de7167c78eae8066996aa3cb86dbfefd5cfcb63 (diff) | |
download | ODR-PadEnc-6a835162ecafe48609aa866a800289670a0c9f3c.tar.gz ODR-PadEnc-6a835162ecafe48609aa866a800289670a0c9f3c.tar.bz2 ODR-PadEnc-6a835162ecafe48609aa866a800289670a0c9f3c.zip |
Small refactorings
Diffstat (limited to 'src')
-rw-r--r-- | src/odr-padenc.cpp | 12 | ||||
-rw-r--r-- | src/odr-padenc.h | 5 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp index 8e8fc7c..9754b8c 100644 --- a/src/odr-padenc.cpp +++ b/src/odr-padenc.cpp @@ -59,12 +59,12 @@ static void usage(const char* name) { fprintf(stderr, " -d, --dir=DIRNAME Directory to read images from.\n" " -e, --erase Erase slides from DIRNAME once they have\n" " been encoded.\n" - " -s, --sleep=DELAY Wait DELAY seconds between each slide\n" + " -s, --sleep=DUR Wait DUR seconds between each slide\n" " Default: %d\n" " -o, --output=FILENAME FIFO to write PAD data into.\n" " Default: %s\n" " -t, --dls=FILENAME FIFO or file to read DLS text from.\n" - " If specified more than once, use next file after DELAY seconds.\n" + " If specified more than once, use next file after slide switch.\n" " -p, --pad=LENGTH Set the PAD length.\n" " Possible values: %s\n" " Default: %zu\n" @@ -300,12 +300,12 @@ int BurstPadEncoder::Encode() { SLSEncoder sls_encoder(&pad_packetizer); SlideStore slides; - std::chrono::steady_clock::time_point next_run = std::chrono::steady_clock::now(); + steady_clock::time_point next_run = steady_clock::now(); int curr_dls_file = 0; while(!do_exit) { // try to read slides dir (if present) - if (options.sls_dir && slides.Empty()) { + if (options.SLSEnabled() && slides.Empty()) { if (!slides.InitFromDir(options.sls_dir)) return 1; } @@ -324,7 +324,7 @@ int BurstPadEncoder::Encode() { // while flushing, insert DLS (if present) after a certain PAD amout while (pad_packetizer.QueueFilled()) { - if (not options.dls_files.empty()) + if (options.DLSEnabled()) dls_encoder.encodeLabel(options.dls_files[curr_dls_file], options.dl_params); pad_packetizer.WriteAllPADs(output_fd, DLS_REPETITION_WHILE_SLS); @@ -332,7 +332,7 @@ int BurstPadEncoder::Encode() { } // encode (a last) DLS (if present) - if (not options.dls_files.empty()) { + if (options.DLSEnabled()) { dls_encoder.encodeLabel(options.dls_files[curr_dls_file], options.dl_params); // switch to next DLS file diff --git a/src/odr-padenc.h b/src/odr-padenc.h index 37c125f..f6f037c 100644 --- a/src/odr-padenc.h +++ b/src/odr-padenc.h @@ -43,6 +43,8 @@ #include "dls.h" #include "sls.h" +using std::chrono::steady_clock; + // --- PadEncoderOptions ----------------------------------------------------------------- struct PadEncoderOptions { @@ -64,6 +66,9 @@ struct PadEncoderOptions { sls_dir(NULL), output("/tmp/pad.fifo") {} + + bool DLSEnabled() {return !dls_files.empty();} + bool SLSEnabled() {return sls_dir;} }; |