Sunday, August 03, 2008

How I hacked mplayer to work on Motorola ROKR - Part 2

It has been over a month since part 1, so let me start off quickly and finish this part. I will try to explain how I got the 19 bpp working in mplayer. It was very straight forward really. I had to edit the following files from the mplayer-cvs (you can download the code from
In libmpcodecs/img_format.c, libmpcodecs/img_format.c and libmpcodecs/vf_scale.c I added a few lines to return something to say 19-bpp is supported in RGB and BGR formats.

libvo/osd.c is interesting. I added a method called vo_draw_alpha_rgb19() which draws the alpha for 19-bpp.

In libvo/vo_fbdev.c, I disabled some code that was causing problems in ROKR and disabled clipping because it was done elsewhere. In addtion added code to initialize variables for 19-bpp format (i.e. r, g, b offsets and lengths. Each color is 6 bits long with 1 bit for alpha) and drawing alpha (using the method previously added in osd.c)

I fixed a few things in mplayer because there was some weird state change after EOF. It did not work correctly on ROKR. I don't remember what was wrong, but for some reason I added a PAUSE state after a file has been played. I used the slave mode of mplayer (see man mplayer for more details about the slave mode) to play media files. So mplayer was always running and when it is time to play a new media file I just pass the new filename from java to the running process that controls the mplayer process. So when a file has completed playing the state of mplayer used to end in PLAYING state. I did not want it to be in that state for some reason so after a play ended I change the state to PAUSE.

postproc/yuv2rgb.c contains the most important hack of all. It is the one that converts YUV data to RGB 19bpp. It was the most fun of all to write the code. Take data point for each pixel in YUV format and convert it to RGB and then fit it in 19 bpp. A lookup table is created up front and the table is used to do the conversions quickly in realtime when the video is playing. I do know much of MMX or SSE extensions (and not sure if ARM supports them) so I had to do all the conversion in C, but it wasn't bad at all performance wise. I got 24 fps for most video formats on a 320 Mhz XScale processor.

The final change is in postproc/swscale.c which converts YUV to packed RGB format.

That is the end of part 2 :). Pretty simple isn't it. Next time I will explain some audio hacks.

Monday, June 30, 2008

How I hacked mplayer to work on Motorola ROKR - Part 1

Ever since I posted the cTunes video on youtube (, I have been getting a few requests for the app to download and the source code. I have blogged a little about it here and the download link for the app can be found here, here, here and probably a lot more places too. It is wonderful to see an application that I wrote over a few weekends get such wide audience. Forums are still active on this half baked media player.

But people have been asking for the source code and since I moved to a new job and had to shuffle my computers around, I don't remember where the code lives anymore. But the good news is I always have backups as my trusty little cronjob on my ever running PC takes care of backing up all the important files to a 1 TB drive every weekend so I never loose anything. Just hard to find that is all. Wish I had a google search on my .tar.bz2 files ;-). Anyway I took time today to search for the code because a student emailed me asking for the code for her school project where she is allowed to use open source code and modify it for her project. I decided to post the code on for the benefit of others who would like to extend the functionality.

There are two parts to the cTunes application. First there is the cTunes j2me application that runs on any media enabled phone (with proper jsrs available of course), and there is a hacked up mplayer I specifically modded to work with rokr e2. I was working at Motorola at the time and knew a little bit of the internals of the phone so it was easy. But this information is nothing difficult to obtain from the net. There are a lot of forums completely dedicated to modding phones, flashing latest images or simply understanding the details.

This is the first of the several installments of how to make ctunes work the way I have shown in the youtube video. First I will start with the mplayer that I built. Please remember that I do not remember all the details of the hacks I did and also the code I used was a very old MPlayer-CVS code from April 2007 or so. First download the code from here and untar it. Now search for
grep -Ri "chandan pitta" *
in mplayer.rokr directory. Those are the hacks I had to do in that version. The hacks may not work with the latest mplayer code. The hack starts with this comment:
// [ modified by Chandan Pitta ]
and ends with this comment:
// [ end modification ]
The rokr e2 has a 32 bit ARM processor and mplayer can be cross-compiled for ARM. So that simplifies the problem a lot for us. However ROKR E2 has a couple of issues
1. The BPP of the phone is 19 and the version of mplayer that I used did not support 19 BPP. So we need a hack for that.
2. The audio driver is motorola proprietary and mplayer does not have a driver. We need a hack to channel audio data to the driver somehow.

I will write another blog explainging how I resolved the 2 issues.

Wednesday, May 21, 2008

VirtualBox 1.6 is out

The most usable (for me anyway) VirtualBox release for mac is out. I just downloaded 1.6.0 from I was finally able to load the virtualbox additions. Check out my previous blog to read about the issues I faced. Here is a quick recap of the issues:
  1. I could not use my full screen real estate which was 1440x900. The max resolution I could get was 1152x864.
  2. Unable to mount my shared folder.
  3. Cannot ssh from master OS (mac OS).
First I am glad that VBox for mac has finally come out of beta. Just the fact that there is a release lifts the spirits a bit.

Coming to my first issue, I am now able to make full use of my screen. It did not work out of the box, but the tweaks I had to do were small enough to not make me grumpy.
  1. I installed 1.6.0 on my macbook pro.
  2. Started my Gentoo guest OS.
  3. Loaded the virtualbox additions iso to the virtual cdrom by doing Devices > Install Guest Additions...
  4. Mounted the cdrom from Gentoo by doing mount /mnt/cdrom as root.
  5. Executed /mnt/cdrom/ At this point all the modules are compiled and installed. My old /etc/X11/xorg.conf was saved as /etc/X11/xorg.conf.bak and the /etc/X11/xorg.conf was modified to add a new monitor and the video driver was changed from vesa to vboxvideo.
  6. Restarted my guest OS and all the modules loaded properly (no issues like with the beta release). But my kdm did not start. What gives? So I logged in as root and restarted xdm with /etc/init.d/xdm restart and I got kdm running. It was bizzare that for some reason X failed during boot up. And I know that the only changes were the new video driver and the vbox modules. Since X started normally when I restarted xdm, I knew the the vbox modules did not load before the video driver. What did I do? Just moved the vbox init scipts from default to boot like so
    rc-update add vboxadd boot
    rc-update del vboxbox default
    rc-update add vboxadd-timesync boot
    rc-update del vboxadd-timesync default
    rc-update add vboxvfs boot
    rc-update del vboxvfs default
    Thats it. Now all the modules get loaded before xdm starts.
  7. I restarted the guest OS and found out that it did not make full use of screen, but the size is something odd. It just filled the size of the VirtualBox window. So I maximized the virtual box window and restarted, lo and behold my guest OS fills the whole screen. Here is the screen size from xdpyinfo
    xdpyinfo | grep dimensions
    dimensions: 1432x830 pixels (378x219 millimeters)
  8. Sometimes the virtual box does not detect the full screen properly. In such a case just restart the guest OS again in maximized window and it will work.
The next issue is mounting the shared folder. With the previous beta release of virtual box the filesystem driver that talks to the shared folder could not be loaded using modprobe. But with 1.6 it has all changed. The vboxsf works! Just do
mount -t vboxsf < shared folder name > < mount point >
and it just works.

The final issue where I cannot connect to the guest OS from master OS still exists and I don't have a solution for that yet. But hey I don't need it now that I have the shared folder working! I can transfer files back and forth between them.

Tuesday, May 13, 2008

Yet Another GTD now open sourced

I was finally able to clean up the code and add some comments to my pet project YAGTD which stands for Yet another getting things done. See my previous blog for more details. The code is available here if anyone is interested to modify for their specific needs. To try out the application go to

Tuesday, May 06, 2008

Elisa problems marshalling MediaUri

The short version
If you are having problems with elisa not playing your local media files (see and then you can fix it by editing ~/.elisa/elisa.conf and changing gstreamer:gst_metadata_client to gstreamer:gst_metadata. That is all and it works!

The long version
Ever since I heard about elisa, I have been trying to get it to work as my media center. It was well designed and the vector graphics are awesome. It plays music, videos and displays pictures, and has several plug-ins to play online music and youtube videos etc. You can even get cover arts from amazon from with in the software. But there is just one problem. It could never play my local media. Neither movies, nor music and not even photos. I gave v0.3.3 of elisa a try. It did not play my personal media. I thought, well it is still in development, so why not wait for the next release. I did not even take a look at the logs.

Then came v0.3.4 and that again did not work. So I synced up to the latest code in svn and tried that. No luck. At this point I was starting to think something must be wrong with my configuration or the versions of dependencies that I have installed. This time I looked at the logs and a warning pointed me to a log file in /tmp. A quick look and I could not understand why (from twisted) seems to think MediaUri is not a known type. I didn't know much about twisted framework (and I still don't), so I emailed the elisa mailing list. And in response a developer kindly opened a ticket for me. You can view it here

I was waiting for it to get fixed. And then along came the announcement for v0.3.5. I decided to try the latest from source control and it failed to play my media again. This time I was adamant on learning twisted at least up to the point of understanding what is and why it is does not know the type of MediaUri. I found out that jelly is used to serialize data to send it over the wire to the server to unmarshall and act on it. That is good enough. Now back to the exception
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/twisted/internet/", line 182, in addCallbacks
File "/usr/lib/python2.5/site-packages/twisted/internet/", line 307, in _runCallbacks
self.result = callback(self.result, *args, **kw)
File "/home/chandanp/workspace/python/fluendo/elisa/elisa-plugins/elisa/plugins/gstreamer_plugin/", line 1429, in got_root
dfr = root.callRemote('get_metadata', dic, low_priority)
File "/usr/lib/python2.5/site-packages/twisted/spread/", line 380, in callRemote
_name, args, kw)
--- <exception caught here> ---
File "/usr/lib/python2.5/site-packages/twisted/spread/", line 853, in _sendMessage
netArgs = self.serialize(args, perspective=perspective, method=message)
File "/usr/lib/python2.5/site-packages/twisted/spread/", line 807, in serialize
return jelly(object,, None, self)
File "/usr/lib/python2.5/site-packages/twisted/spread/", line 879, in jelly
return _Jellier(taster, persistentStore, invoker).jelly(object)
File "/usr/lib/python2.5/site-packages/twisted/spread/", line 464, in jelly
File "/usr/lib/python2.5/site-packages/twisted/spread/", line 468, in jelly
sxp.append([self.jelly(key), self.jelly(val)])
File "/usr/lib/python2.5/site-packages/twisted/spread/", line 489, in jelly
raise NotImplementedError("Don't know the type: %s" % objType)
<type 'exceptions.NotImplementedError'>: Don't know the type: <class 'elisa.core.media_uri.MediaUri'>

This simply means that there is a problem serializing MediaUri. I greped around and found that MediaUri is not extending one of the serializable classes. So that could be the problem. I looked at the which is where the RPC is being made. I noticed that there is another way to get metadata, but it is not an asynchronous call. But hey what the heck, I don't care if the UI locks up for a while when it is scanning my media as long as I can get it to work. So if I used gst_metadata instead of gst_metadata_client I can get away from the whole async RPC calls. I edited ~/.elisa/elisa.conf and changed gstreamer:gst_metadata_client to gstreamer:gst_metadata and guess what, it works!

I updated a ticket with the same problem I was having and at least some one is happy being able to play their local media. The link to the ticket is I got so excited that I wrote this blog immediately. Now I will take elisa for a ride.

Sunday, May 04, 2008

Mac vs PC (Vista)

Why is it so funny. Let's go over it one more time. Who do you think is better, the mac or PC (with windows vista)? Let the games begin, but before we start I am neither a mac fan nor a windows fan, I am all for linux ;)

Mac: 1 PC: 0

Well mac does not need to get all excited. Seems like mac was having problems showing the above video on a mac. You might want to stop the video after a while, otherwise you might want to kill someone

Mac:1 PC:1

Moving along, we have a series of pro-mac videos

Mac: 2 PC:1

Mac:3 PC:1

Mac:4 PC:1

Mac:5 PC:1

Mac:6 PC:1

Let's even out the odds a little bit. This is hilarious and I have to minus 5 for mac for the following video and cannot raise anything for PC since nothing good has been said about it.

Mac:1 PC:1

Finally the winner is

Mac:0 PC:0


Monday, April 28, 2008

Google App Engine to rescue my "Getting Things Done" project!

I was finally able to complete the project that I described in my previous blog :). Having been back from vacation for a couple of weeks now, I used up every single minute I had available to finish it up. It is hosted at as usual.

Now you can see that as you add tasks for projects that has a specific tag and as you complete each task, you can observe the progress at both project level and tag level. All is well so far, but the only problem is that you cannot save what you enter into the application. As I previously mentioned, I had plans on running my own local server and being able to save all my tasks on my personal computer. But that did not make any sense to me. I wrote this neat application and am I the only one to be able to use it?

Google App Engine to the rescue
Just my luck, that Google App Engine was released while on my vacation. It is still in alpha stage, but it quite usable as it is. It has built-in data store where I can store all my data and the best thing is that there is a user api to allow users to log in to Google accounts and so I can maintain state from server side :). What a cool tool and that too just in time. However the unfortunate thing is that it was released while I was on vacation and I could not get in on the 10000 accounts that Google was giving away. I signed up and have to wait my turn. But I can still get to work by running the service locally.

My plan now is to save and load data from the server. Later I will clean up the code and open source it for every one to download and modify to their specific needs. Now to start learning Google App Engine.

Thursday, March 13, 2008

Google Web Tookit is awesome!

So I have used a few "Getting Things Done" (see my previous blog) softwares / applications / services or what ever you want to call them. They are generally pretty good at what they are supposed to do. I liked some of them for their simple design and ease of use and liked a few others for their control. But overall none of the ones I tested met my specific needs.

Basically I want an extremely simple tasks > projects > tags hierarchy. The tags are like the big pieces of the pie. I have a few tags like "Personal", "Work" and "Fun". So all my work related projects should have the "work" tag, similarly all personal projects like buy groceries or clean house or free up space on hard drives should go into the "personal" bin, and so on for other tags. Well you get the picture.

Then projects are high level tasks. You know you have to do several smaller tasks to get it done. But overall you just want to track projects. How much of a project you completed. For example take the case of the high level task such as free up disk space. The smaller tasks involved are
  1. Do some accounting of all the files that are needed now vs need on use basis.
  2. Remove /tmp and unnecessary files.
  3. Tar / BZip all the files that are not needed now and remove them.
Simple. I need to track what % of the task is complete. Another example is when I am playing Need for Speed Most Wanted. Where am I in the blacklist? Each blacklisted player can be a small task of the big task of winning the game. Not only that but I need an RSS feed which will report what % of the project I completed. It will be fun to get the graph later to see the progress over all the projects and individual projects.

Next comes the individual tasks of course. So basically a task is a subset of project and a project is a subset of a tag. I want to maintain that hierarchy.

Google Web Toolkit
Since I did not find any of the GTDs useful I decided to write one myself that I will use locally on my laptop which will maintain the state on a locally run server. Then I will run a RSS server which will give the RSS feed to be used in my blog or somewhere. Initially I thought of writing a simple swing java app. But then I thought why not learn something while I am working on this task? I have been wanting to write an application using Google Web Toolkit, so this may be a good use case :).

I downloaded GWT and installed it. Following the simple introduction page, I am already on my way to creating a professionally looking web app by just coding in java! I have some knowledge of JavaScript but as far as my knowledge regarding CSS or DOM goes, it is close to nothing. Yet here I was happily editing CSS and creating elements for my Getting Things Done project. GWT is extremely cool and easy to use. The documentation is pretty good and easy to follow. Once I understood all the widgets and how they get their look, I simply started coding. I already had a design in mind and just went about implementing it. With in a few hours I have done the "Tags" part. Here is a snapshot of the app.

Google Pages is not for me
I will be going on vacation for the next 3 weeks so I know I won't be able to get much more progress on it. Yet I wanted to show off. I wanted to host it somewhere. Initially I planned on using Google Pages. I have not used it for almost a year. Unfortunately for me Google Pages still does not let me edit HTML in the way that I want. It only lets content creation using the product itself. You can edit HTML but it is very limited (title and body). Moreover all the files that I upload go to just one place. I want a more directory hierarchy to put files from various projects into different directories. Also I wanted some kind of ftp access.

Enter MyHosting247
So I Googled of course and found this really neat web hosting service called MyHosting247. It has a very simple interface and was very responsive (unlike geocities that I used a long time ago). Anyway it has a nice file manager to create directories, upload files and manage your website. Even better it has ftp access. Cool! I created a directory and pushed all my files. Now my app is hosted here. Go give it a try at and see how a few hours with GWT can get a professional looking app. I was only able to complete the Tags tab. The other 2 tabs are just place holders for now. I will complete it after my vacation.

What can you do with the app
You can add new tags with a tag name and description and clicking on the "Add Tag" button. The description can be empty but the tag name cannot be empty. If it is empty, you will see a message indicating the problem.

Also you cannot add a tag name that already exists. Tag names are not case-sensitive. When I try to add "work" again, I get this:

You can of course delete the tags using the "Delete" button. But in my view the most interesting feature of this app is that you can edit tags and descriptions right in the table by clicking on the tag name or description. You simply get a text box with the text and you edit it. Pressing enter updates the table. Here is a snapshot where I am editing the tag "Work" and description of "Personal" by simply clicking on the text.

That's all for now folks. 4 weeks until next update :) when I will complete projects and tasks tabs.

Friday, February 29, 2008

Testing Video Ads

So what more can I do with my adsense account? How about video ads? Why not. What are they? How do they work? Here is my first experiment with video ads. The setup was pretty simple. You click on Google AdSense Video units link and you are connected to your youtube account. Once you log in to youtube and verify your information you can start off with creating a player with the contect you want to show based on keywords or channels or category. Simple :-). The videos can also be generated based on the performance and characteristics of the website they are placed in. You get a piece of code that you embedded in your blog/webpage. Here is the piece of code that I got for keywords "phone".

Update 1: Hmm for some reason that did not work. I will give it a try again later.

Update 2: I found out the problem. It seems for some reason when I copy paste the code somehow double quotes get added at the wrong places. And so the link did not work. Now I removed all the extra double quotes and it is working fine, except I have another problem. Now the video is too large to fit in my blog.

Update 3: I went back to my youtube account and tried to edit my video player. But there is no way I can change the size of the player by editing it. I can change the keywords and such but not the size of the player. Very odd. The only way to fix this problem is to create another player with a smaller player and I did :)

Wednesday, February 27, 2008

Testing AdSense and Getting Things Done

Working in Google and not having an AdSense account is not cool. So I created an account and added the AdSense page element. Looks good. Although I did not like the layout. May be I should move to a new template that will have 3 columns. One on the left with profile, one on the right with ads and middle with the blog. May be I will write one.

Anyway with the ads in place I can track how many page impressions I got on my blog ;-). Actually I should find out how to track traffic to my blog. Let me add that to my list of To Dos. Talking of To Dos I was also researching for some "Getting Things Done" (GTD) applications that will make me more organized. Lucky for me an article got published in Toms Hardware about the very topic. In it the author writes his views on various Getting Things Done With Software. After reading through the article quickly I found HiveMinder to be the most useful for me. I tried Personal Tracks too, but I guess HiveMinder is easier to work with. It has RSS feed that I added to my blog (see just below my profile). Now people can look at my tasks. Again the template could be better with nice seperation for each of my page elements. I will have to work on it and it is in my todo list. Another thing I did not like is that the feed only shows 5 tasks. I want all my tasks to show. Also I would like to have some kind of progress bar for the tasks so I can see how far I am into the task. Not sure if HiveMinder can do it.

I can tag my tasks differently like [home] or [work] and I can show RSS feeds of only my [home] todos. Thus I can maintain [work] tasks in HiveMinder which no one can see. Interesting. Very useful. Now on to finding the right GTD software for me. The features I am looking in the software are
1. Ability to have progress
2. The feed should keep showing completed tasks for a few weeks(months?)
3. Ability to add todos from my phone/email/chat. And HiveMinder does it but I have learn how.
4. Should be simple enough to use that I do not spend a lot of time adding/editing/formating/tagging my tasks.

Thursday, February 21, 2008

My worst enemy - Time

I have a rather busy schedule like most people and from time to time I wish I had more time. Well I lied. I don't wish from time to time, I actually always wish there was more time. There is always something more to be done. Yet here we are constrained only by time. The list of things to do is ever growing.

1. I have to finish reading several of my magazines that appear at my doorstep every month. I subscribe to Dr. Dobbs, Wired and Electronics for you. But I did not have time in 2007 to complete any of the magazines in 2007. So now I am reading all the old backlogs. I have to come up to speed to open my new Feb 2008 issues. I am now at March 2007 issue. I have exactly 1 year's worth of 3 magazines, bringing the total to a hefty 36 magazines.

2. Then I have to work on that media player using Freevo or Pigment or what ever I decide. And then there is the matter of figuring out which one to use. Huh, will I ever be able to decide and start getting my hands dirty?

3. I still have to clean up the code in cTunes code, document it and then open source it. When is that going to happen?

4. I have to improve my wii tennis score. I have been hovering over 1100 points for some time now. Need to break to 1200. My target is 1500. Then I have to become the champion in Need for Speed - Most Wanted and Need for Speed - Carbon. I never went to the top in either games, but the plan is to get to my old score (to where I was before my old laptop died). I think I was at position 5 waiting to compete with blacklist #4 in Need for Speed - Most Wanted. And then I completed about 93% or something in Need for Speed - Carbon. Have to do it all over again. But this time I am setting the bar a bit higher, just for the sake of fun. The plan is to get the pink slip of all the blacklist drivers I beat. That should be exciting huh? Then I have to play Command and Conquer Tiberium 3, Generals, Red Alert 2, Yuri's revenge expansion and Age of Empires 3 and 2. All of which I played to victory but I intend to do it all over again with my excessively powerful nVidia 8800 GT.

5. Then I was planning on maintaining a todo webpage that I will update as I progress in my quest.

Someday I will do it all. But for now it is just wishful thinking -- I wish I had more time.

Wednesday, February 13, 2008

May be not Kaa.Canvas, May be Pigment

After thinking about the pros and cons of using kaa.canvas I am just now thinking may be I should simply go with pigment. The reason is I am looking for a way to scale a screen of information (graphically) and I guess kaa.canvas may not be able to do that. I did not yet discover all the available features in it, but that is what my initial impressions are. I will go over the kaa code base and see if I can scale screens with images and text on the fly (as in animation). If not then perhaps pigment has some tricks in the bag.

gtkdocize not found

If you are ever configuring an app and see the message "gtkdocize not found" in Gentoo, then you need to emerge gtk-doc. I had some hard time figuring this out so I am writing it in my blog for the next time. When I saw that error message I did an "emerge -s gtkdocize". Usually it is that simple in Gentoo. But not this time. The emerge command returned no results at all. Then I searched for gtkdoc and still no luck. After searching in Google, I still did not have a solution. After thinking for a while I decided to try to search for gtk-doc. Bingo! That worked!

Interestingly, this is my first post from my Virtual machine :-)

Tuesday, February 12, 2008

VirtualBox additions

I got everything working from with in virtual box, except for the additions. I was able to run (from the Guest additions iso) and it ran to completion without producing any errors. It compiled some modules and modified my xorg.conf file. But there were several problems with the additions.

First the script changed the video device driver from vesa to vboxvideo which gets me a maximum resolution of 1024x768. All other higher resolutions complained about "vrefresh out of range" or "hsync out of range". I do not understand how that can be given that I gave a wide range of hsync and vrefresh for my monitor. Finding little help from /var/log/Xorg.0.log, I decided to go back to my old vesa driver which at least gives be a slightly higher resolution of 1152x864. I was wishing the vbox driver could give me 1440x900 but that did not happen. Setting modelines also did not help so I gave up pretty quickly.

My next issue is that I am not able to mount my shared folder. I created a shared folder in VirtualBox > Settings. Which I should be able to mount from the guest OS using "mount -t vboxsf ". But when I try that I am getting "/sbin/mount.vboxsf: mounting failed with the error: No such device". I figured that the module for the vboxsf did not load properly. So I did a lsmod and indeed there is no vboxvfs. Trying to do "modprobe vboxvfs" yeilded "FATAL: Error inserting vboxcvfs: Protocol error". What ever that means. There were no messages in dmesg. I did not bother to find out what caused the problem. Don't want to waste too much time since I may not even be needing any sharing if I can just ssh to all the machines.

There was another problem however. I cannot ssh from my master OS to the guest OS. After googling for a few minutes I found out that I need to set up port forwarding rules. Not sure how to do it from virtualbox. Another option is to use "Host attached" for the network instead of "NAT", but alas, I only have NAT option available in my VirtualBox beta3 for mac. Not sure how I can enable bridge networking. So I skipped that as well.

The good news is that I don't need all the above things. They were just good to have options that I could have used.

Friday, February 08, 2008

Gentoo on VirtualBox on Mac

In one of my previous posts I expressed my excitement about VirtualBox beta 3 working well on Leopard. I benchmarked VirtualBox and found out that the guest OS runs almost at the native speed. This is very exciting. It simply means I can install Gentoo instead of Ubuntu or knoppix. It is not like I have anything against those distros. They are really good and get things done pretty fast. But I got used to Gentoo and learned so much about it that I know where to look for when something fails or if I wanted to install a package or hack something up quickly. I did not want to learn another distro from the basics. Anyway I created a new VM for Gentoo mounted the minimal install cd and launched the VM. Everything worked perfectly. I just followed the regular gentoo install procedure and I have a system up and running in about the same time as it would take for me to install on a native platform.

I later installed kde and firefox. To start off working on my Freevo 2.0 project I downloaded the code from svn repo. Everything looks promising. I even tried some opengl. So glxgears gave me about 1000 fps on my 2.33 GHz dual core intel mac book pro. Not bad huh? I installed all the dependency packages (libxml, imlib2, python 2.5, librsvg, pylibsvg and such) and compiled evas. Then I installed kaa fired up my Freevo 2 project that I started a few months ago but never finished to conclusion. It works! I have a video of the project in youtube here. It was incomplete at that time. Hopefully now I can work on it a little bit. More updates will come soon...

Gaming Media Center PC

My gaming PC which also doubles as a media center is now completed. Well actually I finished working on it last weekend. I also started playing all the games I love playing. Unfortunately I became sick after the weekend and I could not blog about it. However I will try to blog the complete details this weekend (time permitting). There is one interesting twist to my plan. My PC uses linux for media center tasks and uses windows XP for playing games. Yeah I know I said I will linux for both but it so happens that wine seems to have some problems with the games I play. The games usually launch but with some tweaks. Even then I am not able to get the maximum performance from my GPU. For the $240 I would like to see all settings high and at least 30 FPS at 1280x720. More on how and why I had to switch in my next blog. I am still kind of sick and getting well. Hopefully this weekend finds me in a better state.

Wednesday, February 06, 2008

VirtualBox beta 3 works on Mac OS X Leopard!!!

So finally, finally, finally I am so excited that VirtualBox works on my macbook pro. I felt really frustrated with the speed of Q today. I was trying to install some packages while compiling evas in kubuntu inside Q but it was so very slow. I can hardly switch apps. I don't know why but I just felt may be there is a new version of VirtualBox that will run on mac. Don't know why, I just had the feelings and lo and behold, there it is -- a new announcement on VirtualBox webpage about a new Beta 3 release for mac. Am I excited! I knew it would work on my Mac Leopard because why else would they release it? I started downloading the new package even before reading the news on the site.

While the app was downloading I went ahead and read the complete details and I could feel the happiness inside when I read this sentence from the news "The new version sports seamless guest support and live dock tiles as well as numerous improvements and bug fixes. It goes without saying that it runs on the most recent version of OS X (Leopard).". There you go. Just what I wanted to hear (see).

I installed it and of course I created a new VM for gentoo and launched the install cd from VirtualBox. It runs! It runs! And it feels so fast too (compared to Q). Just for kicks I wanted to see how Q vs VirtualBox performed. I launched kubuntu live cd from VirtualBox and Q 3 times in a row in each VM and timed them from the minute I launched to the time that kubuntu is fully loaded (with all the tasks in the taskmanager). VirtualBox took 1:28 (1 minute, 28 seconds), 1:43 and 1:28 in the 3 consecutive runs. Then I launched kubuntu live cd from Q. But even after 5 minutes kde is not completely loaded. I stopped after 5 minutes. I ran it 3 times and each time I waited 5 minutes and killed it because it was taking too long. That was enough to convince me that VirtualBox is so much more faster than Q, which is understandable since Q is more of an emulator while VirtualBox gets to use the native support from the processor (VT-x). But wow VirtualBox is soooo good. I would never use Q again after this. There I said it.

Now to install Gentoo...

Friday, February 01, 2008

Building a linux gaming PC: Update 3

Today must be my lucky day. I finally got my GPU the great 8800 GT 512MB (G92). I will setup my PC tomorrow and see how things go. I will update my blog with photos and more details. So look out...

Thursday, January 31, 2008

Building a linux gaming PC: Update 2

I received my wireless keyboard and mouse! Still waiting for the graphics card. Once that arrives I can start putting things together and start playing games :-). The GPU was shipped but I probably will receive it on Feb 4. Will have to wait and see...

Freevo 2.0 and Evas

I decided to start working on Freevo 2.0. I compiled and installed evas in a local space with the following commands:

./configure --enable-gl-x11 --prefix=~/workspace/usr/local
make install

Now I had to export the lib path using LD_LIBRARY_PATH. I prefer to run everything in a subshell with the proper environment variables set. So I write this small script called setup-subshell (modified it from project pigment's subshell):

#!/bin/bash -i
# Set up environment.


# Common env vars
export PKG_CONFIG_PATH=/home/chandanp/workspace/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export PYTHONPATH=/home/chandanp/workspace/python/kaa-lib/lib/python2.5/site-packages/:$PYTHONPATH

# If we got a command, run it and exit
if test ! -z "$1";
exit $?

# Set up a prompt helping us remember we're in a subshell
tmp=`mktemp -t bashrc.XXXXXXXX`
echo source $HOME/.bashrc >> $tmp
echo PS1=\'[$PROJECT] $PS1\' >> $tmp
SHELL_OPTIONS="--init-file $tmp"

# Start the shell
echo Entering interactive $PROJECT shell $SHELL.

# Remove temporary file
if test ! -z "$tmp"
rm $tmp

echo Thank you for using $PROJECT.

Launched the subshell and installed kaa using the following command

python install --prefix=/home/chandanp/workspace/python/kaa-lib

However I found that beacon is not being installed because it thinks imlib2 is not installed. So I installed imlib2-dev and went one step further. Now the problem is that pysqlite2 is not installed. So I installed pysqlite2 and was able to install kaa.beacon but when I tried to run it, there was another problem. It could not find kaa.db. I have to find out why kaa.db failed to install. May be tomorrow :-)

Wednesday, January 30, 2008

Q on Mac: Part III

I got everything ready. Kubuntu is running well in Q on my macbook pro. However it does not mean anything. The real test is to see if it is really usable. My plan is to start working on Freevo2 on the virtual kubuntu PC. But even before I start working on it the first question is I am not sure if I should be working on writing Freevo 2 from ground up to fit to my needs. Or should I simply use elisa (fluendo) and write a freevo plugin so that I can access all my movies and music that have been prepared for freevo (fxd file et al). I tried elisa. It is really cool I mean the UI and smooth graphics and such. But I was not able to use it to play any content. The problem seems to be with some code in elisa that twisted python does not recognize. Long story short, a ticket was opened in elisa (see to resolve the problem. Not sure if is effecting others users. May be it is my Gentoo distro. I will probably give it a try on my kubuntu machine.

Anyway I decided to try out the svn code from freevo first. But svn is not installed on kubuntu by default. But the shell prompted how I can get it. All I need to do is install subversion using sudo apt install subversion. I am starting to like kubuntu. I tried doing that but kubuntu chocked saying it could not find subversion in the repository. Since I know very little about debian/kubuntu I decided to go with some UI tools instead of commandline. I fired up adept and searched for subversion. Nothing. I understood that the software source is wrong. I fixed it by checking all options in "Adept > Manage Repository > Kubuntu software". I was then able to find subversion and installed it from adept.

Now svn worked. I checked out kaa package from Freevo. Next I needed to compile evas ( I downloaded the source and ran "./configure". The configure failed. A quick look at the config.log revealed that the gcc could not compile simple c code. The reason is "/usr/bin/ld: crt1.o: No such file: No such file or directory" error. I have no idea what it means. A quick search on Google got me going. All I had to do was install libc6-dev. A few seconds later I was on my way.

But not too far. Now the configure script complained that I do not have pkg-config. Installed that too. Once again configure complained that I did not have freetype2 fonts. I am pretty sure I have them. So one more Google search later I find myself installing libfreetype6-dev. Now configure is happy.

I was able to do "make". It took some time to compile but I had no problem. Now to install kaa.

Tuesday, January 29, 2008

Building a linux gaming PC: Update 1

Today I received my 1GB memory, the upgrade I require to transform my media center desktop PC into a moderately powerful gaming PC. I am still waiting for the nvidia 8800 GT and the wireless keyboard & mouse to be shipped.

QEmu on Mac: Part II

So after a bit of thought I decided not to use Gentoo, because as it is Q is very slow and I did not want to compile all of Gentoo. Instead I decided to go the easy route with kubuntu. All I had to do was to download the image and start a new virtual PC with the install image as the virtual cd. Booting the virtual PC from the CD image launched Kubuntu. So far so good.

Installing kubuntu was very easy but slow because of Q. It probably took about an hour until the installation was complete. Now I have linux in Mac. Sweet. Restarting the virtual PC and selecting boot drive to the virtual harddisk boots into the installed kubuntu. It is slow, but still usable. I can live with it.

Now to test internet. D'oh. No internet. A ping reveals that even domain is not being resolved. ipconfig reveals that an IP is not assigned to eth0. After tweaking the network settings to make use of dhcp I now have an IP. A ping resolved the domain name, however my browser still says error -- page cannot be loaded. Is there a firewall in kubuntu that is preventing access to internet? Hmm not sure what happened but restarting the virtual machine got me my internet. Almost there...

Finally time to install all my IDEs and tools.

Q on Mac

With my failure to run VirtualBox on Leopard, I decided to go with Q ( Here are some notes about my adventures with Q on mac.

1. I downloaded the mac release and the install was a breeze.
2. Created a new Virtual machine. Named it Gentoo, gave it 512MB memory and 10.00GB harddisk and the cd-rom is the gentoo install image. Everything looks good so far.
3. Set to boot from the cd and launched the virtual machine "Gentoo".
4. Wohoo I see linux booting. But it is very slow. 1 CPU on my mac book pro is maxed out but the booting was going very slow. Well I guess that is what you get with an emulator but somehow I remember VirtualBox on linux to be much faster. Anyway continuing further
5. I got my shell prompt. hdparm -tT /dev/hda gives about 80MB/s. Nice! I know I am in a virtual environment.
6. ipconfig gives a virtual ip for eth0. A ping to resolves the domain name to an IP but I never get back a response for the ping. Hmm. Am I inside a firewall? That is ok, I will continue with my install. At least I am able to ping to which seems to be the QEmu gateway for network traffic on the virtual net.
7. Yes I was right. The pings are not working but I am able to access the internet. I was able to do "links" and I got the google's landing page.

I am trying out Q on mac during my commute to work. Now I am approaching my destination. So more in my next post today evening when I am on my return journey.

Monday, January 28, 2008

VirtualBox on Mac: Part II

...continued from previous post

6. Downloaded the Gentoo image.
7. Selected install from an image in VirtualBox.
8. Click continue. Darn that "App quit unexpectedly" dialog again.
9. Click reload. Again the same error.

I had to learn it the hard way. VirtualBox beta release for mac has some known issues with Leopard. I install Leopard over Tiger just a month ago. I did not know I would regret so much. Oh well, I guess I will have to wait until the next release of VirtualBox. I wanted to build VirtualBox from svn, but before I compiled it, I searched on the net to see other's experiences and they were not very positive. I decided to go with other virtual environments until VirtualBox is fixed. Here is a link explaining the problems with Leopard and compiling from svn

VirtualBox on Mac

So I have used VirtualBox on my Gentoo machine a few weeks ago. I loved it. Very simple to use. Now I wanted to install Gentoo linux on my macbook pro laptop. I did not want to erase Mac OS, just want Gentoo running along side. I decided to give VirtualBox a try. At the time of writing this blog the VirtualBox download page says that the mac build is in beta for intel macs (, but I decided to try it any way. I am writing this blog as I am trying VirualBox to install Gentoo on my macbook pro.

1. Ok so I downloaded the .dmg and the install was a breeze.
2. I launched the app from the application folder. Oh what is this. I got a message saying that the app exited. A dialog asked me if I wanted to relaunch. Uh? Alright relaunch. Now it works. I got my VirualBox window!
3. Created a new virtual machine for Gentoo. Enter name, allocated 512MB (my macbook pro has 2GB :-)
4. Created a new virtual disk on which to install Gentoo. Allocated 10.00 GB dynamically resizing virtual disk. Click finish.
5. Now to download Gentoo minimal installation disk from (

This will take some time. I will probably continue tomorrow. Wait for my next post ;-). But wow that was really easy. It just took about 15 mins from start to finish.

Friday, January 25, 2008

Keyboard, Mouse, Memory and GPU

As I mentioned in my previous post, I am looking for a wireless keyboard & mouse, a 1GB memory card and a graphics card for $300. After spending several hours frantically searching for various deals I finally came to a conclusion about what I want. However the budget has gone overboard.

For the memory, the search was simple. I need a 1GB 800MHz RAM for under $30. I first went to as usual and found a deal almost immediately. The link is I know the link will not live for ever, so for reference it is a mushkin 1GB 240-Pin DDR2 SDRAM DDR2 800 (PC2 6400) Desktop Memory. It comes with a heat spreader (awesome :-), and a near 5 star rating in The only complain people had was about its large heat spreader which may obstruct another memory when attempting to place beside it in the next DIMM slot. I don't think that will be an issue for me. Let us see. And it has free shipping too! Sweet. The total cost came out to $27 shipped. It saved $3 from my budget allocation. Score!

Next I need a nvidia 8800 GT 512MB for about $230. This was very difficult. I searched for deals everywhere I could find. The best I could get was $268 (because of taxes in CA, for the first time I hate to be in CA). But I sold my soul to the devil and went with a cheaper offer, but it was in backorder. The ETA it seems is 30 Jan 2008. Not too bad, just 5 more days. I guess I can take that kind of risk :-). But the good news is that it is an EVGA card. From the reviews I found out that it is one of the better cards. Although some reviewers said the fan was loud when the PC boots, it is not a problem for me. My PC is always on. Many have reported that it can be overclocked considerably. However I don't plan to overclock it any time soon. I plan to play games at 1280x720 resolution on my TV and that should be plenty for the games I intend to play. Once more demanding games come about I will probably overclock it. Finally for the price. It weighted in at $242. Damn the shipping costs. The card itself goes for $228, but there is a $14 shipping charge. By the way I found it at I went $12 over budget. Oh well.

Finally it is time to buy a wireless keyboard and mouse. This turned out to be the most difficult of all. I researched and searched and searched. There are far too many parameters. It should have a long range. 10 ft is a good start but most of them have a range of 6 ft only. The next problem is mouse not being very responsive. So no matter what the product specification says about the mouse's DPI, it just is not good enough if the receiver cannot pick up all the data. I have never used a wireless mouse or keyboard from close range let alone controlling my TV from my couch. Hence this will be a big risk. The next parameter to worry about is the batteries. I wanted a product that comes with rechargeable batteries and a charger. This made the task of finding a product incredibly difficult. Add to it, the budget of $40. These things are very expensive. I did not allocate the budget wisely. After much research I finally set my eyes on Logitech 1500 laser wireless keyboard and mouse. It comes with a charger. The ratings are average at best (I found very few reviews). No one mentioned the range exactly. All they said was "the range is great" or "the range is better than most wireless keyboards I used". Whatever that means. The best price I could get for it is $58 shipped. That is $18 over my budget! It is a no go for now. My plan is to go out to some local stores and see if I can find anything better. If everything fails, I will be back and purchase it for $58.

So a little more searching and I found the keyboard and mouse for $53. If I use Google checkout for the first time I could get it for $43 which will be very close to my budget. What do I do? Just ask my friend to open a Google account and make her buy it! Simple. The final price came out to $43 and the site I bought it is

My total comes out to $27 + $242 + $43 = $312. I wish I could find a cheaper GPU. From looking at past deals I know I should have brought the card during thanksgiving when dell was carrying it for $208 + shipping and tax. I probably would have made it with my budget. But all in all I am quite satisfied with my adventure. Just $12 overboard.

Thursday, January 24, 2008

Looking to buy 8800GT

How hard is it to buy a graphics card for your desktop? Easy right? Hardly!

In my previous post I casually mentioned that my Dell E1705's GPU burnt up. I will probably write how that happened in my next post. But for now it suffices to say that I need a GPU fast to continue playing my Need for Speed, Age of Empires and Command and Conquer. I know these are not very demanding games but I still want to buy a powerful graphics card, not for my fried Dell e1705 (the GPU was nvidia Go 7900GS) but for my media center desktop. My desktop has always been used as a media center. It is connected to my music system and LCD TV. It has over 1TB disk space to store my HDTV recordings and ripped movies/music. However since I only planned to use it for playing media, it has a cheap nvidia 6100 GPU (on board). It has 1 GB of RAM which is pretty good for media center needs. But now I need to upgrade it to replace my gaming laptop. My plan is to install a powerful GPU and run games using wine-hq from linux. The media center PC runs Gentoo linux and Freevo to record and play media. So if I can just start another X and run games on the side I have a super cool PC. Freevo can record while I play games.

Nice but then there are 3 problems. First I need a powerful GPU because wine eats some GPU cycles since it does not run at 100% native speed of windows. I have my eyes set on nvidia 8800GT 512MB. Next I need a memory upgrade. 1GB just won't cut it. So I need at least another 1GB, may be even 2GB who knows. Finally I need a wireless mouse and keyboard because I don't want to sit right in front of the TV and look at the 32" screen up close while playing games.

I want to do all that with a $300 budget. Here is how I am planning to distribute the funds. For 1GB memory I allocate $30, for wireless keyboard and mouse I allocate $40. So I am left with $230 for GPU. I tried to allocate the maximum to the GPU. Makes sense right. Now I don't want to sound cheap but one thing I definitely want to steer clear is to look stupid. I know there are deals out there to buy the GPU for less that $230, but they come and go. I have to find it. I would be stupid if I just buy the card for $270. That is not challenging at all. The task for me for this week is to look out for deals to buy the components at the cheapest possible price without having to wait for back orders or using mail in rebates (god I hate those). Can I do it? Let's find out. Let me go look up some deals and then update this post.

Welcome 2008

Isn't it a bit too late to welcome 2008? Well not for me I guess. I just realized I am in a new year. How fast days have moved. I almost remember nothing from the time I last posted till date. I was just too busy with all the things going in my life. Well it is not too late for anything. So we are almost 7% into 2008 and here I am once again blogging. I will try to start blogging a little more often.

This is the first time I am blogging from my Google shuttle with it's wifi. Not too bad eh? Usually I spend the 1 hour commute on the shuttle by reading wired or Dr. Dobbs or Electronics for you in the morning shuttle. And spend the evening 1 hour by watching some of the excellent tech talks that happen at Google. Perhaps most of you already know this but a lot of tech talks are recorded. I try to attend any tech talk I can, but mostly I prefer the recoded ones, because I can pause, rewind and resume when I want. Isn't that why TiVo became popular? My plan going forward is to try and do some blogging once a week (or when ever I feel like) during my commute.

A lot of things happened in the past few months and I need to record them. Just to name a few, I blew my Dell e1705's GPU just a couple of days before new year. A very sad ending to a $1600 laptop I should say. But it is not the money that blew up that hurt me. No. But it was the tragedy that my faithful laptop has died and left me alone that hurts me. Other than that I tried out the new KDE 4.0 and it is pretty good. More comments in my next blog. Then I also tried out VirtualBox on my Gentoo machine. Works great. Once again that is for another day. I built a budget media center PC running freevo for less than $500. That will probably appear in another blog then. Finally I recently tried out wine-hq and it works great, but still very slow when compared to windows games. More about it soon. Then I tried out elisa ( and sent a fix and opened a bug. So why wasn't I blogging while so many things were happening in my life? I am not sure myself either. May be I will contemplate on that and write another blog?

Huh enough rambling. I have to get to work. My shuttle is slowly approaching its final destination (my work place). I will come back with a new blog soon. And oh I forgot "Happy new year"!