April 27, 2010

Finally there — Google Summer of Code 2010

Filed under: Blog — krkhan @ 1:02 am

GSoC 2010 Logo

Fate has a curious sense of humor. After having 8 of my proposals rejected in past 3 years for Google Summer of Code, I had 2 of them selected in the same year. In GSoC terminology, I became a “duplicate” student. Now, the standard practice for such cases is that the administrators of both organizations interested in the student get together in a “deduplication” meeting and resolve the conflict. However, Maria Randazzo (the program administrator from the Ubuntu organization) was kind enough to ask my preference regarding the project I’d like to work upon.

This put me in a rather uneasy position as mentors from both organizations (Bryce Harrington from Ubuntu & Alexey Khoroshilov from The Linux Foundation) had been really helpful during the application process. In the end however, I chose Ubuntu since its proposal focused on Arsenal and Python which I found relatively more familiar than Alien and Perl. I had also already collaborated with Bryce for some Arsenal patches before so it was easier for me to get up-to-speed with the Ubuntu proposal.

The proposal itself is in fact publicly viewable at this link. Summarizing my feelings, I’ve never looked forward to a summer as much as this one.

“If a June night could talk, it would probably boast it invented romance code.” —Bern Williams

Tags: , , , , , , , , ,

March 29, 2009

wmartagu: Viewer/editor for WMA metadata info

Filed under: Blog — krkhan @ 11:05 am

As part of a Google Summer of Code application challenge, I was required to code an application for which the check-list was:

  • Accepts 1 WMA file name on the command line
  • Accepts -a for artist
  • Accepts -t for title
  • Removes the current tag from a WMA
  • Writes a new tag to the WMA file containing the new artist & title

And the bonus points:

  • The program does not obliterate the existing tag but merges the new information
  • The program is robust and does not destroy any of the test WMA files
  • The program does not emit any compile warnings during build
  • The program is UTF-8 clean

Consulting the ASF specification, my first attempt to code the application resulted in wmartag.c. However, since the last bonus point wasn’t present in the list at the time, the program didn’t support UTF-8 (and used hand-tweaked dirty functions for converting between ASCII and low-endian UTF-16). After I found out about the bonus goal, I reimplemented the program from scratch and renamed it to wmartagu. The new code relies on GLib for character code conversions which really does work like a charm:

[krkhan@orthanc wmartagu]$ make

make wmartagu
make[1]: Entering directory `/home/krkhan/Desktop/wmartagu’
cc -Wall -g `pkg-config –cflags –libs glib-2.0` wmartagu.c -o wmartagu
make[1]: Leaving directory `/home/krkhan/Desktop/wmartagu’

[krkhan@orthanc wmartagu]$ ./wmartagu O\ Fortuna.wma

Title: O Fortuna
Author: Carl Orff


[krkhan@orthanc wmartagu]$ ./wmartagu -t ɹǝqɯǝʇdǝs O\ Fortuna.wma

Title: ɹǝqɯǝʇdǝs
Author: Carl Orff

Tags updated successfully.

[krkhan@orthanc wmartagu]$ mplayer -v -v -v O\ Fortuna.wma

MPlayer SVN-r28461-4.3.2 (C) 2000-2009 MPlayer Team
CPU: Intel(R) Core(TM)2 CPU T5600 @ 1.83GHz (Family: 6, Model: 15, Stepping: 2)

Playing O Fortuna.wma.
ASF file format detected.
[asfheader] Audio stream found, -aid 1
Clip info:
name: ɹǝqɯǝʇdǝs
author: Carl Orff

Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 192.0 kbit/13.61% (ratio: 24002->176400)
Selected audio codec: [ffwmav2] afm: ffmpeg (DivX audio v2 (FFmpeg))
AO: [pulse] 44100Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback…
A: 3.3 (03.3) of 153.0 (02:33.0) 0.4%

MPlayer interrupted by signal 2 in module: play_audio
A: 3.3 (03.3) of 153.0 (02:33.0) 0.4%
Exiting… (Quit)

This does not go without saying that if you do try to tackle the UTF character encodings without using any libraries, may God have mercy on your soul, because Unicode won’t. Also, “wmartagu” simply means “WMA Artist/Title Tagger with UTF-8 support” and does not — as it would lead one to otherwise assume — represent any noble African philosophy such as Ubuntu.

Tags: , , , , , , , , , , , , , , ,
« Previous Page