Fix a warning, and prepare for handling end-of-track seeking

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9778 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Brandon Low 2006-04-23 22:30:52 +00:00
parent 2e8b933c0d
commit 5cdee94b40

View file

@ -236,7 +236,7 @@ extern struct codec_api ci;
extern struct codec_api ci_voice; extern struct codec_api ci_voice;
/* Was the skip being executed manual or automatic? */ /* Was the skip being executed manual or automatic? */
static bool manual_skip; static bool automatic_skip;
static bool dir_skip = false; static bool dir_skip = false;
/* Callback function to call when current track has really changed. */ /* Callback function to call when current track has really changed. */
@ -946,7 +946,7 @@ static void audio_check_new_track(void)
/* Move to the new track */ /* Move to the new track */
cur_ti = &tracks[track_ridx]; cur_ti = &tracks[track_ridx];
track_changed = manual_skip; track_changed = !automatic_skip;
/* If it is not safe to even skip this many track entries */ /* If it is not safe to even skip this many track entries */
if (ci.new_track >= track_count || ci.new_track <= track_count - MAX_TRACK) if (ci.new_track >= track_count || ci.new_track <= track_count - MAX_TRACK)
@ -1248,15 +1248,15 @@ void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3))
static void codec_track_changed(void) static void codec_track_changed(void)
{ {
automatic_skip = false;
track_changed = true; track_changed = true;
queue_post(&audio_queue, Q_AUDIO_TRACK_CHANGED, 0); queue_post(&audio_queue, Q_AUDIO_TRACK_CHANGED, 0);
} }
static void pcmbuf_track_changed_callback(void) static void pcmbuf_track_changed_callback(void)
{ {
track_changed = true;
pcmbuf_set_position_callback(NULL); pcmbuf_set_position_callback(NULL);
queue_post(&audio_queue, Q_AUDIO_TRACK_CHANGED, 0); codec_track_changed();
} }
/* Yield to codecs for as long as possible if they are in need of data /* Yield to codecs for as long as possible if they are in need of data
@ -1967,18 +1967,18 @@ static bool load_next_track(void) {
if (ci.new_track == 0) if (ci.new_track == 0)
{ {
ci.new_track++; ci.new_track++;
manual_skip = false; automatic_skip = true;
} }
else
manual_skip = true;
cpu_boost(true); cpu_boost(true);
queue_post(&audio_queue, Q_AUDIO_CHECK_NEW_TRACK, 0); queue_post(&audio_queue, Q_AUDIO_CHECK_NEW_TRACK, 0);
while (1) { while (1) {
queue_wait(&codec_callback_queue, &ev); queue_wait(&codec_callback_queue, &ev);
if (ev.id == Q_CODEC_REQUEST_PENDING) if (ev.id == Q_CODEC_REQUEST_PENDING)
if (manual_skip) {
if (!automatic_skip)
pcmbuf_play_stop(); pcmbuf_play_stop();
}
else else
break; break;
} }
@ -1986,7 +1986,7 @@ static bool load_next_track(void) {
switch (ev.id) switch (ev.id)
{ {
case Q_CODEC_REQUEST_COMPLETE: case Q_CODEC_REQUEST_COMPLETE:
track_skip_done(manual_skip); track_skip_done(!automatic_skip);
return true; return true;
case Q_CODEC_REQUEST_FAILED: case Q_CODEC_REQUEST_FAILED:
ci.new_track = 0; ci.new_track = 0;