So today… having had `libsstvenc` work quite acceptably… I started to think about how I might integrate it into `websstv` which is in Python.
`ctypes` is brilliant… Okay, some limitations with regard to handling inline functions (it can't… because they're not in the .so file), but it's a very quick way to call into C code.
https://github.com/sjlongland/websstv/blob/master/websstv/libsstvenc.py
Now… when I last tried piping audio from a Python application, I found I wasn't able to deliver the audio fast enough to the subprocess (`aplay` / `sox` / `pwcat`).
I'm beginning to think the answer is to implement some bindings into an audio library.
Some options:
- http://libsound.io/ -- plain C, appears to be asynchronous and single-threaded, supports ALSA but seemingly not sndiod
- https://miniaud.io/ -- C, supports lots of backends, uses threads, supports sndiod and ALSA
- https://www.portaudio.com/ -- well known (Audacity uses it), well supported, uses threads, supports sndiod and ALSA
Of course dynamically-linking to LGPL libs is fine, so I can use `alsa-lib`… but I want to support more than just ALSA.
The other possibility is I dual-license `libsstvenc`: `libsstvenc.so` is the base MIT-licensed SSTV encoder, and then there's a `libsstvenc-gpl.so` which provides all the GPL-licensed integration into audio libraries. If you link against `libsstvenc.so` only, you're using it under a MIT license … if you link against `libsstvenc-gpl.so` too, then you've accepted the GPL.
#SSTV #AmateurRadio #Python #ctypes #HomeBrew #OpenSource #PermissiveLicense