diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-29 21:36:30 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2005-06-29 21:36:30 +0000 |
commit | 7d6d122441e2900d873ca8f96c3ed8063176dd33 (patch) | |
tree | 69be846721869779a5370da2675fcbdac6a31a67 /apps/playback.c | |
parent | 7f8cc3f1c62cd6e09d94b38370e5d6f0bfc625cd (diff) | |
download | rockbox-7d6d122441e2900d873ca8f96c3ed8063176dd33.tar.gz rockbox-7d6d122441e2900d873ca8f96c3ed8063176dd33.zip |
Added event handler to register track changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6936 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/playback.c b/apps/playback.c index 55829a0031..a89441f02a 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -152,7 +152,7 @@ static long fill_bytesleft; | |||
152 | static struct track_info tracks[MAX_TRACK]; | 152 | static struct track_info tracks[MAX_TRACK]; |
153 | 153 | ||
154 | /* Pointer to track info structure about current song playing. */ | 154 | /* Pointer to track info structure about current song playing. */ |
155 | static volatile struct track_info *cur_ti; | 155 | static struct track_info *cur_ti; |
156 | 156 | ||
157 | /* Codec API including function callbacks. */ | 157 | /* Codec API including function callbacks. */ |
158 | extern struct codec_api ci; | 158 | extern struct codec_api ci; |
@@ -161,6 +161,9 @@ extern struct codec_api ci; | |||
161 | variable keeps information about whether to go a next/previous track. */ | 161 | variable keeps information about whether to go a next/previous track. */ |
162 | static int new_track; | 162 | static int new_track; |
163 | 163 | ||
164 | /* Callback function to call when current track has really changed. */ | ||
165 | void (*track_changed_callback)(struct track_info *ti); | ||
166 | |||
164 | /* Configuration */ | 167 | /* Configuration */ |
165 | static int conf_bufferlimit; | 168 | static int conf_bufferlimit; |
166 | static int conf_watermark; | 169 | static int conf_watermark; |
@@ -554,10 +557,15 @@ void codec_configure_callback(int setting, void *value) | |||
554 | } | 557 | } |
555 | } | 558 | } |
556 | 559 | ||
560 | void audio_set_track_changed_event(void (*handler)(struct track_info *ti)) | ||
561 | { | ||
562 | track_changed_callback = handler; | ||
563 | } | ||
564 | |||
557 | void codec_track_changed(void) | 565 | void codec_track_changed(void) |
558 | { | 566 | { |
559 | track_changed = true; | 567 | track_changed = true; |
560 | // queue_post(&audio_queue, AUDIO_TRACK_CHANGED, 0); | 568 | queue_post(&audio_queue, AUDIO_TRACK_CHANGED, 0); |
561 | } | 569 | } |
562 | 570 | ||
563 | void yield_codecs(void) | 571 | void yield_codecs(void) |
@@ -1174,6 +1182,8 @@ void audio_thread(void) | |||
1174 | break ; | 1182 | break ; |
1175 | 1183 | ||
1176 | case AUDIO_TRACK_CHANGED: | 1184 | case AUDIO_TRACK_CHANGED: |
1185 | if (track_changed_callback) | ||
1186 | track_changed_callback(cur_ti); | ||
1177 | break ; | 1187 | break ; |
1178 | 1188 | ||
1179 | case AUDIO_CODEC_DONE: | 1189 | case AUDIO_CODEC_DONE: |
@@ -1549,6 +1559,7 @@ void audio_init(void) | |||
1549 | paused = false; | 1559 | paused = false; |
1550 | track_changed = false; | 1560 | track_changed = false; |
1551 | current_fd = -1; | 1561 | current_fd = -1; |
1562 | track_changed_callback = NULL; | ||
1552 | 1563 | ||
1553 | logf("abuf:%0x", PCMBUF_SIZE); | 1564 | logf("abuf:%0x", PCMBUF_SIZE); |
1554 | logf("fbuf:%0x", codecbuflen); | 1565 | logf("fbuf:%0x", codecbuflen); |