aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Pöschel <spoeschel@irt.de>2019-07-23 11:21:10 +0200
committerStefan Pöschel <github@basicmaster.de>2019-07-23 11:32:19 +0200
commitc5d5653d26816204fb39485accce08f21737c707 (patch)
treece3d648f4a2adf7cac3f308a52c276871cbdf1af
parent1c2f96f13e6e5abbf114af0192dbdd53de3c9a25 (diff)
downloadODR-PadEnc-c5d5653d26816204fb39485accce08f21737c707.tar.gz
ODR-PadEnc-c5d5653d26816204fb39485accce08f21737c707.tar.bz2
ODR-PadEnc-c5d5653d26816204fb39485accce08f21737c707.zip
DLS: allow to use separate DL Plus item state file
-rw-r--r--src/dls.cpp15
-rw-r--r--src/dls.h4
-rw-r--r--src/odr-padenc.cpp12
-rw-r--r--src/odr-padenc.h4
4 files changed, 28 insertions, 7 deletions
diff --git a/src/dls.cpp b/src/dls.cpp
index 4e106e0..5d334b1 100644
--- a/src/dls.cpp
+++ b/src/dls.cpp
@@ -3,7 +3,7 @@
Copyright (C) 2014, 2015 Matthias P. Braendli (http://opendigitalradio.org)
- Copyright (C) 2015, 2016, 2017 Stefan Pöschel (http://opendigitalradio.org)
+ Copyright (C) 2015-2019 Stefan Pöschel (http://opendigitalradio.org)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -244,11 +244,22 @@ bool DLSEncoder::parseLabel(const std::string& dls_file, const DL_PARAMS& dl_par
}
-void DLSEncoder::encodeLabel(const std::string& dls_file, const DL_PARAMS& dl_params) {
+void DLSEncoder::encodeLabel(const std::string& dls_file, const char* item_state_file, const DL_PARAMS& dl_params) {
DL_STATE dl_state;
if (!parseLabel(dls_file, dl_params, dl_state))
return;
+ // if enabled, derive DL Plus Item Toggle/Running bits from separate file
+ if (item_state_file) {
+ DL_STATE item_state;
+ if (!parseLabel(item_state_file, DL_PARAMS(), item_state))
+ return;
+
+ dl_state.dl_plus_enabled = true;
+ dl_state.dl_plus_item_toggle = item_state.dl_plus_item_toggle;
+ dl_state.dl_plus_item_running = item_state.dl_plus_item_running;
+ }
+
// if DL Plus enabled, but no DL Plus tags were added, add the required DUMMY tag
if (dl_state.dl_plus_enabled && dl_state.dl_plus_tags.empty())
dl_state.dl_plus_tags.emplace_back();
diff --git a/src/dls.h b/src/dls.h
index 0142565..546fc8e 100644
--- a/src/dls.h
+++ b/src/dls.h
@@ -3,7 +3,7 @@
Copyright (C) 2014, 2015 Matthias P. Braendli (http://opendigitalradio.org)
- Copyright (C) 2015, 2016, 2017 Stefan Pöschel (http://opendigitalradio.org)
+ Copyright (C) 2015-2019 Stefan Pöschel (http://opendigitalradio.org)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -156,7 +156,7 @@ public:
static const std::string REQUEST_REREAD_SUFFIX;
DLSEncoder(PADPacketizer* pad_packetizer) : pad_packetizer(pad_packetizer), dls_toggle(false) {}
- void encodeLabel(const std::string& dls_file, const DL_PARAMS& dl_params);
+ void encodeLabel(const std::string& dls_file, const char* item_state_file, const DL_PARAMS& dl_params);
};
#endif /* DLS_H_ */
diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp
index 46e1f6e..0a7629a 100644
--- a/src/odr-padenc.cpp
+++ b/src/odr-padenc.cpp
@@ -76,6 +76,7 @@ static void usage(const char* name) {
" -r, --remove-dls Always insert a DLS Remove Label command when replacing a DLS text.\n"
" -C, --raw-dls Do not convert DLS texts to Complete EBU Latin based repertoire\n"
" character set encoding.\n"
+ " -I, --item-state=FILENAME FIFO or file to read the DL Plus Item Toggle/Running bits from (instead of the current DLS file).\n"
" -m, --max-slide-size=SIZE Recompress slide if above the specified maximum size in bytes.\n"
" Default: %zu (Simple Profile)\n"
" -R, --raw-slides Do not process slides. Integrity checks and resizing\n"
@@ -131,6 +132,7 @@ int main(int argc, char *argv[]) {
{"erase", no_argument, 0, 'e'},
{"output", required_argument, 0, 'o'},
{"dls", required_argument, 0, 't'},
+ {"item-state", required_argument, 0, 'I'},
{"pad", required_argument, 0, 'p'},
{"sleep", required_argument, 0, 's'},
{"max-slide-size", required_argument, 0, 'm'},
@@ -146,7 +148,7 @@ int main(int argc, char *argv[]) {
};
int ch;
- while((ch = getopt_long(argc, argv, "eChRrc:d:o:p:s:t:f:l:L:i:X:vm:", longopts, NULL)) != -1) {
+ while((ch = getopt_long(argc, argv, "eChRrc:d:o:p:s:t:I:f:l:L:i:X:vm:", longopts, NULL)) != -1) {
switch (ch) {
case 'c':
options.dl_params.charset = (DABCharset) atoi(optarg);
@@ -172,6 +174,9 @@ int main(int argc, char *argv[]) {
case 't': // can be used more than once!
options.dls_files.push_back(optarg);
break;
+ case 'I':
+ options.item_state_file = optarg;
+ break;
case 'p':
options.padlen = atoi(optarg);
break;
@@ -278,6 +283,9 @@ int main(int argc, char *argv[]) {
}
}
+ if (options.item_state_file)
+ fprintf(stderr, "ODR-PadEnc reading DL Plus Item Toggle/Running bits from '%s'.\n", options.item_state_file);
+
// TODO: check uniform PAD encoder options!?
@@ -446,7 +454,7 @@ int PadEncoder::EncodeLabel(bool skip_if_already_queued) {
return 0;
}
- dls_encoder.encodeLabel(options.dls_files[curr_dls_file], options.dl_params);
+ dls_encoder.encodeLabel(options.dls_files[curr_dls_file], options.item_state_file, options.dl_params);
return 0;
}
diff --git a/src/odr-padenc.h b/src/odr-padenc.h
index 2646305..9ecf4a4 100644
--- a/src/odr-padenc.h
+++ b/src/odr-padenc.h
@@ -65,6 +65,7 @@ struct PadEncoderOptions {
const char* sls_dir;
const char* output;
std::vector<std::string> dls_files;
+ const char* item_state_file;
PadEncoderOptions() :
padlen(58),
@@ -78,7 +79,8 @@ struct PadEncoderOptions {
max_slide_size(SLSEncoder::MAXSLIDESIZE_SIMPLE),
raw_slides(false),
sls_dir(NULL),
- output("/tmp/pad.fifo")
+ output("/tmp/pad.fifo"),
+ item_state_file(NULL)
{}
bool DLSEnabled() {return !dls_files.empty();}