aboutsummaryrefslogtreecommitdiffstats
path: root/src/odr-padenc.cpp
diff options
context:
space:
mode:
authorStefan Pöschel <github@basicmaster.de>2018-11-11 18:28:10 +0100
committerStefan Pöschel <github@basicmaster.de>2018-11-11 18:29:43 +0100
commitd91981cfae1b2f1502422347bda24b14e7bb6db2 (patch)
tree0153791fb21b7eb3a8236a0d21232caeb38ea70d /src/odr-padenc.cpp
parent02c200556a41774f8cab6bd118913dfe448d669c (diff)
downloadODR-PadEnc-d91981cfae1b2f1502422347bda24b14e7bb6db2.tar.gz
ODR-PadEnc-d91981cfae1b2f1502422347bda24b14e7bb6db2.tar.bz2
ODR-PadEnc-d91981cfae1b2f1502422347bda24b14e7bb6db2.zip
DLS: add support to request DLS file re-read
A re-read of any of the used DLS files can now be requested by storing a file with the same filename which is suffixed by `.REQUEST_DLS_REREAD`. When the next PAD is going to be encoded and such a file is present, the encoder changes the current DLS file to the related DLS file, if needed (only applies if multiple DLS files are used). The DLS file is re-read and the request file is deleted. The DLS is also immediately inserted into the PAD transmission.
Diffstat (limited to 'src/odr-padenc.cpp')
-rw-r--r--src/odr-padenc.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp
index 379791d..e065755 100644
--- a/src/odr-padenc.cpp
+++ b/src/odr-padenc.cpp
@@ -522,6 +522,23 @@ int UniformPadEncoder::Encode() {
// handle DLS
if (options.DLSEnabled()) {
+ // check for DLS re-read request
+ for (size_t i = 0; i < options.dls_files.size(); i++) {
+ int reread = CheckRereadFile("DLS file '" + options.dls_files[i] + "'", options.dls_files[i] + DLSEncoder::REQUEST_REREAD_SUFFIX);
+ switch (reread) {
+ case 1: // re-read requested
+ // switch to desired DLS file
+ curr_dls_file = i;
+ next_label = pad_timeline + std::chrono::seconds(options.label_interval);
+
+ // enforce label insertion
+ next_label_insertion = pad_timeline;
+ break;
+ case -1: // error
+ return 1;
+ }
+ }
+
if (options.dls_files.size() > 1 && pad_timeline >= next_label) {
// switch to next DLS file
curr_dls_file = (curr_dls_file + 1) % options.dls_files.size();