Skip to content

Commit

Permalink
Replace jsoncpp with nlohmann_json
Browse files Browse the repository at this point in the history
* Fixes the compiler warnings and we can set -Werror in CI
* No need to store a patched version of the library in repo
* Breaking: Some JSON elements will be in a different order
  • Loading branch information
windytan committed Jun 23, 2024
1 parent 2d0e7ef commit 35cb13a
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 7,839 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install dependencies (apt)
run: sudo apt install python3-pip ninja-build libsndfile1-dev libliquid-dev
run: sudo apt install python3-pip ninja-build libsndfile1-dev libliquid-dev nlohmann-json3-dev
- name: Install meson (pip3)
run: pip3 install --user meson
- name: meson setup
run: meson setup build
run: meson setup -Dwerror=true build
- name: compile
run: cd build && meson compile

Expand All @@ -27,9 +27,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install dependencies (brew)
run: brew install meson libsndfile liquid-dsp catch2
run: brew install meson libsndfile liquid-dsp nlohmann-json catch2
- name: meson setup
run: meson setup build
run: meson setup -Dwerror=true build
- name: compile
run: cd build && meson compile
- name: test
Expand All @@ -51,6 +51,7 @@ jobs:
mingw-w64-x86_64-libiconv
mingw-w64-x86_64-libsndfile
mingw-w64-x86_64-meson
mingw-w64-x86_64-nlohmann-json
mingw-w64-x86_64-python3
# Disable glibc specific checks and headers
- name: Patch & build liquid-dsp
Expand All @@ -64,7 +65,7 @@ jobs:
- name: Build redsea.exe
shell: msys2 {0}
run: |
meson setup build && cd build && meson compile
meson setup -Dwerror=true build && cd build && meson compile
- name: Package into distrib
shell: msys2 {0}
run: >-
Expand Down Expand Up @@ -111,9 +112,9 @@ jobs:
make && make install
# Cygwin does not allow underscore variables that start with an uppercase when
# compiling with gcc
- name: Patch liquid-dsp
- name: Patch liquid.h
shell: C:\cygwin\bin\bash.exe -eo pipefail '{0}'
run: perl -i -p -e 's/(?<=\s)(_[A-Z])(?=[,\)])/\L\1__/g' /usr/include/liquid/liquid.h
- name: Build redsea
shell: C:\cygwin\bin\bash.exe -eo pipefail '{0}'
run: meson setup build && cd build && meson compile
run: meson setup -Dwerror=true build && cd build && meson compile
9 changes: 5 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

## HEAD

* New features:
* Add support for Enhanced RadioText (eRT)
* Add support for Long PS in Group 15A (#104)
* Add runtime option to disable error correction with --no-fec
* Maintainability:
* Migrate build system from autotools to meson (#90)
* Switch from packaged-in JsonCPP to nlohmann-json (#109)
* Add GitHub Workflows CI builds for macOS and Windows via MSYS2/MinGW + Cygwin
* Add basic Catch2 unit tests (#84)
* Add .clang-format (not automated)
* Remove unmaintained build options for non-liquid, non-TMC builds
* Fix compiler warnings, issues identified via static analysis, and other code cleanup
* New features:
* Add support for Enhanced RadioText (eRT)
* Add support for Long PS in Group 15A (#104)
* Add runtime option to disable error correction with --no-fec
* UX changes:
* Breaking: Print a warning to stderr if the raw MPX input sample rate is
not specified
Expand Down
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# redsea RDS decoder

redsea is a lightweight command-line FM-RDS decoder supporting a large [subset of RDS features][Wiki: Features].
redsea is a lightweight command-line FM-RDS decoder that supports many [RDS features][Wiki: Features].

[![release](https://img.shields.io/github/release/windytan/redsea.svg)](https://github.com/windytan/redsea/releases/latest)
![build](https://github.com/windytan/redsea/workflows/build/badge.svg)

Decoded RDS groups are printed to the terminal as [line-delimited JSON](https://jsonlines.org/) objects
or, optionally, undecoded hex blocks (`-x`). Please refer to the wiki for
[input data formats][Wiki: Input].
Its terminal output is [line-delimited JSON](https://jsonlines.org/) where
each line corresponds to one RDS group. It can also print "raw" undecoded hex blocks (`--output hex`).
Please refer to the wiki for [input data formats][Wiki: Input].

Redsea can be used with any [RTL-SDR][About RTL-SDR] USB radio stick with the
`rtl_fm` tool, or any other SDR via `csdr`, for example. It can also
decode raw ASCII bitstream, the hex format used by RDS Spy, and audio files
containing multiplex signals (MPX). These use cases are documented in
the [wiki][Wiki: Use cases].
`rtl_fm` tool, or any other SDR via a tool like `csdr` (see [wiki][Wiki: Use cases]). It can decode MPX from
raw PCM or audio files, ASCII bitstreams, the hex format used by RDS Spy, or the TEF6686 serial format.

[About RTL-SDR]: http://www.rtl-sdr.com/about-rtl-sdr
[Wiki: Features]: https://github.com/windytan/redsea/wiki/Supported-RDS-features
Expand Down Expand Up @@ -54,7 +52,7 @@ beginning.

Or on macOS using Homebrew:

$ brew install meson libsndfile liquid-dsp
$ brew install meson libsndfile liquid-dsp nlohmann-json
$ xcode-select --install

2. Clone the repository (unless you downloaded a release zip file):
Expand All @@ -73,8 +71,8 @@ How to later get the latest updates and recompile:

[liquid-dsp]: https://github.com/jgaeddert/liquid-dsp/releases/tag/v1.3.2

Build instructions for Windows are in [the wiki][Wiki: Windows build], for both Cygwin and
building an .exe with MSYS2/MinGW.
It's also possible to build redsea on Windows, either in Cygwin or by building
an .exe with MSYS2/MinGW; Instructions are in [the wiki][Wiki: Windows build].

[Wiki: Windows build]: (https://github.com/windytan/redsea/wiki/Installation#windows).

Expand Down Expand Up @@ -168,11 +166,11 @@ redsea -f WAVEFILE

### Formatting and filtering the JSON output

The JSON output can be tidied and/or colored using `jq`:
You can get tidier json output using `jq`:

$ rtl_fm ... | redsea | jq

It can also be used to extract only certain fields, for instance the program
It's also useful for extracting only certain fields, for instance the program
type:

$ rtl_fm ... | redsea | jq '.prog_type'
Expand All @@ -188,6 +186,7 @@ type:
* libiconv 1.16
* libsndfile 1.0.31
* [liquid-dsp][liquid-dsp] release 1.3.2
* nlohmann-json
* `rtl_fm` (from [rtl-sdr](http://sdr.osmocom.org/trac/wiki/rtl-sdr)) or any
other source that can output demodulated FM multiplex signals

Expand Down Expand Up @@ -224,15 +223,15 @@ information.

Also, if a station in your area is transmitting an interesting RDS feature
that should be implemented in redsea, I would be happy to see a minute or
two's worth of hex data using the `-x` switch. You could use a gist or an
external pastebin service and post a link to it.
two's worth of hex data using the `--output hex` switch. You could use a
gist or an external pastebin service and post a link to it in our Github
Discussions.

## Licensing

Redsea is released under the MIT license, which means it is copyrighted to Oona
Räisänen OH2EIQ yet you're free to use it provided that the copyright
information is not removed. (jsoncpp and iconvpp have their own licenses.)
See LICENSE.
information is not removed. (iconvpp has its own license.) See LICENSE.

This software should never be relied on for emergency communication, accurate
traffic / weather information, or when your life is on the line.
This software is not safety certified and should never be relied on for emergency
communication, accurate traffic / weather information, or when your life is on the line.
Loading

0 comments on commit 35cb13a

Please sign in to comment.