My primary target for the set top box project is, of course, the Raspberry Pi 2 – it’s a handy platform to build simple embedded appliances on, just like a little set top box, but I wanted to expand its reach a bit for
showing offtesting. My first thought was to port it to Windows, but after much arsing about with msys2 and mingw32 and getting precisely nowhere, I eventually gave up and turned to Linux. Many hours and much staining of my desk with the blood from my forehead, I have just about managed to port something resembling my project sufficiently that it runs in a Debian VM. See exhibits A and B below:
You’ll note that it’s not perfect, the text rendering is boned and I’m going to have to attempt to fix it, because it looks horrible, and video streaming is touchy at best (potentially requiring transcoding, which is too CPU-intensive for dozens of concurrent channels, at least without dedicated machines to do it).
But, during this painful misery of hacking at crap code, I have learnt one thing: just because a framework exists does not mean it’s a good idea to use it. I’m using openFrameworks to build this project on, I discovered it some time back and latched onto it because it allowed me to quickly set myself on the path to being able to program graphical things for Linux. All very well, of course, it did very much speed my path to being able to do so, but it turns out that it’s not as “standard” as you might expect. It uses different video libraries on just about every platform, and it doesn’t do a terribly good job of hiding that fact. Admittedly, my Pi code makes use of ofxOMXPlayer, which is a plugin designed explicitly for the Pi and nothing much else, but on Linux in general it uses GStreamer (inefficient and slow on the Raspberry Pi), on OSX it appears to use QuickTime, and on Windows it… well, I can’t even work out what it uses, but it sure didn’t work.
My solution to this seemed simple. Pick another plugin, one that’d work cross-platform, VLC perhaps. Alas, I was thwarted by the fact that the early efforts to include VLC by what I believe to be one of the openFrameworks devs had been abandoned, and the only other option looked like it was probably a lot of hassle to work with. Other plugins seemed to be platform-specific or incomplete too. Call me lazy if you like, but what’s important to me when I’m writing code for a project is being able to write code for my project, not spending days fruitlessly wrestling with stuff that’s probably not going to work no matter how hard I try, or helplessly pawing at my keyboard in the vain hope that I might be able to pretend I know what I’m doing with just enough capability to hack something towards functionality.
So ultimately I ended up with Windows not being an option, Linux being just barely possible (with work), and the Pi version being about as unstable as it ever was. I don’t mean to be an arse about people contributing free code to the world, and mine certainly isn’t brilliant, but I really do wish that this stuff was easier to work with. In this case, it’s openFrameworks and all its associated third party plugins, and if it worked the way it claims to it’d be brilliant, a simple cross-platform framework that includes more than the basics, a plethora of tools and code to get you started. But that’s the bait that get you hooked. It turns out hooks are painful.