summaryrefslogtreecommitdiffstats
path: root/src/dabOutput/metadata.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-07-31 11:15:40 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-07-31 11:15:40 +0200
commit3c6c1ea2b45ec06ce493d595fc8cd3a03f056a84 (patch)
tree5c5dc7f84ff62cef70bbf3dbb15c30bdd96308ba /src/dabOutput/metadata.cpp
parent5d1b6420535c72d7a8df85a5db08ff1c0230690a (diff)
downloaddabmux-3c6c1ea2b45ec06ce493d595fc8cd3a03f056a84.tar.gz
dabmux-3c6c1ea2b45ec06ce493d595fc8cd3a03f056a84.tar.bz2
dabmux-3c6c1ea2b45ec06ce493d595fc8cd3a03f056a84.zip
Insert metadata properly and enable EDI out in zmq2edi
Diffstat (limited to 'src/dabOutput/metadata.cpp')
-rw-r--r--src/dabOutput/metadata.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/dabOutput/metadata.cpp b/src/dabOutput/metadata.cpp
index cb355cc..a77ccf5 100644
--- a/src/dabOutput/metadata.cpp
+++ b/src/dabOutput/metadata.cpp
@@ -35,7 +35,7 @@
#endif
template <typename T>
-size_t write_meta(output_metadata_id_e md, uint8_t *buf, T value)
+size_t write_meta(output_metadata_id_e md, uint8_t *buf, const T value)
{
buf[0] = static_cast<uint8_t>(md);
@@ -48,12 +48,16 @@ size_t write_meta(output_metadata_id_e md, uint8_t *buf, T value)
buf[3] = value;
}
else if (len_value == 2) {
- const uint16_t value = htons(value);
- memcpy(buf + 3, &value, sizeof(value));
+ const uint16_t val = htons(value);
+ memcpy(buf + 3, &val, sizeof(val));
}
else if (len_value == 4) {
- const uint32_t value = htons(value);
- memcpy(buf + 3, &value, sizeof(value));
+ const uint32_t val = htonl(value);
+ memcpy(buf + 3, &val, sizeof(val));
+ }
+ else {
+ throw std::runtime_error("Unsupported metadata len " +
+ std::to_string(len_value));
}
return 3 + len_value;