Skip to content

Commit

Permalink
jsoncpp -> nlohmann_json
Browse files Browse the repository at this point in the history
  • Loading branch information
windytan committed Jun 22, 2024
1 parent 486718f commit 03d0e70
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 7,823 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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
Expand All @@ -27,7 +27,7 @@ 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
- name: compile
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 Down Expand Up @@ -111,9 +112,14 @@ 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: Get nlohmann-json
shell: C:\cygwin\bin\bash.exe -eo pipefail '{0}'
run: >-
git clone --depth=1 https://github.com/nlohmann/json.git &&
cp -a json/include/nlohmann /usr/include
- name: Build redsea
shell: C:\cygwin\bin\bash.exe -eo pipefail '{0}'
run: meson setup 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
32 changes: 16 additions & 16 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 @@ -49,12 +47,12 @@ beginning.

1. Install the prerequisites. On Ubuntu:

$ sudo apt install git ninja-build build-essential python3-pip libsndfile1-dev libliquid-dev
$ sudo apt install git ninja-build build-essential python3-pip libsndfile1-dev libliquid-dev nlohmann-json3-dev
$ pip3 install --user meson

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,8 +223,9 @@ 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

Expand Down
Loading

0 comments on commit 03d0e70

Please sign in to comment.