|
Rockbox mail archiveSubject: 1 standard generic callback system1 standard generic callback system
From: Jonathan Gordon <jdgordy_at_gmail.com>
Date: Wed, 6 Jun 2007 00:32:50 +1000 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, by taking the existing ata_notify_callback code and extending it so functions are registered as callback for certain events. so, what would happen is database, scrobbler and tree would all register individual callbacks on the PLAYBACK_TRACK_CHANGED event, then playback.c (or mpeg.c) would call call_event_callbacks() with the PLAYBACK_TRACK_CHANGED event id and some known data which would then call each registered function (for that id). Firstly, my reasoning for having a seperate module for this is so playback.c doesnt have the extra clutter which just makes it more difficult to work in then it already is, It makes adding more callbacks for an event very simple, and hopefully makes the code a bit smaller if this is current used in a similar way in other parts of the code? The reason for the event id and a single array for the callbacks is that it wastes less ram than having a seperate array for each event group. At the moment, all this patch does it replace the existing ata callback stuff with this, it doesnt touch playback yet. I just wanted to get this out and hopefully get some feedback on weather this is good or not? Also, which other events would be usefull to add? Questions, comments? cheers, Jonathan
Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |