From aee7b6219270cc87fb90c6b40605c866dcd0f60b Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 23 Sep 2016 20:33:25 +0200 Subject: Fix decode to .msc for both DAB and DAB+ --- src/dabplussnoop.hpp | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'src/dabplussnoop.hpp') diff --git a/src/dabplussnoop.hpp b/src/dabplussnoop.hpp index 865a35e..8efc481 100644 --- a/src/dabplussnoop.hpp +++ b/src/dabplussnoop.hpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 Matthias P. Braendli (http://www.opendigitalradio.org) + Copyright (C) 2016 Matthias P. Braendli (http://www.opendigitalradio.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ along with this program. If not, see . dabplussnoop.cpp - Parse DAB+ frames from a ETI file + Extract MSC data and parse DAB+ frames from a ETI file Authors: Matthias P. Braendli @@ -81,15 +81,14 @@ he_aac_super_frame(subchannel_index) #ifndef __DABPLUSSNOOP_H_ #define __DABPLUSSNOOP_H_ - +// DabPlusSnoop is responsible for decoding DAB+ audio class DabPlusSnoop { public: DabPlusSnoop() : m_index(0), m_subchannel_index(0), - m_data(0), - m_raw_data_stream_fd(NULL) {} + m_data(0) {} void set_subchannel_index(unsigned subchannel_index) { @@ -125,9 +124,40 @@ class DabPlusSnoop unsigned m_subchannel_index; std::vector m_data; +}; + +// StreamSnoop is responsible for saving msc data into files, +// and calling DabPlusSnoop's decode routine if it's a DAB+ subchannel +class StreamSnoop +{ + public: + StreamSnoop() : + dps(), + m_index(-1), + m_raw_data_stream_fd(NULL) {} + + void set_subchannel_index(unsigned subchannel_index) + { + dps.set_subchannel_index(subchannel_index); + } + + void set_index(int index) + { + m_index = index; + dps.set_index(index); + } + + void push(uint8_t* streamdata, size_t streamsize); + + void close(void); + + private: + DabPlusSnoop dps; + int m_index; FILE* m_raw_data_stream_fd; }; + #endif -- cgit v1.2.3