aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Outputs.cpp23
-rw-r--r--src/Outputs.h6
-rw-r--r--src/odr-sourcecompanion.cpp28
3 files changed, 42 insertions, 15 deletions
diff --git a/src/Outputs.cpp b/src/Outputs.cpp
index 3b4de65..90fe62a 100644
--- a/src/Outputs.cpp
+++ b/src/Outputs.cpp
@@ -1,6 +1,6 @@
/* ------------------------------------------------------------------
* Copyright (C) 2011 Martin Storsjo
- * Copyright (C) 2019 Matthias P. Braendli
+ * Copyright (C) 2020 Matthias P. Braendli
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -142,7 +142,12 @@ EDI::EDI() :
EDI::~EDI() { }
-void EDI::add_udp_destination(const string& host, unsigned int port)
+void EDI::set_odr_version_tag(const std::string& odr_version_tag)
+{
+ m_odr_version_tag = odr_version_tag;
+}
+
+void EDI::add_udp_destination(const std::string& host, unsigned int port)
{
auto dest = make_shared<edi::udp_destination_t>();
dest->dest_addr = host;
@@ -155,7 +160,7 @@ void EDI::add_udp_destination(const string& host, unsigned int port)
// TODO make FEC configurable
}
-void EDI::add_tcp_destination(const string& host, unsigned int port)
+void EDI::add_tcp_destination(const std::string& host, unsigned int port)
{
auto dest = make_shared<edi::tcp_client_t>();
dest->dest_addr = host;
@@ -165,7 +170,7 @@ void EDI::add_tcp_destination(const string& host, unsigned int port)
dest->dest_port = port;
m_edi_conf.destinations.push_back(dest);
- m_edi_conf.dump = true;
+ m_edi_conf.dump = false;
}
bool EDI::enabled() const
@@ -215,17 +220,9 @@ bool EDI::write_frame(const uint8_t *buf, size_t len)
edi::TagODRAudioLevels edi_tagAudioLevels(m_audio_left, m_audio_right);
- stringstream ss;
- ss << PACKAGE_NAME << " " <<
-#if defined(GITVERSION)
- GITVERSION;
-#else
- PACKAGE_VERSION;
-#endif
-
// We always send in 24ms interval
const size_t num_seconds_sent = m_num_frames_sent * 1000 / 24;
- edi::TagODRVersion edi_tagVersion(ss.str(), num_seconds_sent);
+ edi::TagODRVersion edi_tagVersion(m_odr_version_tag, num_seconds_sent);
// The above Tag Items will be assembled into a TAG Packet
edi::TagPacket edi_tagpacket(m_edi_conf.tagpacket_alignment);
diff --git a/src/Outputs.h b/src/Outputs.h
index 1f17491..53ee2ec 100644
--- a/src/Outputs.h
+++ b/src/Outputs.h
@@ -1,6 +1,6 @@
/* ------------------------------------------------------------------
* Copyright (C) 2011 Martin Storsjo
- * Copyright (C) 2019 Matthias P. Braendli
+ * Copyright (C) 2020 Matthias P. Braendli
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -133,6 +133,8 @@ class EDI: public Base {
EDI& operator=(const EDI&) = delete;
virtual ~EDI() override;
+ void set_odr_version_tag(const std::string& odr_version_tag);
+
void add_udp_destination(const std::string& host, unsigned int port);
void add_tcp_destination(const std::string& host, unsigned int port);
@@ -143,6 +145,8 @@ class EDI: public Base {
virtual bool write_frame(const uint8_t *buf, size_t len) override;
private:
+ std::string m_odr_version_tag;
+
edi::configuration_t m_edi_conf;
std::shared_ptr<edi::Sender> m_edi_sender;
diff --git a/src/odr-sourcecompanion.cpp b/src/odr-sourcecompanion.cpp
index b8c5547..b233e2c 100644
--- a/src/odr-sourcecompanion.cpp
+++ b/src/odr-sourcecompanion.cpp
@@ -1,5 +1,5 @@
/* ------------------------------------------------------------------
- * Copyright (C) 2019 Matthias P. Braendli
+ * Copyright (C) 2020 Matthias P. Braendli
* Copyright (C) 2017 AVT GmbH - Fabien Vercasson
* Copyright (C) 2011 Martin Storsjo
*
@@ -89,6 +89,7 @@ void usage(const char* name) {
" --sbr Force the usage of SBR\n"
" --ps Force the usage of PS\n"
" Output and pad parameters:\n"
+ " --identifier=ID An identifier string that is sent in the ODRv EDI TAG. Max 32 characters length.\n"
" -o, --output=URI Output ZMQ uri. (e.g. 'tcp://localhost:9000')\n"
" If more than one ZMQ output is given, the socket\n"
" will be connected to all listed endpoints.\n"
@@ -151,6 +152,7 @@ int main(int argc, char *argv[])
{"rate", required_argument, 0, 'r'},
{"stats", required_argument, 0, 'S'},
{"secret-key", required_argument, 0, 'k'},
+ {"identifier", required_argument, 0, 3 },
{"input-uri", required_argument, 0, 'I'},
{"control-uri", required_argument, 0, 6 },
{"timeout", required_argument, 0, 7 },
@@ -185,6 +187,8 @@ int main(int argc, char *argv[])
bool allowSBR = false;
bool allowPS = false;
+ string identifier;
+
vector<string> edi_output_uris;
bool tist_enabled = false;
uint32_t tist_delay_ms = 0;
@@ -209,6 +213,16 @@ int main(int argc, char *argv[])
allowPS = true;
allowSBR = true;
break;
+ case 3: // Identifier for in-band version information
+ identifier = optarg;
+ /* The 32 character length restriction is arbitrary, but guarantees
+ * that the EDI packet will not grow too large */
+ if (identifier.size() > 32) {
+ fprintf(stderr, "Output Identifier too long!\n");
+ usage(argv[0]);
+ return 1;
+ }
+ break;
case 'b':
bitrate = stoi(optarg);
break;
@@ -323,6 +337,18 @@ int main(int argc, char *argv[])
}
}
+ if (not edi_output_uris.empty()) {
+ stringstream ss;
+ ss << PACKAGE_NAME << " " <<
+#if defined(GITVERSION)
+ GITVERSION <<
+#else
+ PACKAGE_VERSION <<
+#endif
+ " " << identifier;
+ edi_output.set_odr_version_tag(ss.str());
+ }
+
if (padlen != 0) {
int flags;
if (mkfifo(pad_fifo, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH) != 0) {