From 423cd09abe52c754c333fdf8df0f4bf9623ff97b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 31 Jul 2019 12:17:16 +0200 Subject: Fix audio level metadata insertion --- src/odr-audioenc.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/odr-audioenc.cpp b/src/odr-audioenc.cpp index 0c7c9c3..6a5f6ea 100644 --- a/src/odr-audioenc.cpp +++ b/src/odr-audioenc.cpp @@ -482,7 +482,7 @@ public: ~AudioEnc(); int run(); - bool send_frame(const uint8_t *buf, size_t len); + bool send_frame(const uint8_t *buf, size_t len, int peak_left, int peak_right); shared_ptr initialise_input(); }; @@ -1140,7 +1140,7 @@ int AudioEnc::run() std::copy(toolame_buffer.begin(), toolame_buffer.begin() + frame_len, frame.begin()); toolame_buffer.erase(toolame_buffer.begin(), toolame_buffer.begin() + frame_len); - bool success = send_frame(frame.data(), frame.size()); + bool success = send_frame(frame.data(), frame.size(), peak_left, peak_right); if (not success) { fprintf(stderr, "Send error !\n"); send_error_count ++; @@ -1148,7 +1148,7 @@ int AudioEnc::run() } } else if (numOutBytes > 0 and selected_encoder == encoder_selection_t::fdk_dabplus) { - bool success = send_frame(outbuf.data(), numOutBytes); + bool success = send_frame(outbuf.data(), numOutBytes, peak_left, peak_right); if (not success) { fprintf(stderr, "Send error !\n"); send_error_count ++; @@ -1206,15 +1206,18 @@ int AudioEnc::run() return retval; } -bool AudioEnc::send_frame(const uint8_t *buf, size_t len) +bool AudioEnc::send_frame(const uint8_t *buf, size_t len, int peak_left, int peak_right) { if (file_output) { + file_output->update_audio_levels(peak_left, peak_right); return file_output->write_frame(buf, len); } else if (zmq_output) { + zmq_output->update_audio_levels(peak_left, peak_right); return zmq_output->write_frame(buf, len); } else if (edi_output.enabled()) { + edi_output.update_audio_levels(peak_left, peak_right); switch (selected_encoder) { case encoder_selection_t::fdk_dabplus: { -- cgit v1.2.3