aboutsummaryrefslogtreecommitdiffstats
path: root/dabplussnoop.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-11-09 11:33:11 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-11-09 11:33:11 +0100
commit639951285591ab6e8d1158e336a3f6c19477cc4f (patch)
tree40c6090f564539cd2bb201b85e4ffa53ddd4b880 /dabplussnoop.h
parent588a749b8544afce1824d9bcda80f2c5a44524e5 (diff)
downloadetisnoop-639951285591ab6e8d1158e336a3f6c19477cc4f.tar.gz
etisnoop-639951285591ab6e8d1158e336a3f6c19477cc4f.tar.bz2
etisnoop-639951285591ab6e8d1158e336a3f6c19477cc4f.zip
ETISnoop search for firecode
Diffstat (limited to 'dabplussnoop.h')
-rw-r--r--dabplussnoop.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/dabplussnoop.h b/dabplussnoop.h
new file mode 100644
index 0000000..6a386eb
--- /dev/null
+++ b/dabplussnoop.h
@@ -0,0 +1,101 @@
+/*
+ Copyright (C) 2014 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
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ dabplussnoop.cpp
+ Parse DAB+ frames from a ETI file
+
+ Authors:
+ Matthias P. Braendli <matthias@mpb.li>
+*/
+
+/* From the spec:
+
+subchannel_index = MSC sub-channel size (kbps) / 8
+audio_super_frame_size (bytes) = subchannel_index * 110
+
+
+he_aac_super_frame(subchannel_index)
+{
+ he_aac_super_frame_header()
+ {
+ header_firecode 16
+ rfa 1
+ dac_rate 1
+ sbr_flag 1
+ aac_channel_mode 1
+ ps_flag 1
+ mpeg_surround_config 3
+
+ // end of audio parameters
+ if ((dac_rate == 0) && (sbr_flag == 1)) num_aus = 2;
+ // AAC core sampling rate 16 kHz
+ if ((dac_rate == 1) && (sbr_flag == 1)) num_aus = 3;
+ // AAC core sampling rate 24 kHz
+ if ((dac_rate == 0) && (sbr_flag == 0)) num_aus = 4;
+ // AAC core sampling rate 32 kHz
+ if ((dac_rate == 1) && (sbr_flag == 0)) num_aus = 6;
+ // AAC core sampling rate 48 kHz
+
+ for (n = 1; n < num_aus; n++) {
+ au_start[n]; 12
+ }
+
+ if !((dac_rate == 1) && (sbr_flag == 1))
+ alignment 4
+ }
+
+ for (n = 0; n < num_aus; n++) {
+ au[n] 8 * au_size[n]
+ au_crc[n] 16
+ }
+}
+*/
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <string>
+#include <sstream>
+#include <vector>
+
+#ifndef __DABPLUSSNOOP_H_
+#define __DABPLUSSNOOP_H_
+
+class DabPlusSnoop
+{
+ public:
+ DabPlusSnoop() :
+ m_subchannel_index(0),
+ m_data(0) {}
+
+ void set_subchannel_index(unsigned subchannel_index)
+ {
+ m_subchannel_index = subchannel_index;
+ }
+
+ void push(uint8_t* streamdata, size_t streamsize);
+
+ private:
+ int decode(void);
+ int check(void);
+
+ unsigned m_subchannel_index;
+ std::vector<uint8_t> m_data;
+};
+
+#endif
+