Sunday, March 27, 2011

Spending some quality time with the toys.

Hmm, I've been ignoring this place for a bit.  Too busy playing with the toys to write about them.  So I guess it's about time.

I recently updated my Zipit patches to the latest rockbox sources and actually submitted them to the official rockbox bug and patch tracker for comments.

Main Zipit Patch
Rockbox Plugin Keymap Patch

This code update got me the fix for changing codecs on the fly.  Yay!  But unfortunately the "high performance" sigalstack thread implementation locks up on the splash screen in the IZ2S build, so I had to drop back to the low-tech SDL threads implementation, again.  Rockbox seems to use about 2% less CPU with the current code, but also seems about 10% more likely to skip or click than my older IZ2S build.  WTF?  Between this and GMU I'm starting to think the old stock zipit kernel scheduler has better audio thread response time with a higher CPU load.  Anyhow, I'm planning to build a z2lite version off the newer code and see if the sigalstack thread  implementation works there.  And I'm still hoping the pandora guys replace the SDL audio backend with an ALSA backend before I succumb to temptation and make a total mess of it.

Meanwhile, I made some minor changes to the keymap.  Borrowing ideas from GMU, I put the rewind and fast-forward keys on < and > so they're near the pause function, which is mapped to the space bar.  All easy to find by touch and thus good for the car.  The quickscreen and playlist functions previously on < and > have been moved up to the L and BS keys.  I don't use those nearly as much, and never need to find them by touch because they require me to look at the screen anyhow.

I also started on internet radio plugin.  Sorta.  I dreamed I could pipe the output of wget fetching an internet radio stream URL into rockbox using popen.  So I ran a quick command line test with "wget -qO- URL >file.mp3" and then played the file.mp3 with mplayer. That worked, so I coded up a quick and dirty viewer plugin and configured rockbox to let it take over whenever you click on a .pls file in the rockbox file browser.  So far it pulls out the stream URL and the name of the stream and displays them both briefly on the rockbox screen.

I got a bit lost trying to figure out where to send the stream data though.  Looking at the wavplay.c and video.c plugin code just made it worse.  There's IRQ handlers and buffers and I'm not sure if the mp3 codec API expects me to find the bitrate of the stream myself before doing anything with the stream data.  Plus I'm a bit nervous about using a pipe since I don't know how to stop or pause it, or handle it if it stops on it's own.  I also forgot pipes require a special pclose call to clean up the pipe when yer done.  So this idea may have to wait a bit until I dream up a better solution, a solution with all the pesky details included...

Maybe next time I'll dream about grafting it onto the FM radio code.  That might make more sense.  Pause controls, channel presets, and the FM play screen are probably analogous to the needs of an internet radio player.

No comments:

Post a Comment