diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-03-07 11:05:36 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-03-07 11:05:36 +0100 |
commit | 1544f980d9d61c645f72a7d22a387c64da2adf49 (patch) | |
tree | 634401d23a1aac10a1ff28eccaa83e2e44acfca3 | |
parent | 29fee943a37916ee205e7b9fd3ba295ef5f00194 (diff) | |
download | etisnoop-1544f980d9d61c645f72a7d22a387c64da2adf49.tar.gz etisnoop-1544f980d9d61c645f72a7d22a387c64da2adf49.tar.bz2 etisnoop-1544f980d9d61c645f72a7d22a387c64da2adf49.zip |
Move .dabp dump and rename to .msc
-rw-r--r-- | dabplussnoop.cpp | 31 | ||||
-rw-r--r-- | etisnoop.cpp | 2 |
2 files changed, 16 insertions, 17 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); } } diff --git a/etisnoop.cpp b/etisnoop.cpp index 38aad03..09d8001 100644 --- a/etisnoop.cpp +++ b/etisnoop.cpp @@ -206,7 +206,7 @@ void usage(void) "Usage: etisnoop [-v] [-f] [-w] [-i filename] [-d stream_index]\n" "\n" " -v increase verbosity (can be given more than once)\n" - " -d N decode subchannel N into .dabp and .wav files\n" + " -d N decode subchannel N into .msc and .wav files\n" " -f analyse FIC carousel\n" " -r analyse FIG rates in FIGs per second\n" " -R analyse FIG rates in frames per FIG\n" |