From 2d79c8b23bdee866af53be9418c99b20419a397c Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 3 Dec 2024 15:05:51 +0100 Subject: Add --edi-verbose option --- contrib/edioutput/Transport.cpp | 2 +- contrib/edioutput/Transport.h | 2 -- src/Outputs.cpp | 8 +++++++- src/Outputs.h | 7 +++---- src/odr-audioenc.cpp | 5 +++++ 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/contrib/edioutput/Transport.cpp b/contrib/edioutput/Transport.cpp index cbff6d4..4979e93 100644 --- a/contrib/edioutput/Transport.cpp +++ b/contrib/edioutput/Transport.cpp @@ -195,7 +195,7 @@ void Sender::write(const AFPacket& af_packet) else if (auto tcp_dest = dynamic_pointer_cast(dest)) { const auto error_stats = tcp_senders.at(tcp_dest.get())->sendall(af_packet); - if (error_stats.has_seen_new_errors) { + if (m_conf.verbose and error_stats.has_seen_new_errors) { fprintf(stderr, "TCP output %s:%d has %zu reconnects: most recent error: %s\n", tcp_dest->dest_addr.c_str(), tcp_dest->dest_port, diff --git a/contrib/edioutput/Transport.h b/contrib/edioutput/Transport.h index 6a3f229..c62545c 100644 --- a/contrib/edioutput/Transport.h +++ b/contrib/edioutput/Transport.h @@ -31,11 +31,9 @@ #include "AFPacket.h" #include "PFT.h" #include "Socket.h" -#include #include #include #include -#include #include #include #include diff --git a/src/Outputs.cpp b/src/Outputs.cpp index d7af7d4..fd723f6 100644 --- a/src/Outputs.cpp +++ b/src/Outputs.cpp @@ -1,6 +1,6 @@ /* ------------------------------------------------------------------ * Copyright (C) 2011 Martin Storsjo - * Copyright (C) 2020 Matthias P. Braendli + * Copyright (C) 2024 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. @@ -18,6 +18,7 @@ */ #include "Outputs.h" +#include #include #include #include @@ -142,6 +143,11 @@ EDI::EDI() : EDI::~EDI() { } +void EDI::set_verbose(bool verbose) +{ + m_edi_conf.verbose = verbose; +} + void EDI::set_odr_version_tag(const std::string& odr_version_tag) { m_odr_version_tag = odr_version_tag; diff --git a/src/Outputs.h b/src/Outputs.h index 20932d6..3987ca3 100644 --- a/src/Outputs.h +++ b/src/Outputs.h @@ -1,6 +1,6 @@ /* ------------------------------------------------------------------ * Copyright (C) 2011 Martin Storsjo - * Copyright (C) 2020 Matthias P. Braendli + * Copyright (C) 2024 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. @@ -19,8 +19,6 @@ #pragma once #include -#include -#include #include #include #include @@ -41,7 +39,6 @@ namespace Output { * * Declaration of all outputs */ - class Base { public: virtual ~Base() {}; @@ -133,6 +130,8 @@ class EDI: public Base { EDI& operator=(const EDI&) = delete; virtual ~EDI() override; + void set_verbose(bool verbose); + void set_odr_version_tag(const std::string& odr_version_tag); void add_udp_destination(const std::string& host, unsigned int port); diff --git a/src/odr-audioenc.cpp b/src/odr-audioenc.cpp index 6a2afbe..f65c3e4 100644 --- a/src/odr-audioenc.cpp +++ b/src/odr-audioenc.cpp @@ -201,6 +201,7 @@ static void usage(const char* name) " will be connected to all listed endpoints.\n" " -e, --edi=URI EDI output uri, (e.g. 'tcp://localhost:7000')\n" " --fec=FEC Set EDI output FEC\n" + " --edi-verbose Enable verbose mode for EDI output.\n" " -T, --timestamp-delay=DELAY_MS Enabled timestamps in EDI (requires TAI clock bulletin download) and\n" " add a delay (in milliseconds) to the timestamps carried in EDI\n" " --startup-check=SCRIPT_PATH Before starting, run the given script, and only start if it returns 0.\n" @@ -1412,6 +1413,7 @@ int main(int argc, char *argv[]) {"aaclc", no_argument, 0, 0 }, {"dab", no_argument, 0, 'a'}, {"drift-comp", no_argument, 0, 'D'}, + {"edi-verbose", no_argument, 0, 12 }, {"fifo-silence", no_argument, 0, 3 }, {"help", no_argument, 0, 'h'}, {"level", no_argument, 0, 'l'}, @@ -1505,6 +1507,9 @@ int main(int argc, char *argv[]) case 8: // EDI output FEC audio_enc.edi_output.set_fec(std::stoi(optarg)); break; + case 12: // --edi-verbose + audio_enc.edi_output.set_verbose(true); + break; case 9: // --startup-check startupcheck = optarg; break; -- cgit v1.2.3