Giter Club home page Giter Club logo

dab-cmdline's Introduction

DAB COMMAND LINE and DAB LIBRARY


Introduction

The DAB library provides entries for the functionality to handle DAB/DAB+ through some simple calls. A few callback functions provide the communication back from the library to the caller. The library interface is given in dab-api.h

Since I was unhappy with passing lots of individual callback functions through the whole of the computing chain, I made (am making) a change to the API and the dabInit function in the API.

Until recently one had to specify all individual callback functions as parameter to the dabInit function.

The change is that now a struct "API_struct" is defined in the API, the fields of which are the references to the different callback functions such that the call to dabInit is basically simplified to

theRadio        = dabInit (theDevice,
                               &interface,
                               nullptr,             // no spectrum shown
                               nullptr,             // no constellations
                               nullptr              // Ctx
                              );

Examples 1, 2, 3, 4, 5 and 6 are adapted. Other examples - apart from the python example are deleted.

The obvious advantage is that adding a callback function for a specific purpose now does not change all of the intermediate functions in tbhe library, basically opne only modifies

a. the structure
b. the main program for filling the structure and adding a handler
c. the affected function in the library

New callback functions are

a. the tii data 
    typedef void (*tii_data_t)(int);
   where the int is encoded as mainId << 8 + subInt

b. the time 
   typedef void    (*theTime_t)(std::string, void *);
   where the time (hours::minutes) is passed as string

The handling of motdata is changed. In the previous version, slides were - automatically - written to a file. In the current version, the parameter profile of the motdata handling function is extended, the motdata is passed on as uint8_t array, the size of the data is passed, the name of the slides - as derived from the DAB data - is passed on. See the dab-api for details


Disclaimer

The software is provided as is, it is available under the GPL-V2, the examples might or might not work. As far as I can see they work on my Linux-x86 box, no garantees are given that the library software or the examples will work on Windows or any other system.

THE EXAMPLES ARE NOT INTENDED TO BE FULL SOLUTIONS, BUT MERELY THERE TO GIVE YOU AN IDEA HOW TO USE THE LIBRARY OR ITS SOURCES. MODIFICATIONS IN THE LIBRARY ARE NOT ALWAYS TESTED ON ALL EXAMPLES, PLEASE CORRECT THEM YOURSELF IF YOU (THINK YOU) FIND AN ERROR BEFORE ASKING ME.


The C (C++) example programs

A number of example programs is included in the source tree, they are meant to give an idea on how to use the library code, either as library or as "built-in" sources. They might or might not work.

Note that the library depends on a device, but does not include that device. The main program is responsible for ensuring that something is available to deliver input samples and something is available for handling the output.

Invocation of the example programs, with some parameters specified, is something like

dab-sdrplay-x -M 1 -B "BAND III" -C 12C -P "Radio 4" -G 80 -A default

In this case, the example program was built with the SDRplay as device (other possibilities are DABsticks, AIRspy devices, HACKRF and Lime SDR devices (and some of the example programs can be configured to take file input)). Furthermore, the example program will set the tuner to Band III, channel 12C, will select the service "Radio 4". The Gain of the tuner is set to 80 (on a scale from 1 .. 100), the main program will select "default" as audio output device. The Library code will be set to interpret the input as being of Mode 1.

example 3 with sdrplay input


Supported devices

- SDRplay RSP's (using 2.13 lib or 3.06 lib)
- AIRspy
- RTLSDR based devices
- HACKRF (only example programs 2, 3, 4)
- LimeSDR (only example programs 2, 3 and 4)
- Pluto (only example 2)

and of course fileinput of ".raw" and ".sdr" files is supported, as well as input through the rtl_tcp driver.


The examples

The examples are basically simple variations on a single theme, example 2 is the basic one, others are derived.

- example 1 is the example where the main program is linked to
  a precompiled shared library, 
  i.e. the DAB library should be pre-installed

- example 2 has the same functionality as example 1, the sources
      of the library are "compiled-in", however.

- example 3 has the same functionality as example 2, and here
  the library sources are "compiled in" as well. However, the
  PCM samples are being sent out to stdout.
  One might use one of the available programs to make the sound
  audible
  dab-example-3 .... | aplay -r 48000 -f S16_LE -t raw -c 2

- example 4 has the sample functionality as examples 2 and 3, and
  here the library sources are "compiled in" as well. However,
  no sound decoding takes place. The MP2 frames (in case of DAB)
  and the AAC frames (in case of DAB+) are just emitted
  into a file or to stdout. A flag "-f XXXX" to the command
  line of this example, if specified, output is written to
  the specified file, otherwise to stdout.
  The output can be processed by e.g. VLC.
  (Note that the AAC frames have 960 rather than 1024 samples,
   not all audio programs are capable of handling these).

- example 5 is a small experimental extension to example 2,
  It contains a simple "keyboard listener", that will react
  on entering a stroke on the return key. It will cause the
  "next" (audio) service to be selected.

- example 6 is an experimental version where stdin is
  used as input device (and the command line parameters are
  adapted to that)

- the python example seems to work, the cmake file now expects
  python3.9 (it should work with other versions as well, adapt the
  CMakeLists.tct file)

For all examples it holds that NO garantee is
given on their functioning, feel free to improve.

A simple DAB scanner

Next to these examples, a simple dab-scanner was made, an example program that just scans all channels of the given band (BAND III by default) and collects and emits data about the ensembles and services encountered. Output can be sent to a file - ASCII - that can be interpreted by Libre Office Calc or similar programs.

The dab-scanner supports rtlsdr, sdrplay, airspy, hackrf, and lime sdr.

dab scanner with sdrplay input


An example: installing example 2

As with other sdr programs, a number of libraries is to be installed. Assuming that the program is to be compiled in a Debian based system (e.g. Ubuntu)

sudo apt-get update
sudo apt-get install git cmake
sudo apt-get install build-essential g++
sudo apt-get install pkg-config
sudo apt-get install libsndfile1-dev
sudo apt-get install libfftw3-dev portaudio19-dev
sudo apt-get install libfaad-dev zlib1g-dev 
sudo apt-get install libusb-1.0-0-dev mesa-common-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libsamplerate0-dev

Installing the library for the SDRplay requires downloading the library from the "www.SDRplay.com" site.

For pluto the "libiio-dev" has to be installed. Note that on "old" Ubuntu versions, e.g. 16.04, only an old, not yet complete, version of the library is available.

Installing the library for the RTLSDR can be done by executing the following lines

git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
make
sudo make install
sudo ldconfig
cd ..
rm -rf build
cd ..

Installing the library for the AIRspy can be done by executing the following lines

wget https://github.com/airspy/host/archive/master.zip
unzip master.zip
cd airspyone_host-master
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
cd ..
rm -rf build
cd ..

Once the libraries are installed, creating an executable for example 2 is straightforward

cd dab-cmdline
cd example-2
mkdir build
cd build
cmake .. -DXXX=ON (replace XXX by the name of the device)
make
sudo make install
cd ../../..

The resulting executable is installed in "/usr/local/bin"


The API

The full API description is given in the file dab-api.h

Initialization of the library is by a call to "dabInit". The call returns a pointer (type void *) to structures internal to the library.

"dabInit" gets pointers to callback functions as parameter and returns
a "Handle", to be used in the other functions


"dabExit" cleans up all resource use of the library.

"dabReset" cleans up resource use and restarts the library

"dabStartProcessing" returns immediately after being called
 but will have created a few threads running in the background.

As soon as an ensemble is recognized, a callback function will be called. Recognition of a service within an ensemble also leads to calling a callback function, with the service name as parameter.

"dabReset_msc" will terminate operation of the handler(s) for the
currently selected service


"is_audioService" can be used to enquire whether or not a service
with a given name is a recognized audio service,

"is_dataService" can be used to enquire whether or not a service
with a given name is a recognized data service,

"dataforAudioService" is the function with which the (relevant) data,
describing an audio service with a given name is fetched.
The function fills a structure of type "audiodata", 
it contains a field "defined" telling whether or not the
data is the structure is valid or not.
Note that if the last parameter is a 0-value, the main service
is looked for, otherwise, the i-th subservice.

"dataforDataService" is the function with which the (relevant) data,
describing a data service with a given name is fetched.
The function fills a structure of type "packetdata", 
it contains a field "defined" telling whether or not the
data is the structure is valid or not.
Note that if the last parameter is a 0-value, the main service
    is looked for, otherwise, the i-th subservice.

"set-audioChannel", when provided with a structure of type "audiodata",
with valid data, will open and add an audio stream.

"set-dataChannel", when provided with a structure of type "packetdata",
with valid data, will open and add a data stream.

Note that there is no built-in limit on the amount of open streams,
although from a practical point of view there may be limitations,
i.e two audiostreams may compete for a single library.

What might be useful is to enquire for subservices such as MOT
when opening an audio stream.

A note on the callback functions

The library (whether separate or compiled in) sends its data to the main program using callbacks. These callbacks, the specification of which is given in the file dab-api.h, are implemented here as simple C functions. WHAT MUST BE NOTED IS THAT THESE FUNCTIONS ARE EXECUTED IN THE THREAD OF THE CALLER, and while the library is built around more than a single thread, it is wise to add some locking when extending the callback functions.

========================================================================

Creating the library

The library can be created by - if needed - adapting the CMakeLists.txt file in the dab-library/library directory and running

mkdir build 
cd build 
cmake .. 
make 
sudo make install

from within the dab-library directory.

IMPORTANT: YOU NEED C++11 SUPPORT FOR THIS

Note that contrary to earlier versions, the "device" is NOT part of the library, the user program has to provide some functions to the library for getting samples. The interface can be found in the file "device-handler.h".

===============================================================================

Libraries (together with the "development" or ".h" files) needed for creating the library are

libfaad
libfftw3f
libusb-1.0
zlib

============================================================================

For the python-example read the README file in the python-example directory. HOWEVER: before running the example program one has to create an ADAPTED library. The CMakeLists.txt file for creating such an adapted library is in the python directory.

=============================================================================

Command-line Parameters for the C (C++) exmple programs

The programs accept the following command line parameters:

-B Band

selects the DAB band (default Band III),

-M Mode

selects the DAB Mode (default Mode 1),

-C the channel

the default is 11C, the channel I am listening to mostly,

-P the program name

a prefix suffices. For e.g. "Classic FM" it suffices to give "Classic". However, when passing on a non-unique prefix (e.g. "Radio" for "Radio Maria" and "Radio Veronica") the software will select one arbitrarily. Note that letter case is IMPORTANT is the current version. The names of the programs in the ensemble being received in the selected channel will be printed during recognition.

Important: If no program names are found, or if no match can be made between the program name and the list of program names, the program has no other choice than to halt, what it does.

-G the gain 

to be applied on the device, a value in the range from 1 .. 100. The value will be translated to an acceptable value for the device. In case the gain is table driven, as in the case of a dabstick, a value of e.g. 75 is translated into the element on three quarters of the table (basic assumption is that the table elements are more or less linear). For e.g. the Airspy the values are mapped upon the range 0 .. 21 of the sensitivity slider. Note that when using the rtl_tcp interface, this does not hold. The sound setting is passed on to the server.

-W waiting time

the maximum time to wait for valid data. If no valid data is found within this period, execution of the program will stop.

Note that in example-2 the -W is replaced by TWO parameters, a -d xxx indicating the maximum amount of time to reach time synchronization (which is implicit in the other examples) and a -D xxx parameter indicating the maximum amount of time to get the signal "ensemble found".

-A the output channel (example 1 and 2 only)

again as with the program name, a prefix of the name suffices. As with the programs, the names of the sound channels identified will be printed. Note, however, that in Linux not all all names appearing on the namelist are useful, some of them will just not work, a well known issue with the combination portaudio/alsa under Linux. Important: If a name is selected for a channel that cannot be opened the program will try to open the default output device.

-O filename or "-" (example 2 only) 

The PCM samples of the sound output are stored in the file . If "-" is specified as filename the output is just written to stdout. This output then can be made audible by some other program.

-H hostname (example 2, 3 and 4 only)

If rtl_tcp is selected as input device, the -H option allows selection of a hostname. Default is "127.0.0.1".

-I port (example 2, 3, and 4 only)

If rtl_tcp is selected as input device, the -I option allows selection of a port. Default is 1234.


Interfaces

In order to use the library, the main program has to deal with two interfaces, obviously the dab library, but also the device.

The device interface is specified in "./device-handler.cpp".


E X P E R I M E N T A L

One of the issues still to be resolved is the handling of data. As an experiment a callback function was added that is called from within the tdc handler. In example-2 a simple TCP server was added, one that just writes out packaged tdc frames. The package structure is : an 8 byte header followed by the frame data. The header starts with a -1 0 -1 0 pattern, followed by a two byte length, followed by a zero, followed by a 0 for frametype 0 and 0xFF for frametype 1. Install the server by adding "-DSERVER" to the cmake command line.

A simple "reader" (client), using qt is included in the sources.


Copyrights

Copyright (C)  2016, 2017, 2018
Jan van Katwijk ([email protected])
Lazy Chair Computing

The dab-library software is made available under the GPL-2.0. The dab-library uses a number of GPL-ed libraries, all rigfhts gratefully acknowledged. All SDR-J software, among which dab-library is one - 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.

dab-cmdline's People

Contributors

andimik avatar athoik avatar borine avatar chris-y avatar f4exb avatar hayguen avatar jedrus2000 avatar jvankatwijk avatar paulkram avatar sillerud avatar srcejon avatar vale-max avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dab-cmdline's Issues

Improving performance on Raspberry Pi

I've been running example-3 on my desktop which has a powerful processor and it works without hiccups.

Now I switched to running it on a raspberry pi 3 revision B, it runs semi-smoothly but I do get reports from aplay that the buffer is underrun. Looking into improving this, I've tried multiple things:

  • Add define for __THREADED_DECODING, when looking in the code I do not understand how this is supposed to do anything, this define is not used in any part of the code? It also seems to have no noticeable effect: only 1 core of the Pi is going to 100% and the other ones are doing seemingly nothing.
  • Use example-4 and then mplayer to play the AAC frames, as to take the decoding load of the dab-cmdline. When running this example, nothing gets written to stdout.
  • When looking into the qt-dab repo, you mention something about a latency option, is this option possible to use in this repo and will it improve performance?

Thanks in advance for the help.

i2c wr failed

Had a bunch of issues getting this to compile and run on a clean RPi 3 raspbian install (Linux raspberrypi 4.4.26-v7+ #915 SMP Thu Oct 20 17:08:44 BST 2016 armv7l GNU/Linux), but got there in the end.

Anyway, trying to use this it seams that there's a problem communicating with the dabstick hardware:

lsusb gives me:
Bus 001 Device 004: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T

and running ./dab_cmdline I get:

...
Found Rafael Micro R820T tuner
samplerate set to 2048000
Supported gain values (29): r82xx_write: i2c wr failed=-9 reg=09 len=1
r82xx_set_freq: failed=-9
going to tell the world
no ensemble, quittingwe told the world
ofdmProcessor is shutting down

Any ideas where to start with this?

[Win32] crash in FULL_SPIRAL_sse()

I'm having a hard time building and using this package for MSVC (32-bit).
Some alignment issue in the SSE instructions is causing this crash in e.g. dab-scanner -j -C10A -Q (the SDRPlay version):

sdrdevice found = 1803049E94, hw Version = 255
{
checking data in channel 10A
dab processor will stop
checking data in channel 10B
dab processor will stop
checking data in channel 10C
dab processor will stop
checking data in channel 10D
dab processor will stop
checking data in channel 11A
dab processor will stop
checking data in channel 11B
dab processor will stop
checking data in channel 11C
dab processor will stop
checking data in channel 11D
0

Some station on 11D, then a boom:

dab!FULL_SPIRAL_sse+0x62:
613b3e52 c5f96f09        vmovdqa xmm1,xmmword ptr [ecx] ds:002b:011b1bb8=000000ff000000ff0000000000000000
ecx=011b1bb8 

ECX is not a multiple of 16 for the offending code a824 = ((__m128i *) Branchtab); probably.
Call-stack:

dab!FULL_SPIRAL_sse(int amount = 0x183, int * Y = 0x011b1a98, int * X = 0x011b1998, int * syms = 0x03e00100, unsigned char * dec = 0x03e06200 "", int * Branchtab = 0x011b1bb8)+0x62
dab!viterbiSpiral::deconvolve(short * input = <Value unavailable error>, unsigned char * output = <Value unavailable error>)+0x11d
dab!ficHandler::process_ficInput(short ficno = 0)+0x99
dab!ficHandler::process_ficBlock(class std::vector<short,std::allocator<short> > data = { size=0xc00 }, short blkno = 1)+0xcc
dab!dabProcessor::run(void)+0x694
dab!std::thread::_Invoke<std::tuple<void (void * _RawVals = <Value unavailable error>)+0x42
...

I've patched viterbi-spiral.h like so:

#include <xmmintrin.h>
class	viterbiSpiral {
...
 _MM_ALIGN16   COMPUTETYPE Branchtab	[NUMSTATES / 2 * RATE];
...

without any help.

no audio out with Raspberry Pi OS Lite

I installed dab-cmdline example 2 on a Raspberry Pi 3B with Raspberry Pi OS Lite (headless) as described in the related documentation. I got it working but there is no audio out. I can generate an audio file with option -O, but it sounds horrible (at least with omxplayer). But no audio out with OS Lite and from remote terminal.
If I install it based on the Raspberry Pi Desktop OS and start example 2 from Desktop, everything is fine. Installation via remote terminal is exactly the same.
Do I have to install any additional libraries? Any idea?

ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave

So far I've not had any problems with Audio, in that PulseAudio works fine for A2DP Bluetooth, Hands Free, local music playback, web browsing, and also rtl_fm.

However both example-1 and example-2 give me the following. Any thoughts?

Im looking to build a CarPC, so hoping I can build up on this. Looking to build a Python front end in KODI and hopefully get a channel scan and tuning setup. Hopefully borrow some bits from your Qt version at some point :-)

First thing though, is getting some audio from the thing!

Simon

pi@master:~/Downloads/dab-cmdline-master/example-1/build $ ./dab_cmdline -M 1 -B "BAND III" -C 12C -P "Radio 4" -G 80 -A default
dab_cmdline, Copyright 2017 J van Katwijk, Lazy Chair ComputingALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Hostapis: 2
Api 0 is ALSA
Api 1 is OSS
selecting device default
device bcm2835 ALSA: - (hw:0,0) seems available as 0
device bcm2835 ALSA: IEC958/HDMI (hw:0,1) seems available as 1
device sysdefault seems available as 2
device pulse seems available as 3
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
.
.
.
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
Expression 'ret' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1735
Expression 'AlsaOpen( hostApi, parameters, streamDir, &pcm )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1767
device default seems available as 5
Suggested size for outputbuffer = 1280
Segmentation fault

Cmake error compiling the python example

I'm really confused about the way I should compile the python example, I'm following the README ,but the cmake ( cmake .. -DSDRPLAY=ON) command generate a rather cryptic error :

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
SDRPLAYLIB_INCLUDE_DIR
used as include directory in directory /home/andrea/dab-cmdline/python-example
used as include directory in directory /home/andrea/dab-cmdline/python-example

Library for python

Hello @JvanKatwijk
I know the python script are unsupported, but the compilation of the library fails because it seems the layout of the source files changed.
Do you have the time to fix it so it would be possible to experiment a bit with python?

mot-object: does not save object to filesystem

Hi,

It seems that mot-object doesn't save images to filesystem any more.

// MOT slide, to show
if (name == "")
realName = "no name";
else
realName = name;
// FILE * temp = fopen (realName. c_str (), "w");
// fwrite (result.data (), 1, result. size (), temp);
if (motdataHandler != nullptr)
motdataHandler (realName, contentsubType, ctx);
}

It was disabled on: d858f4f

(but before disable, it was written on working directory, instead of /tmp)

I restore it like this:

https://github.com/satdreamgr/dab-cmdline/blob/dev/library/src/backend/data/mot/mot-object.cpp#L164-L176

Obviously if there is no motdataHandler we can simply return immediately from handleComplete.

Restore this functionality?

Understanding Problem & Scan available?

Hi Jan,
I do not yet understand the architecture. May you please give me a hint how it works? How is the data flow of the stream(s) coming from e.g. the DVB-T stick (including audio, program information, gifs, ...)? Are there perhaps daemons needed running in background to process the data streams?

Is there an option instead issuing commands to the DBV-T stick to perform a scan to find all radio stations (I'm mainly interested in DAB+, but FM may be an option?) and to store the available stations in a text file? This would allow new commands to be implemented like:
-scan
-P n (where n is the n th Program found in the radio station list file)

Best Regards

Which ha?

Ho, this is note an issue, but I would know which kind of hw I must use in order to tune a dab station. May be I'm wrong, but I wasn't able to find any direction in the files.

Regards,
Angelo

Dynamic Label method not quite right

For some reason I don't receive any DL messages. However the dataOut callback does print some garbage characters. So I was looking at the code and I think there's a misunderstnding. Either mine or yours :-) I can only find a spec for DL+ so I'm not sure.

Referring to padHandler::dynamicLabel method in pad-handler.cpp
So far as I can tell the DL command field comprises one byte header and field_1 message bytes. This is why field_1 is specified as one less than DL Command length.

This makes the header length 3 byes not 2 bytes and affects dataLength calculation and the start byte of the message, which should be data[3] not data[2].

Changing this removes the garbage data problem I was seeing but as I receive no real messages I can't test it any further.

c.f. http://www.etsi.org/deliver/etsi_ts/102900_102999/102980/01.01.01_60/ts_102980v010101p.pdf

Optimized Viterbi decoder using NEON instructions

Hi,

The #41 already implements an decoder, but I think we are not getting the maximum performance.

I have already locate two projects that make use of viterbi decoder and implemented with NEON.

The most promising project is the https://github.com/theori-io/nrsc5, I would call that project, the "brother project" of https://github.com/JvanKatwijk/dab-cmdline for our friends in US.

The viterbi decoder is available here: https://github.com/theori-io/nrsc5/blob/master/src/conv_neon.h and here: https://github.com/theori-io/nrsc5/blob/master/src/conv_dec.c

Also SSE (https://github.com/theori-io/nrsc5/blob/master/src/conv_sse.h) and generic version exists (https://github.com/theori-io/nrsc5/blob/master/src/conv_dec.c).

The code seems very nice and most probably we need something like the following:

int conv_decode_p4(const int8_t *in, uint8_t *out)
{
	const struct lte_conv_code code = {
		.n = 4,
		.k = 7,
		.len = 2048,
		.gen = { 109, 73, 83, 109 },
		.term = CONV_TERM_TAIL_BITING,
	};
	int rc;

	struct vdecoder *vdec = alloc_vdec(&code);
	if (!vdec)
		return -EFAULT;

	reset_decoder(vdec, code.term);

	/* Propagate through the trellis with interval normalization */
	_conv_decode(vdec, in, code.len);

	if (code.term == CONV_TERM_TAIL_BITING)
		_conv_decode(vdec, in, code.len);

	rc = traceback(vdec, out, code.term, code.len);

	free_vdec(vdec);
	return rc;
}

It would be great if @awesie can help us integrate or provide a test program like spiral.net provides, in order to test performance.

The second project is srsLTE https://github.com/srsLTE/srsLTE
They also have a generic, SSE and NEON version of viterbi (https://github.com/srsLTE/srsLTE/blob/master/lib/src/phy/fec/viterbi37_neon.c). They also have a test program (https://github.com/srsLTE/srsLTE/blob/master/lib/src/phy/fec/test/viterbi_test.c).

It would be great, to use viterbi from above projects, if their implementations offer better performance from SSE2NEON already available on #41.

Thanks.

Switch program

Is there any possibility to switch between the programs in the ensemble without quitting the program first?

"it appeared that you did not select a device"

I'm running dab_cmdline on a raspberry pi 2 but I'm receiving this message :

"it appeared that you did not select a device,
you can run, but you will be connected to a virtual device, only providing zeros"

my lsusb

Bus 001 Device 005: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T

the usb stick works properly with rtl_fm , I have no idea how to solve this honestly...

Query on addtoFrame() function

Firstly, congratulations on such a great project!!

I have a small query re function addtoFrame(uint8_t* outV) which is present in both the audio and data
processors.e.g. mp2Processor::addtoFrame()

My understanding is that the input array to this function is in the form of unpacked bits, these are then packed into bytes in the first few lines of both mp2Processor::addtoFrame() and mp4Processor::addtoFrame()

However, on the corresponding data version, i.e. dataProcessor::addtoFrame(outV), no unpacking seems to be present, but the function itself seems to be working on byte arrays rather than on unpacked bits

Am I missing something, or is the unpacking done somewhere else?

Thanks for your time
ed

Can't use -H and -I option

I can't set server adress and port number with dab-rtl-tcp-2. When I run program without setting server and port parameter it search for samples on 127.0.0.1:1234 (default) but with -H it complain about invalid option: ./dab-rtl_tcp-2: invalid option -- 'H'. Is it bug?

Wrong console text

When I specify -S then the text in the console is still your default value from the Netherlands.

dab-airspy-2 -C 10D -S 9201 -G 100

shows

going to start program Classic FM
selected Slo 1 Prvi      

So it also would help if -S is not specified to show an error message before the program starts (and not when Classic FM has not been found).

And slideshows are not shown, so you could remove the text going to show picture

dab-library CMakeLists.txt doesn't force C++ 11 support

To compile dab-library, the README file states: "IMPORTANT: YOU NEED C++11 SUPPORT FOR THIS", which I found to be the case (it wouldn't compile without!), so could the CMakeLists.txt not include 'add_compile_options(-std=c++11)' to facilitate this, or does this compile option break with newer versions of cmake (that perhaps already use C++ 11 by default)?

AAC_OUT: it seems AAC LC format changed to AAC SBR

Using latest version I am getting the following output on AAC ouput:

# ffprobe -i rad.aac
ffprobe version N-52056-ge5d25d1147-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 42.101 / 56. 42.101
  libavcodec     58. 76.100 / 58. 76.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
[aac_latm @ 0x27a0ae0] SBR with 960 frame length is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac_latm @ 0x27a0ae0] SBR with 960 frame length is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
Input #0, loas, from 'rad.aac':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Audio: aac_latm (LC), 24000 Hz, stereo, fltp
[aac_latm @ 0x27a1400] SBR with 960 frame length is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.

I suspect that issue occurs since last change on mp4processor.

70c9786#diff-116d5b7495d6f9297530f92514c37515

How can we verify if DAB+ uses AAC SBR or AAC LC?

Because if ERT DAB+ uses AAC SBR, then it's something missing from ffmpeg :(

Problems with choosing channel

In Norway we have some channels with similar name e.g.:

NRK P1
NRK P1+

If i choose -P "NRK P1" I sometimes get locked to "NRK P1+" if the channel is listet before "NRK P1" in the ensemble.

I also have problems with the Norwegian characters ÆØÅ

program (3): NRK P1+?stfold   in the list  (Should be NRK P1+Østfold)
program (4): NRK P1+?stlands  in the list (Should be NRK P1+Østlandssendingen)
program (5): NRK V?r S?R      in the list (Should be (NRK Vær SØR)

But otherwise its working like a sharm!

Thanks a lot!!

R.

Segfault on recreating Radio

My current usecase requires me to delete the dab radio and device and recreate it:

    theRadio	-> reset ();
    theDevice	-> stopReader ();
    delete theRadio;
    delete theDevice;
    theDevice = NULL;
    theRadio = NULL;

Then after a user action recreate device and radio:

  try {
#ifdef	HAVE_SDRPLAY
     theDevice	= new sdrplayHandler (frequency,
                                        ppmCorrection,
                                        theGain,
                                        autogain,
                                        0,
                                        0);
#endif

  }
  catch (int e) {
     std::cerr << "allocating device failed (" << e << "), fatal\n";
     exit (32);
  }

  if (soundOut == NULL) {	// not bound to a file?
     soundOut	= new audioSink	(latency, soundChannel, &err);
     if (err) {
        std::cerr << "no valid sound channel, fatal\n";
        exit (33);
     }
  }


  //
  //	and with a sound device we now can create a "backend"
    theRadio	= new dabClass (theDevice,
                                    theMode,
                                    NULL,		// no spectrum shown
                                    NULL,		// no constellations
                                    syncsignalHandler,
                                    systemData,
                                    ensemblenameHandler,
                                    programnameHandler,
                                    fibQuality,
                                    pcmHandler,
                                    dataOut_Handler,
                                    bytesOut_Handler,
                                    programdataHandler,
                                    mscQuality,
                                    motdataHandler,	// MOT in PAD
                                    NULL		// Ctx
                                   );
    if (theRadio == NULL) {
       std::cerr << "sorry, no radio available, fatal\n";
       exit (4);
    }

    theDevice	-> setGain (theGain);
    if (autogain)
       theDevice	-> set_autogain (autogain);
    theDevice	-> setVFOFrequency (frequency);
    theDevice	-> restartReader ();
    theDevice	-> setGain (theGain);
    if (autogain)
       theDevice	-> set_autogain (autogain);
    theDevice	-> setVFOFrequency (frequency);
  //
  //	The device should be working right now

    theRadio -> startProcessing ();

This sometimes gives me the following segfault:

#0  0x00007ffff6159a43 in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
#1  0x000055555588cbe2 in mscHandler::process_mscBlock (this=0x7fffe4005f20, b=0x8001fa649fc0, blkno=1) at /home/bart/Projects/dab-cmdline/library/src/backend/msc-handler.cpp:123
#2  0x000055555587e527 in dabProcessor::run (this=0x7fffe4001400) at /home/bart/Projects/dab-cmdline/library/src/dab-processor.cpp:218
#3  0x000055555587f456 in std::__invoke_impl<void, void (dabProcessor::*)(), dabProcessor*> (__f=@0x7fffe40061e0: &virtual dabProcessor::run(), __t=@0x7fffe40061d8: 0x7fffe4001400)
    at /usr/include/c++/8.2.0/bits/invoke.h:73
#4  0x000055555587ec2a in std::__invoke<void (dabProcessor::*)(), dabProcessor*> (__fn=@0x7fffe40061e0: &virtual dabProcessor::run(), __args#0=@0x7fffe40061d8: 0x7fffe4001400)
    at /usr/include/c++/8.2.0/bits/invoke.h:95
#5  0x000055555588047d in std::thread::_Invoker<std::tuple<void (dabProcessor::*)(), dabProcessor*> >::_M_invoke<0ul, 1ul> (this=0x7fffe40061d8) at /usr/include/c++/8.2.0/thread:234
#6  0x0000555555880423 in std::thread::_Invoker<std::tuple<void (dabProcessor::*)(), dabProcessor*> >::operator() (this=0x7fffe40061d8) at /usr/include/c++/8.2.0/thread:243
#7  0x00005555558803f8 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (dabProcessor::*)(), dabProcessor*> > >::_M_run (this=0x7fffe40061d0)
    at /usr/include/c++/8.2.0/thread:186
#8  0x00007ffff6419043 in execute_native_thread_routine () at /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:80
#9  0x00007ffff73a5a8d in start_thread () from /usr/lib/libpthread.so.0
#10 0x00007ffff60f5823 in clone () from /usr/lib/libc.so.6

Any idea what might cause this or how should I cleanly delete and recreate the device and radio?

Compile error

Getting error when trying to compile on RaspberryPi:

Scanning dependencies of target dab_lib
[  2%] Building CXX object CMakeFiles/dab_lib.dir/src/dab-api.cpp.o
In file included from /usr/include/c++/4.9/atomic:38:0,
                 from /root/dab-cmdline/dab-library/./includes/dab-class.h:36,
                 from /root/dab-cmdline/dab-library/src/dab-api.cpp:30:
/usr/include/c++/4.9/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from /usr/include/c++/4.9/atomic:41:0,
                 from /root/dab-cmdline/dab-library/./includes/dab-class.h:36,
                 from /root/dab-cmdline/dab-library/src/dab-api.cpp:30:
/usr/include/c++/4.9/bits/atomic_base.h:74:3: error: ‘constexpr’ does not name a type
   constexpr memory_order

....
etc

cmake include_directories: /usr/include breaks cross-build

Many thanks for developing and sharing this great software. It works well for me, but there is one irritation with the cmake configuration files that means I always have to patch them before I can build.
Is there a specific reason why many of the CMakeLists.txt files in this project explicitly add /usr/include to the "include_directories" ? I ask because this breaks cross-compilation, causing the cross compiler to look in the build system's native /usr/include folder before the desired sysroot /usr/include.
I can't imagine there is any sane c++ toolchain that does not automatically search for system header files in /usr/include, so my preferred fix is to just delete that line from all CMakeLists.txt files.
If there is some obscure reason why dab-cmdline really does need to explicitly tell the compiler to search /usr/include, then can I ask that the line be edited to "=/usr/include" as that would tell the compiler to use the correct sysroot?
I can prepare a pull request with either of the above 2 changes if you are happy to accept either of them.

Display program name characters correctly

Hi,

The following I/Q sample has some special characters in program names.

La 1ère BXL
La 1ère Wallonie
VivaCité

Test Musiq3 +    (6358) is part of the ensemble
BRF 2            (6367) is part of the ensemble
BRF 1            (6366) is part of the ensemble
La 1�re Wallonie (6351) is part of the ensemble
TPEG_PACKET      (data) (E0606361) is part of the ensemble
Musiq3           (6353) is part of the ensemble
La 1�re BXL      (6951) is part of the ensemble
VivaCit�         (6052) is part of the ensemble
Test Classic 21+ (6356) is part of the ensemble
Classic 21       (6354) is part of the ensemble
TARMAC           (6357) is part of the ensemble
Pure             (6355) is part of the ensemble

The é and è are using extended ascii code 130 and 138.

Is there a way to detect way what encoding is used in program name using library or the program should handled it somehow?

Here is a RAW I/Q sample: 20171226_092958_12B.iq 39.1 MB

Problem with main.cpp building example-3

Hello, excellent project, thank you. In trying to build example-3, I ran in to a problem:

src/dab-cmdline/example-3/main.cpp: In function ‘int main(int, char**)’:
src/dab-cmdline/example-3/main.cpp:324:11: error: ‘theGain’ was not declared in this scope
           theGain = atoi (optarg);

After looking at some of the code, I added a definition in to main.cpp:

int             deviceGain      = 45;   // scale = 0 .. 100
int             theGain         = deviceGain;

This seemed to resolve the issue.
Regards,
Bryan

library: install headers

Hi,

The make install of the library, installs only libdab_lib.so

I think it should install also the headers in /usr/local/include by default.

Random "Sorry cannot handle service"

I compiled and run the examples 2 and 3 on a Raspberry Pi4 with a RTL SDR USB dongle.
Randomly they fail to start with "cannot handle service XY", sometimes at the immediately following attempt it works as expected, sometimes it fails various times in a row. It comes from the is_audioService check and when the error happens the service I'm trying to play is listed as part of the ensemble as normally.
Also sometimes the audio interrupts for few seconds.

On the very same hardware qt-dab works flawlessly, never experienced audio interruptions or failures to start a channel. The signal appears to be good, the dongle is attached to the TV VHF antenna and qt-dab details always show full green bars.

Any idea?

is there a way to use this with SDR#

Hi was wondering if you have any idea how could I use this with SDR# (I was thinking of writing a plugin to output I/Q data out), but then don't know how would I pipe that into dab-cmdline

Thanks for Anwsering and Best Regards

programDataHandler does not trigger

Hi,

I hope you are fine!

I am testing latest version of dab-cmdline and notice a minor issue.
The programDataHandler doesn't trigger any more.

As a workaround when selecting a new audio, I am calling programDataHandler(ad, null) from program.

Best Regards,
Athanasios

How to use raw files

Hi @JvanKatwijk,

First of all thanks for the great job you are doing with DAB/DAB+.

I would like to know how can I use the samples with raw files (eg like the ones available here: https://sdr.kt.agh.edu.pl/sdrdab-decoder/download.html#download-data)

I would like extend a small plugin for Enigma2 (https://github.com/satdreamgr/SDGRadio) with DAB/DAB+ and your repository seems the most promising.

Currently I have manage to compile example3 (with -DWAVFILES=ON), but samples are not recognized.

# dab-files-3 -F ./antena-1_dab_229072kHz_fs2048kHz_gain42_1.raw
dab_cmdline V 1.0alfa,
                          Copyright 2017 J van Katwijk, Lazy Chair Computing
opt = F
file ./antena-1_dab_229072kHz_fs2048kHz_gain42_1.raw no legitimate sound file
allocating device failed (24), fatal

Once again thank you.

mp2processor class does not initialize ctx member variable

When using the "UserData" field in callbacks, I get a segfault playing DAB audio. I found that this is because the userdata pointer i am given in the callback is null.

It turns out this is because the constructor in /library/src/backend/audio/mp2processor.cpp does not initialize the ctx member variable of the mp2processor object. By adding
this->ctx = ctx;
to the constructor body the segfault goes away and I get really faultless audio from the BBC national ensemble in the UK using an RPi 2B+ and a cheap RTL SDR USB device.

Program selection selects the wrong program when presented with two very close options

538              (83C7) is part of the ensemble
100% NL          (83D3) is part of the ensemble
Qmusic           (83C8) is part of the ensemble
BNR Nieuwsradio  (83D1) is part of the ensemble
SLAM!            (82A5) is part of the ensemble
Sky Radio        (83C6) is part of the ensemble
Veronica         (83E1) is part of the ensemble
Radio Maria      (8816) is part of the ensemble
538TOP40         (8802) is part of the ensemble
Radio 10         (83D2) is part of the ensemble
Sublime          (82A8) is part of the ensemble
TPEG 538         (data) (E3880101) is part of the ensemble
Sky Radio Hits   (8808) is part of the ensemble
Sublime You      (8814) is part of the ensemble
Qmusic non-stop  (8804) is part of the ensemble
Radio 10 60s&70s (8818) is part of the ensemble
TPEG 538         (data) (E3880101) is part of the ensemble
GrootNieuwsRadio (8961) is part of the ensemble

./dab-rtlsdr-4 -C 11C -G 90 -P '538'

selects 538TOP40 rather than 538

I am able to work around the issue with:

./dab-rtlsdr-4 -C 11C -G 90 -S 83C7

Handle MOT data

Hi,

Is there a way on dab-cmdline to handle the MOT data.

If not it would be really nice if we can add a "dump folder" where MOT data stored there. Also having a callback in order to inform program about the availability of a new object in dump directory.

Thanks,
Athanasios

Example-6 changing channel no longer works for RTL-SDR

In this commit: 9cb2bb0
These lines were deleted in devices/rtlsdr-handler/rtlsdr-handler.cpp

void	rtlsdrHandler::setVFOFrequency	(int32_t f) {
	frequency	= f;
	(void)(this -> rtlsdr_set_center_freq (device, f + vfoOffset));
}

int32_t	rtlsdrHandler::getVFOFrequency	(void) {
	return (int32_t)(this -> rtlsdr_get_center_freq (device)) - vfoOffset;
}

Which breaks example-6:

case Q_CHANNEL:
...
{  int frequency = theBandHandler -> Frequency (my_radioData. theBand,
	                                              my_radioData. theChannel);
	            theDevice	-> setVFOFrequency (frequency);
	         }

So that setVFOFrequency no longer does anything and after restarting the radio it just uses the old frequency with which the radio was initialized:

theDevice	= new sdrplayHandler (frequency,
	                                      my_radioData. ppmCorrection,
	                                      my_radioData. theGain,
	                                      my_radioData. autogain,
	                                      0,
	                                      0);

Example-3 no longer works

First of all thanks for this great repository, I have a SDRPLAY and have been using it to play DAB+ using this repo.

I have been testing using code based on the example-3. I see that you've been busy upgrading the library to a newer version. This seems to have broken example-3.

The CMakeLists.txt of example-3 has a reference to a file that is renamed:
https://github.com/JvanKatwijk/dab-cmdline/blob/master/example-3/CMakeLists.txt#L336

I changed this to ../library/src/backend/data/mot/mot-handler.cpp and it compiles again. When I run the example it gets to the point where it dab_service(a radio station), but there is no data written to stdout and sometimes I also get a segmentation fault.

Any help would be appreciated.

Stack corruption in reedSolomon::decode_rs

Hi,

It looks like there is stack corruption in reedSolomon::decode_rs().

It has:

uint8_t omega [nroots];

Then calls computeOmega()

Which does:

omega [nroots] = codeLength;

omega [nroots] is beyond the end of the allocated array (which of course only goes to nroots-1).

Get complete ensemble via ETI or API

It would be great to have an option to get the complete ensemble as ETI, instead of just a particular channel (maybe eti-frontend of your eti-stuff would be a better starting point for this feature; currently it outputs already ETI, but needs further user interaction).

Or to just get the FIC and any desired subchannel in "raw mode" via the API.

This way one would have a replacement for dab2etiof the dabtools when using DABlin and would be able to easily use other hardware than a Realtek stick with it.

Compile error

Hello,
I have the same error #1
My version of gcc is 6.3

root@player:~/dab-cmdline/example-1/build# cmake .. -DRTLSDR=ON
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type not specified: defaulting to release.
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29") 
-- Checking for module 'librtlsdr'
--   Found librtlsdr, version 0.5.3
-- Found librtlsdr: /usr/include, /usr/lib/arm-linux-gnueabihf/librtlsdr.so
-- Found LibSampleRate: 
-- Checking for module 'portaudio-2.0'
--   Found portaudio-2.0, version 19
-- Performing Test PORTAUDIO2_FOUND
-- Performing Test PORTAUDIO2_FOUND - Success
-- Found PORTAUDIO: /usr/include  
-- Configuring done
-- Generating done
-- Build files have been written to: /root/dab-cmdline/example-1/build
root@player:~/dab-cmdline/example-1/build# make
Scanning dependencies of target dab-rtlsdr
[ 12%] Building CXX object CMakeFiles/dab-rtlsdr.dir/root/dab-cmdline/devices/rtlsdr-handler/rtlsdr-handler.cpp.o
[ 25%] Building CXX object CMakeFiles/dab-rtlsdr.dir/main.cpp.o
/root/dab-cmdline/example-1/main.cpp: In function ‘void programnameHandler(std::__cxx11::string, int, void*)’:
/root/dab-cmdline/example-1/main.cpp:100:9: warning: unused variable ‘i’ [-Wunused-variable]
 int16_t i;
         ^
/root/dab-cmdline/example-1/main.cpp: In function ‘int main(int, char**)’:
/root/dab-cmdline/example-1/main.cpp:318:28: error: invalid conversion from ‘void (*)(bool, void*)’ to ‘ensemblename_t {aka void (*)(std::__cxx11::basic_string<char>, int, void*)}’ [-fpermissive]
                            );
                            ^
/root/dab-cmdline/example-1/main.cpp:318:28: error: invalid conversion from ‘void (*)(bool, int16_t, int32_t, void*) {aka void (*)(bool, short int, int, void*)}’ to ‘programname_t {aka void (*)(std::__cxx11::basic_string<char>, int, void*)}’ [-fpermissive]
/root/dab-cmdline/example-1/main.cpp:318:28: error: invalid conversion from ‘void (*)(std::__cxx11::string, int, void*) {aka void (*)(std::__cxx11::basic_string<char>, int, void*)}’ to ‘fib_quality_t {aka void (*)(short int, void*)}’ [-fpermissive]
/root/dab-cmdline/example-1/main.cpp:318:28: error: invalid conversion from ‘void (*)(std::__cxx11::string, int, void*) {aka void (*)(std::__cxx11::basic_string<char>, int, void*)}’ to ‘audioOut_t {aka void (*)(short int*, int, int, bool, void*)}’ [-fpermissive]
/root/dab-cmdline/example-1/main.cpp:318:28: error: invalid conversion from ‘void (*)(int16_t, void*) {aka void (*)(short int, void*)}’ to ‘dataOut_t {aka void (*)(std::__cxx11::basic_string<char>, void*)}’ [-fpermissive]
/root/dab-cmdline/example-1/main.cpp:318:28: error: invalid conversion from ‘void (*)(int16_t*, int, int, bool, void*) {aka void (*)(short int*, int, int, bool, void*)}’ to ‘bytesOut_t {aka void (*)(unsigned char*, short int, unsigned char, void*)}’ [-fpermissive]
/root/dab-cmdline/example-1/main.cpp:318:28: error: invalid conversion from ‘void (*)(std::__cxx11::string, void*) {aka void (*)(std::__cxx11::basic_string<char>, void*)}’ to ‘programdata_t {aka void (*)(audiodata*, void*)}’ [-fpermissive]
/root/dab-cmdline/example-1/main.cpp:318:28: error: invalid conversion from ‘void (*)(uint8_t*, int16_t, uint8_t, void*) {aka void (*)(unsigned char*, short int, unsigned char, void*)}’ to ‘programQuality_t {aka void (*)(short int, short int, short int, void*)}’ [-fpermissive]
/root/dab-cmdline/example-1/main.cpp:318:28: error: invalid conversion from ‘void (*)(audiodata*, void*)’ to ‘motdata_t {aka void (*)(std::__cxx11::basic_string<char>, int, void*)}’ [-fpermissive]
/root/dab-cmdline/example-1/main.cpp:318:28: error: cannot convert ‘void (*)(int16_t, int16_t, int16_t, void*) {aka void (*)(short int, short int, short int, void*)}’ to RingBuffer<std::complex<float> >*’ for argument ‘14’ to ‘void* dabInit(deviceHandler*, uint8_t, syncsignal_t, systemdata_t, ensemblename_t, programname_t, fib_quality_t, audioOut_t, dataOut_t, bytesOut_t, programdata_t, programQuality_t, motdata_t, RingBuffer<std::complex<float> >*, RingBuffer<std::complex<float> >*, void*)’
/root/dab-cmdline/example-1/main.cpp:368:58: error: invalid conversion from ‘int32_t {aka int}’ to ‘void*’ [-fpermissive]
     programName = dab_getserviceName (serviceId, theRadio);
                                                          ^
In file included from /root/dab-cmdline/example-1/main.cpp:33:0:
/root/dab-cmdline/example-1/../dab-api.h:223:13: note:   initializing argument 1 of ‘std::__cxx11::string dab_getserviceName(void*, int32_t)’
 std::string dab_getserviceName (void *, int32_t);
             ^~~~~~~~~~~~~~~~~~
/root/dab-cmdline/example-1/main.cpp:368:58: error: invalid conversion from ‘void*’ to ‘int32_t {aka int}’ [-fpermissive]
     programName = dab_getserviceName (serviceId, theRadio);
                                                          ^
In file included from /root/dab-cmdline/example-1/main.cpp:33:0:
/root/dab-cmdline/example-1/../dab-api.h:223:13: note:   initializing argument 2 of ‘std::__cxx11::string dab_getserviceName(void*, int32_t)’
 std::string dab_getserviceName (void *, int32_t);
             ^~~~~~~~~~~~~~~~~~
CMakeFiles/dab-rtlsdr.dir/build.make:86: recipe for target 'CMakeFiles/dab-rtlsdr.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/dab-rtlsdr.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/dab-rtlsdr.dir/all' failed
make[1]: *** [CMakeFiles/dab-rtlsdr.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
root@player:~/dab-cmdline/example-1/build# 

Originally posted by @mickaelmonsieur in #1 (comment)

Cannot compile, CMakeLists.txt not found

andreas@T42:$ cd dab-cmdline/
andreas@T42:
/dab-cmdline$ mkdir build
andreas@T42:/dab-cmdline$ cd build/
andreas@T42:
/dab-cmdline/build$ cmake ..
CMake Error: The source directory "/home/andreas/dab-cmdline" does not appear to contain CMakeLists.txt.

I followed your suggestions, but I could not compile it. I found the file there:

./example/CMakeLists.txt
./dab-library/devices/rtl_tcp/CMakeLists.txt
./dab-library/CMakeLists.txt

Am I wrong?

streamInit() failed in python-example

Hello gain. I've been playing around with all the examples (using MSVC and clang-cl).
Now I've patched an successfully linked libdab_lib.pyd (using Python 3.6.5).

Building with HAVE_SDPLAY and using py -3 cmdline.py -C12D, I get a weird error from mir_sdr_StreamInit():

sdrdevice found = 1803049E94, hw Version = 255
device installed
Error 3 on streamInit
Error 3 on streamInit
restart failed
no ensemble found, giving up

Error 3 is mir_sdr_OutOfRange. Which I assume is frequency out-of-range.
First I used theDevice->defaultFrequency(); -> failed with Error 3 on streamInit.
I then patched startProcessing_p() to say just:

	b = theDevice	-> restartReader (220);

thinking it should be in MHz, but no. The same Error 3 on streamInit.

So how is the frequency supposed to be set?

Stuttering audio

I'm having some trouble with this dab-cmdline application on Raspbian (RPi 3b+).
When listening to a DAB+ radio station in Belgium, I always get stuttering audio.
When using Dablin together with eti-cmdline I get also stuttering audio.
On Windows I get nice sound without any hickups. So it isn't a reception issue.

What could be causing this problem?

Used command:
./dab-rtlsdr-3 -C 12A -P Klara -Q | aplay -r 48000 -f S16_LE -t raw -c 2 -v

Output:

                          Copyright 2017 J van Katwijk, Lazy Chair Computing
opt = C
opt = P
opt = Q
going for rtlsdr 223936000 45
OK, functions seem to be loaded
Found Fitipower FC0012 tuner
samplerate set to 2048000
Supported gain values (5): -9.-9 -4.0 7.1 17.9 19.2 
effective gain: gain 7.1
ensemble DAB+ VRT         is (6001) recognized
Radio 1          (6301) is part of the ensemble
Klara            (6303) is part of the ensemble
Radio 2 LIM      (6602) is part of the ensemble
Studio Brussel   (6304) is part of the ensemble
Radio 2 O-VL     (6C02) is part of the ensemble
Radio 2 ANT      (6502) is part of the ensemble
TPEG             (data) (E0600001) is part of the ensemble
Radio 2 W-VL     (6B02) is part of the ensemble
Radio 2 VL-BR    (6402) is part of the ensemble
MNM              (6305) is part of the ensemble
VRT NWS          (631E) is part of the ensemble
MNM Hits         (631F) is part of the ensemble
Klara Continuo   (631A) is part of the ensemble
there might be a DAB signal here

we try to start program Klara
protection handler is eep_protection
we have now DAB+
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Hardware PCM card 0 'bcm2835 ALSA' device 0 subdevice 0
Its setup is:
  stream       : PLAYBACK
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 24000
  period_size  : 6000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 6000
  period_event : 0
  start_threshold  : 24000
  stop_threshold   : 24000
  silence_threshold: 0
  silence_size : 0
  boundary     : 1572864000
  appl_ptr     : 0
  hw_ptr       : 0`

can not compile the library on pi3 with osmc (debian jessie)

i got this error

osmc@osmc:$ sudo apt-get install fftw3
Reading package lists... Done
Building dependency tree
Reading state information... Done
fftw3 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
osmc@osmc:
$ git clone https://github.com/JvanKatwijk/dab-cmdline
Cloning into 'dab-cmdline'...
remote: Counting objects: 1668, done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 1668 (delta 57), reused 78 (delta 42), pack-reused 1560
Receiving objects: 100% (1668/1668), 3.07 MiB | 456.00 KiB/s, done.
Resolving deltas: 100% (1034/1034), done.
Checking connectivity... done.
osmc@osmc:$ cd dab-cmdline/
osmc@osmc:
/dab-cmdline$ cd library/
osmc@osmc:/dab-cmdline/library$ mkdir build
osmc@osmc:
/dab-cmdline/library$ cd build
osmc@osmc:~/dab-cmdline/library/build$ cmake -std=gnu++11 .. -DRTLSDR=ON
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Build type not specified: defaulting to release.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Could NOT find FFTW3F (missing: FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIRS)
CMake Error at CMakeLists.txt:30 (message):
please install FFTW3

-- Configuring incomplete, errors occurred!
See also "/home/osmc/dab-cmdline/library/build/CMakeFiles/CMakeOutput.log".

dab_cmdline unable to locate shared library

I've followed your guide, but when I try to run dab_cmdline I get the following error:
./dab_cmdline: error while loading shared libraries: libdab_lib.so: cannot open shared object file: No such file or directory

This may be a stupid question, but am I supposed to move libdab_lib.so somewhere after I build?
(The install places the lib correctly into /usr/local/lib)

library/dab-api.cpp error: ‘syncsignalHandler’ was not declared in this scope

Failed to build the library subproject. It seems a refactoring has broken the variable passing in the current revision of library/dab-api.cpp.

The method dabInit declares varname_Handler and the code tries to use varnameHandler.

void	*dabInit   (deviceHandler       *theDevice,
	            uint8_t             Mode,
	            RingBuffer<std::complex<float>> *spectrumBuffer,
	            RingBuffer<std::complex<float>> *iqBuffer,
	            syncsignal_t        syncsignal_Handler,
	            systemdata_t        systemdata_Handler,
	            ensemblename_t      ensemblename_Handler,
	            programname_t       programname_Handler,
	            fib_quality_t       fib_quality_Handler,
	            audioOut_t          audioOut_Handler,
	            dataOut_t           dataOut_Handler,
	            bytesOut_t		bytesOut_Handler,
	            programdata_t       programdata_Handler,
	            programQuality_t    programquality_Handler,
	            motdata_t		motdata_Handler,
	            void                *userData) {
dabClass *theClass = new dabClass (theDevice,
	                           Mode,
	                           spectrumBuffer,
	                           iqBuffer,
	                           syncsignalHandler,
	                           systemdataHandler,
	                           ensemblenameHandler,
	                           programnameHandler,
	                           fib_qualityHandler,
	                           audioOut_Handler,
	                           dataOut_Handler,
	                           bytesOut_Handler,
	                           programdataHandler,
	                           program_qualityHandler,
	                           motdata_Handler,
	                           userData);
	return (void *)theClass;
}

Fixing it made the lib build successful again.

...
{
dabClass *theClass = new dabClass (theDevice,
	                           Mode,
	                           spectrumBuffer,
	                           iqBuffer,
	                           syncsignal_Handler,
	                           systemdata_Handler,
	                           ensemblename_Handler,
	                           programname_Handler,
	                           fib_quality_Handler,
	                           audioOut_Handler,
	                           dataOut_Handler,
	                           bytesOut_Handler,
	                           programdata_Handler,
	                           programquality_Handler,
	                           motdata_Handler,
	                           userData);
	return (void *)theClass;
}

Compiling Simple DAB

I tried to compile under Ubuntu with Qt-creator, but after 35 seconds it stops compiling:

usr/bin/ld: **/tmp/ccM3phWs.ltrans5.ltrans.o**: undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libdl.so.2: error adding symbols: DSO aus der Kommandozeile fehlt
Makefile:276: die Regel für Ziel „linux-bin/simpleDab“ scheiterte
collect2: error: ld returned 1 exit status
make: *** [linux-bin/simpleDab] Fehler 1
20:57:02: Der Prozess "/usr/bin/make" wurde mit dem Rückgabewert 2 beendet.
Fehler beim Erstellen/Deployment des Projekts simple-dab (Kit: Desktop Qt 5.8.0 GCC 64bit)
Bei der Ausführung von Schritt "Make"
20:57:02: Verstrichene Zeit: 00:35.

or on console with make

/tmp/cchtDiBr.ltrans0.ltrans.o: In Funktion `simpleDab::simpleDab(QSettings*, QWidget*) [clone .constprop.38]':
<artificial>:(.text+0x2226): Nicht definierter Verweis auf `dabInit'
/tmp/cchtDiBr.ltrans1.ltrans.o: In Funktion `simpleDab::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)':
<artificial>:(.text+0x9b): Nicht definierter Verweis auf `dabStop'
<artificial>:(.text+0x5c3): Nicht definierter Verweis auf `dabStartProcessing'
<artificial>:(.text+0xb5f): Nicht definierter Verweis auf `dabService'
<artificial>:(.text+0xc1b): Nicht definierter Verweis auf `dabReset'
collect2: error: ld returned 1 exit status
Makefile:186: die Regel für Ziel „linux-bin/simpleDab“ scheiterte
make: *** [linux-bin/simpleDab] Fehler 1

there are no files in /tmp/ starting with cc*.*


If I comment out the spectrum,

#CONFIG += spectrum

the error is

simple-dab.cpp:119: Fehler: ‘spectrumHandler’ was not declared in this scope
  spectrumHandler = NULL;
  ^

64k uep_protection

HI

Noticed a small detail in the profile table at /library/src/backend/uep-protection.cpp

Text labels were not shown properly at 64k (though OK at other rates)

Changed one line in the profileTable array
from:
{64, 4, 6, 9, 33, 0, 11, 6, 6, -1},
to:
{64, 4, 6, 9, 33, 0, 11, 6, 5, -1},
seems to have fixed the problem

Congratulations on such a great program!!

example5: selectNext fails

Hi,

The selectNext always fails to execute using latest HEAD (ef4e881)

program Kosmos           is part of the ensemble
program Voice Of Greece  is part of the ensemble
program Era 7            is part of the ensemble
program Trito            is part of the ensemble
there might be a DAB signal here

[New Thread 0x7fffec3cf700 (LWP 13339)]
we try to start program Kosmos
listener is running
we have now DAB+
[New Thread 0x7fffeaf88700 (LWP 13340)]
selected Kosmos
	startaddress	= 536
	length		= 128
	subChId		= 4
	protection	= 1
	bitrate		= 128

we now try to start program Voice Of Greece
[Thread 0x7fffeaf88700 (LWP 13340) exited]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffec3cf700 (LWP 13339)]
0x000000000042e69a in audioBackend::~audioBackend() ()
(gdb) bt
#0  0x000000000042e69a in audioBackend::~audioBackend() ()
#1  0x000000000042e799 in audioBackend::~audioBackend() ()
#2  0x000000000041bd5a in dabClass::dab_service(std::string) ()
#3  0x000000000041079d in selectNext() ()
#4  0x0000000000410a30 in listener() ()
#5  0x00007ffff6962970 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff759f064 in start_thread (arg=0x7fffec3cf700) at pthread_create.c:309
#7  0x00007ffff60d262d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

jack server?

Cant get it to work, any idea?

root@margyge:~/dab-cmdline/example/build# ./dab_cmdline -M 1 -B "BAND III" -G 80
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused

Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Hostapis: 2
Api 0 is ALSA
Api 1 is OSS
selecting device default
device bcm2835 ALSA: - (hw:0,0) seems available as 0
device bcm2835 ALSA: IEC958/HDMI (hw:0,1) seems available as 1
device sysdefault seems available as 2
device default seems available as 3
device dmix seems available as 4
Suggested size for outputbuffer = 512
OK, functions seem to be loaded
Found Fitipower FC0012 tuner
samplerate set to 2048000
Supported gain values (5): going to tell the world
no ensemble, quittingwe told the world
ofdmProcessor is shutting down

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.