Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: 1 standard generic callback system

Re: 1 standard generic callback system

From: Ray Lambert <codemonkey_at_interthingy.net>
Date: Tue, 5 Jun 2007 18:45:28 -0400 (EDT)

Jonathan Gordon wrote:
> hey all,
> so, in IRC we somehow got onto the problem that the filebrowser needs
> to know when a track changes (so the follow playlist can work
> properly), and scrobbler and database also need to know when this
> happens.
> playback.c has a few callbacks but only allows one function to be
> registered for each, which causes a bit of a mess in playback.c (and
> is one reason why scrobbler is broken on hwcodec.)
>
> My attached patch addresses this issue, ...

Jonathan,

Just to add some fuel to the fire, I also implemented a callback interface
when I wrote my A/B repeat feature. It's defined in
firmware/export/audio.h and implemented in firmware/mpeg.c

It uses a bitmask to subscribe to events (with a single callback per
subscription) and a fixed-size array (sized by #define) to hold up to 10
registered callbacks. It supports track position updates and end-of-track
notification.

(I don't think the latter makes next track info available, so it may not
be useful for filebrowser, etc., unless next track info can be plucked
from somewhere.)

AFAIK, this facility is only used by apps/abrepeat.c. It's been a while
since I worked on it so there may have been changes that I'm not aware of.
 Also, I implemented this against the Archos chip-based MP3 decoding and
I'm not sure if it works with the SW codecs. (I've been meaning to port
A/B repeat to the IAudio X5, which would mean updating it to work with SW
codecs and custom WPSs, but I haven't been able to find the time.)

~ray
Received on 2007-06-06


Page was last modified "Jan 10 2012" The Rockbox Crew
aaa