perjantai 10. joulukuuta 2010

ExtPlane Panel for X-Plane

I bought a touchscreen monitor to use in my simpit a while ago. Unfortunately after that I noticed that X-Plane's external cockpits don't support any input - I can't press buttons and turn knobs using finger.

I almost got dismotivated by that but decided to do what any of us would do: write a plugin for X-Plane to support input from external apps and software to run my panel.

The plugin part lives inside X-Plane and starts a TCP server to get commands from. Currently it supports only reading and writing of datarefs (simulation variables) but button support is coming soon. The plugin's source code can be found at:

https://github.com/vranki/ExtPlane

The panel, called ExtPlane panel is a "client" for ExtPlane plugin. It displays a 2D panel showing various instruments. It can read and write X-Plane's datarefs via ExtPlane and display any information on screen. Currently it's aimed for making sharp, antialiased scalable vector graphic displays (as opposed to X-Plane's bitmap based) but in future "anything" can be done. Instruments can be added, moved and removed using mouse just like in X-Plane's Plane Maker.

The panel is written in Qt, so naturally i wanted to see if it would run on my Nokia N900 cell phone. As you can see, it runs without any modifications. Also there are no wires - The N900 communicates with X-Plane over WLAN connection. On the left is a airspeed gauge and on the right a compass. Currently they are the only instruments available, but it's very fast to write new ones using the framework provided. The airspeed indicator is 40 lines of code and compass is 37. The instruments can have configuration UI so that for example you can set the units used in airspeed indicator. I'll probably soon write some "generic" instruments that can show value of any dataref, just like in X-Plane.

All instrument graphics are vector graphics so they can be freely scaled and rotated while keeping graphics crystal clear. You can run the panel in portrait or landscape mode, or even with any angle.
Sources for ExtPlane-Panel can be found at:

https://github.com/vranki/ExtPlane-Panel

If you're not a developer and don't know how to build from sources, ExtPlane is not ready for you just yet. I'll need to add more instruments and do some more finishing until I'll start making binary releases for general public.

perjantai 3. joulukuuta 2010

Streaming live DVB using VLC

The problem: i needed to stream live DVB broadcast from home to the outside world. Limiting factors are bandwidth (1Mbps up) and CPU (Core 2 Duo @ 1.8Ghz). I found out a lot of guides on how to do it using VLC, but only a few worked. Source for the video in this case is a USB DVB-C tuner, but any DVB tuner which VLC sees should work.

After a lot of tuning, the best result was obtained with the following command line:

cvlc -v channels.conf \
--sout \
'#transcode{vcodec=theora,venc=theora,acodec=null,deinterlace,vb=700,fps=16,threads=2,scale=0.7}:standard{access=http,mux=ogg,dst=:8081}'

This will give a average of 700kbps ogg theora stream scaled a bit down and with 16fps
frame rate. This stream doesn't include audio, so you'll probably want to set acodec=vorbis
and audio bitrate (ab=) something sensible.

Stream is served at port 8081 and can be viewed locally at url http://localhost:8081/ using VLC or other video player. You'll need the channels.conf file (google how to obtain it). You can also use vlc instead of cvlc to get GUI. You can change channel from playlist window. This can probably also be done on command line somehow.
Set threads= to number of cores in your CPU. On Core 2 Duo it's naturally 2.



The quality can be described as "youtube-like". You don't want to watch Avatar on this but for some basic stuff such as sports, talkshows and news it's way better than no stream at all. Naturally if you have more bandwidth, increase the vb parameter. With 1M uplink 800kbps resulted in jerky video, so 700 is pretty close to optimum.

Notes on some other codecs: x264 encoder didn't obey the bitrate parameter at all and was unusable. ffmpeg created corrup video (random bright colors et all) so i decided to use ogg theora which worked really well.