diff options
-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 7a5eb32193..2f36ff0212 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c | |||
@@ -40,12 +40,22 @@ | |||
40 | #include "playback.h" | 40 | #include "playback.h" |
41 | #include "cuesheet.h" | 41 | #include "cuesheet.h" |
42 | 42 | ||
43 | #if CONFIG_CODEC != SWCODEC | ||
44 | /* special trickery because the hwcodec playback engine is in firmware/ */ | ||
45 | static bool cuesheet_handler(const char *filename) | ||
46 | { | ||
47 | return cuesheet_is_enabled() && look_for_cuesheet_file(filename); | ||
48 | } | ||
49 | #endif | ||
43 | 50 | ||
44 | void cuesheet_init(void) | 51 | void cuesheet_init(void) |
45 | { | 52 | { |
46 | if (global_settings.cuesheet) { | 53 | if (global_settings.cuesheet) { |
47 | curr_cue = (struct cuesheet *)buffer_alloc(sizeof(struct cuesheet)); | 54 | curr_cue = (struct cuesheet *)buffer_alloc(sizeof(struct cuesheet)); |
48 | temp_cue = (struct cuesheet *)buffer_alloc(sizeof(struct cuesheet)); | 55 | temp_cue = (struct cuesheet *)buffer_alloc(sizeof(struct cuesheet)); |
56 | #if CONFIG_CODEC != SWCODEC | ||
57 | audio_set_cuesheet_callback(cuesheet_handler); | ||
58 | #endif | ||
49 | } else { | 59 | } else { |
50 | curr_cue = NULL; | 60 | curr_cue = NULL; |
51 | temp_cue = NULL; | 61 | temp_cue = NULL; |
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h index d62ac14ade..b2dbc1ab53 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, | |||
62 | bool last_track)); | 62 | bool last_track)); |
63 | void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3, | 63 | void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3, |
64 | bool last_track)); | 64 | bool last_track)); |
65 | void audio_set_cuesheet_callback(bool (*handler)(const char *filename)); | ||
65 | 66 | ||
66 | #endif | 67 | #endif |
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index cefa699e6d..9afa8a20bd 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -121,6 +121,9 @@ void (*track_changed_callback)(struct mp3entry *id3); | |||
121 | void (*track_buffer_callback)(struct mp3entry *id3, bool last_track); | 121 | void (*track_buffer_callback)(struct mp3entry *id3, bool last_track); |
122 | void (*track_unbuffer_callback)(struct mp3entry *id3, bool last_track); | 122 | void (*track_unbuffer_callback)(struct mp3entry *id3, bool last_track); |
123 | 123 | ||
124 | /* Cuesheet callback */ | ||
125 | static bool (*cuesheet_callback)(const char *filename) = NULL; | ||
126 | |||
124 | static const char mpeg_thread_name[] = "mpeg"; | 127 | static const char mpeg_thread_name[] = "mpeg"; |
125 | static unsigned int mpeg_errno; | 128 | static unsigned int mpeg_errno; |
126 | 129 | ||
@@ -490,6 +493,11 @@ void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3)) | |||
490 | track_changed_callback = handler; | 493 | track_changed_callback = handler; |
491 | } | 494 | } |
492 | 495 | ||
496 | void audio_set_cuesheet_callback(bool (*handler)(const char *filename)) | ||
497 | { | ||
498 | cuesheet_callback = handler; | ||
499 | } | ||
500 | |||
493 | #ifndef SIMULATOR | 501 | #ifndef SIMULATOR |
494 | /* Send callback events to notify about removing old tracks. */ | 502 | /* Send callback events to notify about removing old tracks. */ |
495 | static void generate_unbuffer_events(void) | 503 | static void generate_unbuffer_events(void) |
@@ -926,6 +934,9 @@ static struct trackdata *add_track_to_tag_list(const char *filename) | |||
926 | if (track->id3.album) | 934 | if (track->id3.album) |
927 | lcd_getstringsize(track->id3.album, NULL, NULL); | 935 | lcd_getstringsize(track->id3.album, NULL, NULL); |
928 | #endif | 936 | #endif |
937 | if (cuesheet_callback) | ||
938 | if (cuesheet_callback(filename)) | ||
939 | track->id3.cuesheet_type = 1; | ||
929 | 940 | ||
930 | track_write_idx = (track_write_idx+1) & MAX_TRACK_ENTRIES_MASK; | 941 | track_write_idx = (track_write_idx+1) & MAX_TRACK_ENTRIES_MASK; |
931 | debug_tags(); | 942 | debug_tags(); |