I previously said I'd have to get back to the ffmpeg for IZ2S later...
So after I finally completed ziptuner v1.3 I did just that. I suspect ffmpeg is gonna be a long term effort to get it to do everything I want, but at least it seems possible. To get it started I leveraged the google search AI to help assemble a minimal configuration of mbed_tls v3.6.4, which I eventually used to build v3.6.6 despite their move to CMAKE. Perhaps for the next round I'll try to leverage this again for a v4 build. But once again, that's on the back burner til later. I wound up dropping tls 1.3 from the config for now, so it's about the same functionally as bearssl. But it looks like mbed_tls has a future and since it's also used by curl and openwrt that works for me.
I added mbed_tls into the ffmpeg config mix and ran off a new build capable of running some internet radio streams. I initially started with ffmpeg v4.4 but had some trouble compiling the channel layout code. I forget the details, but I probably should revisit this someday. Meanwhile the AI suggested a switch to ffmpeg v4.1 and it seemed to work. After a couple rounds of adding/subtracting components it weighs in at just under 2M (plus some external codecs like libopus). That's pretty reasonable on the zipit so I moved into test mode.
The AI got really enthusiastic at this point and started suggesting all sorts of enhancements for everything, but within the nonsense were the kernels of some decent ideas that I helped it refine with a few follow up prompts. I had to keep reminding it to keep the focus on "simple" solutions and resist the urge to over-engineer things. I really like the way we isolated the tail | sed log file filter pipeline from the -mp3 and -p PLAY button pipelines in the IZ2S ziptuner.sh wrapper script.
At this point the ffmpeg engine could connect to most of the internet radio stations, but the opus and ogg streams seemed to be struggling. I figured ffmpeg was probably not using the fixed point decoders. Getting that debugged on internet streams in ffmpeg was a bit of a challenge so I backed off a little and built ogg123 instead since it seemed easier to debug with music files on the SD card. Once I got ogg and opus running smoothly there I went back to work on ffmpeg. After some back and forth with the AI, we eventually settled on some confusing tweaks to the configure settings, and then some hacking on ffmpeg sources. But after all that I finally got it pulled in and working with the fixed point decoders only.
I was hoping to go with an ffmpeg only system but unfortunately ffmpeg with mbed_tls fails to complete the TLS handshake negotiation with a few stations that mpg123 with curl and bearssl handles just fine. Oh well. At least the dual mpg123 and ffmpeg setup is viable. While testing the dual player setup I noticed some stations were spamming stream title updates every second or so so I patched mpg123 to only print the first update for each song change. I also learned running mpg123 with script disrupts dialog input unless I feed it from </dev/null, so I fixed that as well.
All the testing gave me some ideas for some simple but effective ziptuner improvements, so I coded them up. Now when the -l logfile option is used it automatically bring up the log viewer screen whenever you start to PLAY a station. This was handy for debugging the song title filter pipeline but I decided I just like it for normal use as well. I also added some -x,y,z command options to launch external commands from ziptuner main menu for easy access to handy things like the mixer.
At this point, with the AI onboard, I finally felt like I might be able to tackle the zombie problem on IZ2S. I grilled it with questions, hints, and suggestions and and finally forced a few answers out of it that seemed to help. It looks like the ancient busybox init on initial ramdisk in the stock 2.6.21.1 kernel is so old that it only reaps zombies from programs run in inittab. Any normal init process will reap the orphaned zombies and keep the process table clean. That finally explains why the zombies are so annoying on IZ2S.
I also learned all sorts of details about what sorta process tree I get with different approaches to run the player programs, and how to view it through the /proc filesyste. Using system() to run the STOP command was guaranteed to create a zombie since it blocks the SIGCHLD sygnal, which thwarts any sorta waitpid trap in the ziptuner. I fixed this, and pruned the process tree to get ffmpeg situated as a direct child of ziptuner and voila, no zombies on IZ2S with the ffmpeg player pipeline.
At this point I decided it was time for a ziptuner v1.4 release.
I still need to hack ffmpeg some more to get song title updates from aac and ogg/opus streams, and also figure out how to fix the tls handshake so I can drop the double player on IZ2S.


