summaryrefslogtreecommitdiff
path: root/orkbasecxx
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2008-02-20 20:44:37 +0000
committerHenri Herscher <henri@oreka.org>2008-02-20 20:44:37 +0000
commitce3bd0f6f355366bddf27b2dcaea4f652a5ac075 (patch)
treeb53b72e592ffc02fedb644fe1190ddb9345112f4 /orkbasecxx
parent3aa8a40ede53e566ebe254bf9efc7f6ff8fa5af4 (diff)
Added TapeDurationMinimumSec config parameter to be able to discard short recordings. Default is 0.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@524 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx')
-rw-r--r--orkbasecxx/Config.cpp2
-rw-r--r--orkbasecxx/Config.h4
-rw-r--r--orkbasecxx/ImmediateProcessing.cpp17
3 files changed, 21 insertions, 2 deletions
diff --git a/orkbasecxx/Config.cpp b/orkbasecxx/Config.cpp
index d86ce3c..7699525 100644
--- a/orkbasecxx/Config.cpp
+++ b/orkbasecxx/Config.cpp
@@ -68,6 +68,7 @@ Config::Config()
m_allowAutomaticRecording = ALLOW_AUTOMATIC_RECORDING_DEFAULT;
m_captureFileSizeLimitKb = CAPTURE_FILE_SIZE_LIMIT_KB_DEFAULT;
m_partyFilter.clear();
+ m_tapeDurationMinimumSec = TAPE_DURATION_MINIMUM_SEC_DEFAULT;
}
void Config::Define(Serializer* s)
@@ -140,6 +141,7 @@ void Config::Define(Serializer* s)
s->BoolValue(ALLOW_AUTOMATIC_RECORDING_PARAM, m_allowAutomaticRecording); // only valid in non-lookback mode
s->IntValue(CAPTURE_FILE_SIZE_LIMIT_KB_PARAM, m_captureFileSizeLimitKb);
s->CsvValue(PARTY_FILTER_PARAM, m_partyFilter);
+ s->IntValue(TAPE_DURATION_MINIMUM_SEC_PARAM, m_tapeDurationMinimumSec);
}
void Config::Validate()
diff --git a/orkbasecxx/Config.h b/orkbasecxx/Config.h
index 5630a71..0713c47 100644
--- a/orkbasecxx/Config.h
+++ b/orkbasecxx/Config.h
@@ -104,6 +104,9 @@
#define CAPTURE_FILE_SIZE_LIMIT_KB_DEFAULT 300000
#define PARTY_FILTER_PARAM "PartyFilter"
#define PARTY_FILTER_DEFAULT ""
+#define TAPE_DURATION_MINIMUM_SEC_PARAM "TapeDurationMinimumSec"
+#define TAPE_DURATION_MINIMUM_SEC_DEFAULT 0
+
class DLL_IMPORT_EXPORT_ORKBASE Config : public Object
{
@@ -163,6 +166,7 @@ public:
bool m_allowAutomaticRecording;
int m_captureFileSizeLimitKb;
std::list<CStdString> m_partyFilter;
+ int m_tapeDurationMinimumSec;
private:
log4cxx::LoggerPtr m_log;
diff --git a/orkbasecxx/ImmediateProcessing.cpp b/orkbasecxx/ImmediateProcessing.cpp
index 1ac414c..3f2c58a 100644
--- a/orkbasecxx/ImmediateProcessing.cpp
+++ b/orkbasecxx/ImmediateProcessing.cpp
@@ -86,8 +86,20 @@ void ImmediateProcessing::ThreadHandler(void *args)
if (audioTapeRef->IsReadyForBatchProcessing())
{
- // Pass the tape to the tape processor chain
- TapeProcessorRegistry::instance()->RunProcessingChain(audioTapeRef);
+
+ if(CONFIG.m_tapeDurationMinimumSec>0 && audioTapeRef->m_duration<CONFIG.m_tapeDurationMinimumSec)
+ {
+ audioTapeRef->GetAudioFileRef()->Delete();
+
+ CStdString logMsg;
+ logMsg.Format("[%s] is less than %d sec, discarding", audioTapeRef->m_trackingId, CONFIG.m_tapeDurationMinimumSec);
+ LOG4CXX_INFO(LOG.immediateProcessingLog, logMsg);
+ }
+ else
+ {
+ // Pass the tape to the tape processor chain
+ TapeProcessorRegistry::instance()->RunProcessingChain(audioTapeRef);
+ }
}
}
}
@@ -99,3 +111,4 @@ void ImmediateProcessing::ThreadHandler(void *args)
LOG4CXX_INFO(LOG.immediateProcessingLog, CStdString("Exiting thread"));
}
+