From 1c40f60caf203a6655961c8bc3abef3391a8966d Mon Sep 17 00:00:00 2001 From: Fred Gleason Date: Mon, 18 Dec 2023 14:34:33 -0500 Subject: [PATCH] 2023-12-18 Fred Gleason * Fixed a regression in rdcatchd(8) that caused recordings to always be saved in PCM16 format when the 'Normalize' attribute was set for the recording event. Signed-off-by: Fred Gleason --- ChangeLog | 4 ++++ lib/rdsettings.cpp | 29 +++++++++++++++++++++++++++++ lib/rdsettings.h | 3 +++ rdcatchd/batch.cpp | 10 +++++++--- 4 files changed, 43 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 41dbd251..144f91ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24577,3 +24577,7 @@ 2023-12-18 Fred Gleason * Renamed a parameter in the 'Driver::unloadRecord()' method in caed(8). +2023-12-18 Fred Gleason + * Fixed a regression in rdcatchd(8) that caused recordings to + always be saved in PCM16 format when the 'Normalize' attribute + was set for the recording event. diff --git a/lib/rdsettings.cpp b/lib/rdsettings.cpp index 8fdef9d8..b4f8eff5 100644 --- a/lib/rdsettings.cpp +++ b/lib/rdsettings.cpp @@ -52,6 +52,35 @@ void RDSettings::setFormat(Format format) } +void RDSettings::setFormat(RDCae::AudioCoding coding) +{ + RDSettings::Format fmt=RDSettings::Pcm16; + + switch(coding) { + case RDCae::Pcm16: + fmt=RDSettings::Pcm16; + break; + + case RDCae::MpegL1: + fmt=RDSettings::MpegL1; + break; + + case RDCae::MpegL2: + fmt=RDSettings::MpegL2; + break; + + case RDCae::MpegL3: + fmt=RDSettings::MpegL2; + break; + + case RDCae::Pcm24: + fmt=RDSettings::Pcm24; + break; + } + setFormat(fmt); +} + + QString RDSettings::formatName() const { return set_format_name; diff --git a/lib/rdsettings.h b/lib/rdsettings.h index 77129f5e..5f1ca6d0 100644 --- a/lib/rdsettings.h +++ b/lib/rdsettings.h @@ -23,6 +23,8 @@ #include +#include + class RDSettings { public: @@ -33,6 +35,7 @@ class RDSettings void setName(const QString &str); RDSettings::Format format() const; void setFormat(Format format); + void setFormat(RDCae::AudioCoding coding); QString formatName() const; void setFormatName(const QString &str); unsigned channels() const; diff --git a/rdcatchd/batch.cpp b/rdcatchd/batch.cpp index afef1031..66690363 100644 --- a/rdcatchd/batch.cpp +++ b/rdcatchd/batch.cpp @@ -2,7 +2,7 @@ // // Batch Routines for the Rivendell netcatcher daemon // -// (C) Copyright 2002-2022 Fred Gleason +// (C) Copyright 2002-2023 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -451,17 +451,21 @@ bool MainObject::Import(CatchEvent *evt,QString *err_msg) RDAudioConvert *conv=new RDAudioConvert(this); conv->setSourceFile(RDEscapeString(evt->tempName())); conv->setDestinationFile(RDCut::pathName(evt->cutName())); + RDDeck *deck=new RDDeck(rda->station()->name(),evt->channel()); RDSettings *settings=new RDSettings(); - settings->setFormat(evt->format()); + // settings->setFormat(catch_record_coding[evt->channel()-1]); + settings->setFormat(deck->defaultFormat()); settings->setChannels(evt->channels()); settings->setSampleRate(rda->system()->sampleRate()); - settings->setBitRate(evt->bitrate()); + settings->setBitRate(catch_record_bitrate[evt->channel()-1]); settings->setNormalizationLevel(evt->normalizeLevel()/100); rda->syslog(LOG_INFO,"started import of %s to cut %s, id=%d", (const char *)evt->tempName().toUtf8(), (const char *)evt->cutName().toUtf8(), evt->id()); conv->setDestinationSettings(settings); + delete deck; + switch((conv_err=conv->convert())) { case RDAudioConvert::ErrorOk: CheckInRecording(evt->cutName(),evt,msecs,evt->trimThreshold());