diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2005-12-03 12:14:26 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2005-12-03 12:14:26 +0000 |
commit | 999f89c46d83d5b9a13421765e675240d58ce80a (patch) | |
tree | bdce65930499ced16c6b15ec3d22b895739f7a81 /apps/playback.c | |
parent | c8ab8c6b516b3205983474d142d4438d0f049b38 (diff) | |
download | rockbox-999f89c46d83d5b9a13421765e675240d58ce80a.tar.gz rockbox-999f89c46d83d5b9a13421765e675240d58ce80a.zip |
Fixed a problem with playback when skipping from last track. No more
skipping the first track in a directory when advancing to the next dir.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8133 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/playback.c b/apps/playback.c index 893a824742..c8fd5d81d6 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -179,6 +179,9 @@ static struct track_info tracks[MAX_TRACK]; | |||
179 | /* Pointer to track info structure about current song playing. */ | 179 | /* Pointer to track info structure about current song playing. */ |
180 | static struct track_info *cur_ti; | 180 | static struct track_info *cur_ti; |
181 | 181 | ||
182 | /* Have we reached end of the current playlist. */ | ||
183 | static bool playlist_end = false; | ||
184 | |||
182 | /* Codec API including function callbacks. */ | 185 | /* Codec API including function callbacks. */ |
183 | extern struct codec_api ci; | 186 | extern struct codec_api ci; |
184 | extern struct codec_api ci_voice; | 187 | extern struct codec_api ci_voice; |
@@ -572,6 +575,7 @@ static bool rebuffer_and_seek(int newpos) | |||
572 | /* Clear codec buffer. */ | 575 | /* Clear codec buffer. */ |
573 | audio_invalidate_tracks(); | 576 | audio_invalidate_tracks(); |
574 | filebufused = 0; | 577 | filebufused = 0; |
578 | playlist_end = false; | ||
575 | buf_ridx = buf_widx = 0; | 579 | buf_ridx = buf_widx = 0; |
576 | cur_ti->filerem = cur_ti->filesize - newpos; | 580 | cur_ti->filerem = cur_ti->filesize - newpos; |
577 | cur_ti->filepos = newpos; | 581 | cur_ti->filepos = newpos; |
@@ -1066,7 +1070,7 @@ static bool audio_load_track(int offset, bool start_play, int peek_offset) | |||
1066 | 1070 | ||
1067 | if (!trackname) { | 1071 | if (!trackname) { |
1068 | logf("End-of-playlist"); | 1072 | logf("End-of-playlist"); |
1069 | conf_watermark = 0; | 1073 | playlist_end = true; |
1070 | return false; | 1074 | return false; |
1071 | } | 1075 | } |
1072 | 1076 | ||
@@ -1402,7 +1406,7 @@ static void audio_check_buffer(void) | |||
1402 | /* Start buffer filling as necessary. */ | 1406 | /* Start buffer filling as necessary. */ |
1403 | if ((!conf_watermark || filebufused > conf_watermark | 1407 | if ((!conf_watermark || filebufused > conf_watermark |
1404 | || !queue_empty(&audio_queue) || !playing || ci.stop_codec | 1408 | || !queue_empty(&audio_queue) || !playing || ci.stop_codec |
1405 | || ci.reload_codec) && !filling) | 1409 | || ci.reload_codec || playlist_end) && !filling) |
1406 | return ; | 1410 | return ; |
1407 | 1411 | ||
1408 | mutex_lock(&mutex_bufferfill); | 1412 | mutex_lock(&mutex_bufferfill); |
@@ -1507,6 +1511,7 @@ static int skip_next_track(void) | |||
1507 | if (tracks[track_ridx].filesize <= 0) | 1511 | if (tracks[track_ridx].filesize <= 0) |
1508 | { | 1512 | { |
1509 | logf("Loading from disk..."); | 1513 | logf("Loading from disk..."); |
1514 | ci.reload_codec = true; | ||
1510 | queue_post(&audio_queue, AUDIO_PLAY, 0); | 1515 | queue_post(&audio_queue, AUDIO_PLAY, 0); |
1511 | return SKIP_OK_DISK; | 1516 | return SKIP_OK_DISK; |
1512 | } | 1517 | } |
@@ -1538,6 +1543,7 @@ static int skip_previous_track(void) | |||
1538 | filebufused+ci.curpos+tracks[track_ridx].filesize | 1543 | filebufused+ci.curpos+tracks[track_ridx].filesize |
1539 | /*+ (off_t)tracks[track_ridx].codecsize*/ > filebuflen) { | 1544 | /*+ (off_t)tracks[track_ridx].codecsize*/ > filebuflen) { |
1540 | logf("Loading from disk..."); | 1545 | logf("Loading from disk..."); |
1546 | ci.reload_codec = true; | ||
1541 | queue_post(&audio_queue, AUDIO_PLAY, 0); | 1547 | queue_post(&audio_queue, AUDIO_PLAY, 0); |
1542 | return SKIP_OK_DISK; | 1548 | return SKIP_OK_DISK; |
1543 | } | 1549 | } |
@@ -1644,6 +1650,7 @@ void audio_invalidate_tracks(void) | |||
1644 | return ; | 1650 | return ; |
1645 | } | 1651 | } |
1646 | 1652 | ||
1653 | playlist_end = false; | ||
1647 | track_count = 1; | 1654 | track_count = 1; |
1648 | last_peek_offset = 0; | 1655 | last_peek_offset = 0; |
1649 | track_widx = track_ridx; | 1656 | track_widx = track_ridx; |
@@ -1713,6 +1720,7 @@ void audio_thread(void) | |||
1713 | track_count = 0; | 1720 | track_count = 0; |
1714 | last_peek_offset = 0; | 1721 | last_peek_offset = 0; |
1715 | track_changed = true; | 1722 | track_changed = true; |
1723 | playlist_end = false; | ||
1716 | if (current_tick - last_tick < HZ/2) | 1724 | if (current_tick - last_tick < HZ/2) |
1717 | { | 1725 | { |
1718 | play_pending = true; | 1726 | play_pending = true; |
@@ -1773,12 +1781,14 @@ void audio_thread(void) | |||
1773 | case AUDIO_NEXT: | 1781 | case AUDIO_NEXT: |
1774 | logf("audio_next"); | 1782 | logf("audio_next"); |
1775 | last_tick = current_tick; | 1783 | last_tick = current_tick; |
1784 | playlist_end = false; | ||
1776 | initiate_track_change(1); | 1785 | initiate_track_change(1); |
1777 | break ; | 1786 | break ; |
1778 | 1787 | ||
1779 | case AUDIO_PREV: | 1788 | case AUDIO_PREV: |
1780 | logf("audio_prev"); | 1789 | logf("audio_prev"); |
1781 | last_tick = current_tick; | 1790 | last_tick = current_tick; |
1791 | playlist_end = false; | ||
1782 | initiate_track_change(-1); | 1792 | initiate_track_change(-1); |
1783 | break; | 1793 | break; |
1784 | 1794 | ||
@@ -1791,6 +1801,7 @@ void audio_thread(void) | |||
1791 | 1801 | ||
1792 | case AUDIO_DIR_NEXT: | 1802 | case AUDIO_DIR_NEXT: |
1793 | logf("audio_dir_next"); | 1803 | logf("audio_dir_next"); |
1804 | playlist_end = false; | ||
1794 | if (global_settings.beep) | 1805 | if (global_settings.beep) |
1795 | pcmbuf_beep(5000, 100, 2500*global_settings.beep); | 1806 | pcmbuf_beep(5000, 100, 2500*global_settings.beep); |
1796 | initiate_dir_change(1); | 1807 | initiate_dir_change(1); |
@@ -1798,6 +1809,7 @@ void audio_thread(void) | |||
1798 | 1809 | ||
1799 | case AUDIO_DIR_PREV: | 1810 | case AUDIO_DIR_PREV: |
1800 | logf("audio_dir_prev"); | 1811 | logf("audio_dir_prev"); |
1812 | playlist_end = false; | ||
1801 | if (global_settings.beep) | 1813 | if (global_settings.beep) |
1802 | pcmbuf_beep(5000, 100, 2500*global_settings.beep); | 1814 | pcmbuf_beep(5000, 100, 2500*global_settings.beep); |
1803 | initiate_dir_change(-1); | 1815 | initiate_dir_change(-1); |