Monday, June 30, 2008

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

Ever since I posted the cTunes video on youtube (http://youtube.com/watch?v=coV06ChYWJo), 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 code.google.com 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.
Post a Comment