aboutsummaryrefslogtreecommitdiffstats
path: root/dabplussnoop.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-03-07 11:05:36 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-03-07 11:05:36 +0100
commit1544f980d9d61c645f72a7d22a387c64da2adf49 (patch)
tree634401d23a1aac10a1ff28eccaa83e2e44acfca3 /dabplussnoop.cpp
parent29fee943a37916ee205e7b9fd3ba295ef5f00194 (diff)
downloadetisnoop-1544f980d9d61c645f72a7d22a387c64da2adf49.tar.gz
etisnoop-1544f980d9d61c645f72a7d22a387c64da2adf49.tar.bz2
etisnoop-1544f980d9d61c645f72a7d22a387c64da2adf49.zip
Move .dabp dump and rename to .msc
Diffstat (limited to 'dabplussnoop.cpp')
-rw-r--r--dabplussnoop.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/dabplussnoop.cpp b/dabplussnoop.cpp
index 7073e7f..eb79e15 100644
--- a/dabplussnoop.cpp
+++ b/dabplussnoop.cpp
@@ -45,30 +45,29 @@ using namespace std;
void DabPlusSnoop::push(uint8_t* streamdata, size_t streamsize)
{
+ // First dump to file
+ if (m_raw_data_stream_fd == NULL) {
+ stringstream dump_filename;
+ dump_filename << "stream-" << m_index << ".msc";
+
+ m_raw_data_stream_fd = fopen(dump_filename.str().c_str(), "w");
+
+ if (m_raw_data_stream_fd == NULL) {
+ perror("File open failed");
+ }
+ }
+
+ fwrite(streamdata, 1, streamsize, m_raw_data_stream_fd);
+
+ // Try to decode audio
size_t original_size = m_data.size();
m_data.resize(original_size + streamsize);
-
memcpy(&m_data[original_size], streamdata, streamsize);
if (seek_valid_firecode()) {
// m_data now points to a valid header
if (decode()) {
// We have been able to decode the AUs
-
- // First dump to file
- if (m_raw_data_stream_fd == NULL) {
- stringstream dump_filename;
- dump_filename << "stream-" << m_index << ".dabp";
-
- m_raw_data_stream_fd = fopen(dump_filename.str().c_str(), "w");
-
- if (m_raw_data_stream_fd == NULL) {
- perror("File open failed");
- }
- }
-
- fwrite(&m_data[0], m_subchannel_index, 120, m_raw_data_stream_fd);
-
m_data.erase(m_data.begin(), m_data.begin() + m_subchannel_index * 120);
}
}