Tuesday, April 22, 2008

Developng an iMON client for MythTV

Over the last few weeks I haven't posted anything here. I've been using whatever time I could to work on developing an iMON client that can interface with MythTV. I've been making some decent process, and although I have a lot of features I still want to implement, I think I might be ready to release a limited-functionality alpha version in a few days. For now, I just want to discuss why I'm developing it and what it has to offer over the standard mythlcdserver.


Why not use mythlcdserver

The iMON LCD device has a lot of new capabilities. It's not just a standard 16x2 (or whatever) text display. It goes way beyond that. It's actually a 96x16 pixel display (1-bit each). In addition to displaying text, it can display arbitrary graphics. This gives it a lot of options. You can use custom bitmapped fonts of any size. You can draw symbols on the display. Really, anything you can imagine. The only real limitation (other than size and bit depth) is that, like a lot of inexpensive LCDs, the response time is a bit slow, so animations don't work well (it kind of blurs together).

In addition, the iMON also supports custom icons. You can turn on icons for different a/v formats (mp3, divx, dts, etc), icons to represent the number of audio channel, and a bunch of others.

These sort of features are completely absent from mythlcdserver. They aren't something that would work with a small tweak. They would require a complete overhaul of the application. It would also require some changes to the way myth itself works, since currently myth doesn't provide any of this data to mythlcdserver. In the end, it would be a huge change, which presents 2 obstacles. First, getting a change that major into myth would be a bit difficult (I've had significantly smaller changes in there for months without anybody accepting/rejecting or even commenting on it). The second is that, even if it were to get included, it would require a myth recompile for people, or would make people wait until the changes made it into the next release of mythtv (or mythbuntu, knoppmyth, etc).

In summary, it just seemed to me to be better to do it in a new application.


What cool things can be done?

The first obvious thing that can be done is to support the iMON's 40+ icons. The next thing you can do is to use the 4 horizontal lines as progress bars, instead of wasting an entire row of the display on the progress bar. This gives you more space for display info while still having the progress bar visible at all times.

As I already mentioned, the bitmapped LCD gives a lot of options for bitmapped fonts. Not only can you do half height text (8 pixel) or full height (16 pixel), but you can do any size you want. Perhaps a slightly bigger 11 pixel font on top and a tiny 5 pixel font on the bottom. Or instead of the 5 pixel font, you can display icons across the bottom for the functionality of the front panel buttons (pause, rewind, etc).


How does it get the data

The correct way to get the data would be explicitly from myth. However, as I already stated, this data isn't readily available, and making it available would require a wide range of modifications to mythtv. Instead, I'm going the quick and dirty route. I collect the data from a variety of sources. I pretend to be the mythlcdserver program and monitor port 6545. I scrape data from log files. I gather data from the network control on port 6546. I watch for IR commands. I then weave all of this data together to get a coherent picture of what is going on in myth. It's not 100% perfect, but it works well enough to make me happy.



No comments: