diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2007-03-01 00:26:24 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2007-03-01 00:26:24 +0000 |
| commit | 509a96dd5141dbb9edeadf4480d8aa632b563a27 (patch) | |
| tree | f7419e2c6865d3d6d1b6501d97d473a2b39845b4 | |
| parent | 35ad10be598ccfb0a0394d6def18fa32c74d3d9d (diff) | |
| download | rockbox-509a96dd5141dbb9edeadf4480d8aa632b563a27.zip rockbox-509a96dd5141dbb9edeadf4480d8aa632b563a27.tar.gz rockbox-509a96dd5141dbb9edeadf4480d8aa632b563a27.tar.bz2 rockbox-509a96dd5141dbb9edeadf4480d8aa632b563a27.tar.xz | |
Hook up .cue file detection via a callback klugde on HWCODEC, to make cue sheet support actually work.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12526 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/cuesheet.c | 10 | ||||
| -rw-r--r-- | firmware/export/mpeg.h | 1 | ||||
| -rw-r--r-- | firmware/mpeg.c | 11 |
3 files changed, 22 insertions, 0 deletions
diff --git a/apps/cuesheet.c b/apps/cuesheet.c index 7a5eb32..2f36ff0 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c @@ -40,12 +40,22 @@ #include "playback.h" #include "cuesheet.h" +#if CONFIG_CODEC != SWCODEC +/* special trickery because the hwcodec playback engine is in firmware/ */ +static bool cuesheet_handler(const char *filename) +{ + return cuesheet_is_enabled() && look_for_cuesheet_file(filename); +} +#endif void cuesheet_init(void) { if (global_settings.cuesheet) { curr_cue = (struct cuesheet *)buffer_alloc(sizeof(struct cuesheet)); temp_cue = (struct cuesheet *)buffer_alloc(sizeof(struct cuesheet)); +#if CONFIG_CODEC != SWCODEC + audio_set_cuesheet_callback(cuesheet_handler); +#endif } else { curr_cue = NULL; temp_cue = NULL; diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h index d62ac14..b2dbc1a 100644 --- a/firmware/export/mpeg.h +++ b/firmware/export/mpeg.h @@ -62,5 +62,6 @@ void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3, bool last_track)); void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3, bool last_track)); +void audio_set_cuesheet_callback(bool (*handler)(const char *filename)); #endif diff --git a/firmware/mpeg.c b/firmware/mpeg.c index cefa699..9afa8a2 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -121,6 +121,9 @@ void (*track_changed_callback)(struct mp3entry *id3); void (*track_buffer_callback)(struct mp3entry *id3, bool last_track); void (*track_unbuffer_callback)(struct mp3entry *id3, bool last_track); +/* Cuesheet callback */ +static bool (*cuesheet_callback)(const char *filename) = NULL; + static const char mpeg_thread_name[] = "mpeg"; static unsigned int mpeg_errno; @@ -490,6 +493,11 @@ void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3)) track_changed_callback = handler; } +void audio_set_cuesheet_callback(bool (*handler)(const char *filename)) +{ + cuesheet_callback = handler; +} + #ifndef SIMULATOR /* Send callback events to notify about removing old tracks. */ static void generate_unbuffer_events(void) @@ -926,6 +934,9 @@ static struct trackdata *add_track_to_tag_list(const char *filename) if (track->id3.album) lcd_getstringsize(track->id3.album, NULL, NULL); #endif + if (cuesheet_callback) + if (cuesheet_callback(filename)) + track->id3.cuesheet_type = 1; track_write_idx = (track_write_idx+1) & MAX_TRACK_ENTRIES_MASK; debug_tags(); |