aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/odr-padenc.cpp27
-rw-r--r--src/odr-padenc.h5
-rw-r--r--src/pad_common.cpp6
-rw-r--r--src/pad_common.h6
4 files changed, 32 insertions, 12 deletions
diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp
index d44dc67..46e1f6e 100644
--- a/src/odr-padenc.cpp
+++ b/src/odr-padenc.cpp
@@ -3,7 +3,7 @@
Copyright (C) 2014, 2015 Matthias P. Braendli (http://opendigitalradio.org)
- Copyright (C) 2015, 2016, 2017, 2018 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
@@ -90,6 +90,8 @@ static void usage(const char* name) {
" -L, --label-ins=DUR Insert label every DUR milliseconds\n"
" Default: %d\n"
" -i, --init-burst=COUNT Sets a PAD burst amount to initially fill the output FIFO\n"
+ " Default: %d\n"
+ " -X, --xpad-interval=COUNT Output X-PAD every COUNT frames/AUs (otherwise: only F-PAD)\n"
" Default: %d\n",
options_default.slide_interval,
options_default.output,
@@ -98,7 +100,8 @@ static void usage(const char* name) {
options_default.max_slide_size,
options_default.label_interval,
options_default.label_insertion,
- options_default.init_burst
+ options_default.init_burst,
+ options_default.xpad_interval
);
}
@@ -137,12 +140,13 @@ int main(int argc, char *argv[]) {
{"label", required_argument, 0, 'l'},
{"label-ins", required_argument, 0, 'L'},
{"init-burst", required_argument, 0, 'i'},
+ {"xpad-interval", required_argument, 0, 'X'},
{"verbose", no_argument, 0, 'v'},
{0,0,0,0},
};
int ch;
- while((ch = getopt_long(argc, argv, "eChRrc:d:o:p:s:t:f:l:L:i:vm:", longopts, NULL)) != -1) {
+ while((ch = getopt_long(argc, argv, "eChRrc:d:o:p:s:t:f:l:L:i:X:vm:", longopts, NULL)) != -1) {
switch (ch) {
case 'c':
options.dl_params.charset = (DABCharset) atoi(optarg);
@@ -189,6 +193,9 @@ int main(int argc, char *argv[]) {
case 'i':
options.init_burst = atoi(optarg);
break;
+ case 'X':
+ options.xpad_interval = atoi(optarg);
+ break;
case 'v':
verbose++;
break;
@@ -274,6 +281,11 @@ int main(int argc, char *argv[]) {
// TODO: check uniform PAD encoder options!?
+ if (options.xpad_interval < 1) {
+ fprintf(stderr, "ODR-PadEnc Error: The X-PAD interval must be 1 or greater!\n");
+ return 1;
+ }
+
// invoke selected encoder
if (options.frame_dur) {
@@ -498,6 +510,8 @@ UniformPadEncoder::UniformPadEncoder(PadEncoderOptions options) : PadEncoder(opt
// if multiple DLS files, ensure that initial increment leads to first one
if (options.dls_files.size() > 1)
curr_dls_file = -1;
+
+ xpad_interval_counter = 0;
}
int UniformPadEncoder::Encode() {
@@ -557,12 +571,15 @@ int UniformPadEncoder::Encode() {
if (result)
return result;
- // flush one PAD
- pad_packetizer.WriteAllPADs(output_fd, 1, true);
+ // flush one PAD (considering X-PAD output interval)
+ pad_packetizer.WriteAllPADs(output_fd, 1, true, xpad_interval_counter == 0);
pad_timeline += std::chrono::milliseconds(options.frame_dur);
// schedule next run at next frame/AU
run_timeline += std::chrono::milliseconds(options.frame_dur);
+ // update X-PAD output interval counter
+ xpad_interval_counter = (xpad_interval_counter + 1) % options.xpad_interval;
+
return 0;
}
diff --git a/src/odr-padenc.h b/src/odr-padenc.h
index d1ad016..2646305 100644
--- a/src/odr-padenc.h
+++ b/src/odr-padenc.h
@@ -3,7 +3,7 @@
Copyright (C) 2014, 2015 Matthias P. Braendli (http://opendigitalradio.org)
- Copyright (C) 2015, 2016, 2017, 2018 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
@@ -57,6 +57,7 @@ struct PadEncoderOptions {
int label_interval; // uniform PAD encoder only
int label_insertion; // uniform PAD encoder only
int init_burst; // uniform PAD encoder only
+ int xpad_interval; // uniform PAD encoder only
size_t max_slide_size;
bool raw_slides;
DL_PARAMS dl_params;
@@ -73,6 +74,7 @@ struct PadEncoderOptions {
label_interval(12),
label_insertion(1200),
init_burst(12),
+ xpad_interval(1),
max_slide_size(SLSEncoder::MAXSLIDESIZE_SIMPLE),
raw_slides(false),
sls_dir(NULL),
@@ -141,6 +143,7 @@ private:
steady_clock::time_point next_slide;
steady_clock::time_point next_label;
steady_clock::time_point next_label_insertion;
+ size_t xpad_interval_counter;
int Encode();
public:
diff --git a/src/pad_common.cpp b/src/pad_common.cpp
index 0fccb7f..0c3f0b3 100644
--- a/src/pad_common.cpp
+++ b/src/pad_common.cpp
@@ -3,7 +3,7 @@
Copyright (C) 2014, 2015 Matthias P. Braendli (http://opendigitalradio.org)
- Copyright (C) 2015, 2016, 2017, 2018 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
@@ -140,13 +140,13 @@ pad_t* PADPacketizer::GetPAD() {
}
-void PADPacketizer::WriteAllPADs(int output_fd, int limit, bool output_sole_fpad) {
+void PADPacketizer::WriteAllPADs(int output_fd, int limit, bool output_sole_fpad, bool output_xpad) {
size_t error_count = 0;
size_t error_bytes = 0;
// output a limited amount of PADs (-1 = no limit)
for (int i = 0; i != limit; i++) {
- pad_t* pad = GetPAD();
+ pad_t* pad = output_xpad ? GetPAD() : FlushPAD();
// if only F-PAD present, abort (if desired)
if (pad->back() == FPAD_LEN && !output_sole_fpad) {
diff --git a/src/pad_common.h b/src/pad_common.h
index 95134bd..7568d8c 100644
--- a/src/pad_common.h
+++ b/src/pad_common.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
@@ -108,6 +108,7 @@ private:
void AppendDGWithCI(DATA_GROUP* dg);
void AppendDGWithoutCI(DATA_GROUP* dg);
+ pad_t* GetPAD();
void ResetPAD();
pad_t* FlushPAD();
public:
@@ -122,8 +123,7 @@ public:
bool QueueFilled();
bool QueueContainsDG(int apptype_start);
- pad_t* GetPAD();
- void WriteAllPADs(int output_fd, int limit = -1, bool output_sole_fpad = false);
+ void WriteAllPADs(int output_fd, int limit = -1, bool output_sole_fpad = false, bool output_xpad = true);
static DATA_GROUP* CreateDataGroupLengthIndicator(size_t len);
static bool CheckPADLen(size_t len);