aboutsummaryrefslogtreecommitdiffstats
path: root/dabplussnoop.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-11-17 13:49:03 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-11-17 13:49:03 +0100
commitc619de03546ac1d5b562350891302e7e010407a8 (patch)
tree54c7f2040d99d6d4ee889f7fbc7eb81f351bfbef /dabplussnoop.cpp
parent90e2e9e59dd38d075c6f95629f1087e24954a327 (diff)
downloadetisnoop-c619de03546ac1d5b562350891302e7e010407a8.tar.gz
etisnoop-c619de03546ac1d5b562350891302e7e010407a8.tar.bz2
etisnoop-c619de03546ac1d5b562350891302e7e010407a8.zip
ETISnoop correctly decode audio and write aac and wav files
Diffstat (limited to 'dabplussnoop.cpp')
-rw-r--r--dabplussnoop.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/dabplussnoop.cpp b/dabplussnoop.cpp
index 2fc9454..54a6266 100644
--- a/dabplussnoop.cpp
+++ b/dabplussnoop.cpp
@@ -53,7 +53,7 @@ void DabPlusSnoop::push(uint8_t* streamdata, size_t streamsize)
// m_data now points to a valid header
if (decode()) {
// We have been able to decode the AUs
- m_data.clear();
+ m_data.erase(m_data.begin(), m_data.begin() + m_subchannel_index * 120);
}
}
}
@@ -130,7 +130,7 @@ bool DabPlusSnoop::decode()
// AAC core sampling rate 16 kHz
else if (m_dac_rate && m_sbr_flag) num_aus = 3;
// AAC core sampling rate 24 kHz
- else if (m_dac_rate && !m_sbr_flag) num_aus = 4;
+ else if (!m_dac_rate && !m_sbr_flag) num_aus = 4;
// AAC core sampling rate 32 kHz
else if (m_dac_rate && !m_sbr_flag) num_aus = 6;
// AAC core sampling rate 48 kHz
@@ -266,13 +266,18 @@ bool DabPlusSnoop::analyse_au(vector<vector<uint8_t> >& aus)
{
stringstream ss_filename;
- ss_filename << "stream-" << m_index << ".wav";
+ ss_filename << "stream-" << m_index;
- FaadDecoder new_decoder(ss_filename.str(), m_ps_flag, m_aac_channel_mode,
- m_dac_rate, m_sbr_flag, m_mpeg_surround_config);
-
- faad_decoder = new_decoder;
+ if (!m_faad_decoder.is_initialised()) {
+ m_faad_decoder.open(ss_filename.str(), m_ps_flag,
+ m_aac_channel_mode, m_dac_rate, m_sbr_flag,
+ m_mpeg_surround_config);
+ }
- return faad_decoder.Decode(aus);
+ return m_faad_decoder.decode(aus);
}
+void DabPlusSnoop::close()
+{
+ m_faad_decoder.close();
+}