Sunday, 30 September 2007

Depressing

After the most expensive car check and maintenance in my car owner history few weeks ago, my car died. Right in the middle of nowhere. And even worse, on my way to ICFP07.

Unfortunately, most of my planning rests on having a car, as my accommodation is not within Freiburg. Taking a plane/train to Freiburg and renting a hotel is simply way over my budget. I hope to have a working car by tomorrow, so I can make at least 50% use of my registration. Otherwise the registration fee will become a write-off in my books.

As I got home (from the middle of nowhere -- story on its own), I was so frustrated that I started to hack C. Here is an updated XFT patch (aka anti-aliasing support) for ion-3rc-20070927. Check the changes the patch does to your system.mk.

Yes, yes, I will switch to XMonad soon.

Tuesday, 25 September 2007

Stabilizing Firefox for beta quality plugins (Flash)

Using the recent Adobe Flash plugin in Firefox is a two edged sword. On one hand, it gives you the never ending joy of useless YouTube videos, but on the other hand it crashes your browser every 24h on average (only if you are also using Flashblocker which reduces flash content activation by 80%, namely all the annoying ads).

Presumably because of Flash, nspluginwrapper was invented to wrap up software of vendors that are incapable of producing 64-bit version of their product. nspluginwrapper works by providing a proxy to Firefox that acts as regular plugin, but actually spawns off a separate process that runs in 32-bit mode that links in the shared object of the plugin. We can use this construction to remove Flash from the intimate dlopen embracement of Firefox and move all negative side effects of beta quality software into a subprocess. The following trick works for all 32-bit browsers, whether the rest of your distro is amd64 based or native i386. If you are
using a 64-bit browser, it's likely that you know nspluginwrapper anyway, so this blog entry is about 32-bit to 32-bit.

Grab a copy nspluginwrapper (at least 0.9.91.5). Untar it. Compile it under an i386 environment. If you don't have this at your disposal, here is it precompiled from my local Gentoo installation: nspluginwrapper-0.9.91.5.tbz2. This is compiled for the amd64 arch layout of Gentoo. Under native i386, just create a link from lib32 to lib in /usr.

Now grab a copy of libflashplayer.so. Drop it into a directory that is not part of your default Firefox plugin path and that does not contain the substring 'netscape' in its absolute path. So,
/opt/netscape/plugins/libflashplayer.so is wrong twice, /usr/lib32/nsbrowser/plugins libflashplayer.so is wrong only with respect to the default plugin path, and /usr/lib32/nsbrowser/wrapped-plugins/libflashplayer.so is correct.

The reason why the path must not contain 'netscape' is that libflashplayer.so presumes its part of a netscape installation when it sees 'netscape' in its path and malfunctions for Flash movies as on YouTube and Google Video under nspluginwrapper and Opera.

Invoke /usr/lib32/nspluginwrapper/i386/linux/npconfig -i /usr/lib32/nsbrowser/wrapped-plugins/libflashplayer.so. As super user, this creates npwrapper.libflashplayer.so in /usr/lib32/nsbrowser/plugins. Invoking this as normal user drops this file into ~/.mozilla/plugins. You are now read to go with your new shielded Firefox. Check that it contains a Section 'Shockwave Flash' under about:plugins referring to the npwrapper.libflashplayer.so file. If it refers to libflashplayer.so directly, you have a copy of libflashplayer.so laying around in a plugin path.

Flash might still cause lock ups in this setting. I presume Flash is getting stuck in an endless loop keeping Firefox busy even through the proxy. However, when that happens just kill the nspluginwrapper subprocess called npviewer. After that Firefox should refresh and you can just hit reload on Flash sites (instead of killing firefox and reloading all websites). Good luck.

Tuesday, 11 September 2007

QT RLE hits ffmpeg SVN

My last drive-by-software-hacking turned out to be useful at the end. I hacked up a basic QT RLE (aka Animation) encoder for ffmpeg, sent the patch to ffmpeg-devel but without further intentions to work on merging. Thanks go to Alexis Ballier for stepping up and refining my patch until it was polished enough.

With recent version of ffmpeg, you can create a 1280x1024 screencast for your running X session at display :0.0 with
ffmpeg -f x11grab -s 1280x1024 -i :0.0 -f oss -i /dev/dsp -vcodec qtrle /tmp/lala.mov
after running configure
./configure --enable-gpl --enable-x11grab --enable-libfaad --enable-libfaac
Unfortunately rgb555 encoding was removed, so you are only able to create videos rgb32 video streams (aka 24-bit color depth).