diff options
author | Brandon Low <lostlogic@rockbox.org> | 2006-04-08 12:58:39 +0000 |
---|---|---|
committer | Brandon Low <lostlogic@rockbox.org> | 2006-04-08 12:58:39 +0000 |
commit | 502fbd710cc312dc54c6a9d236a1c1de80b62387 (patch) | |
tree | 0c1e23ca95aa5ac8036b0660ed036eab37fcb4fc /apps | |
parent | cbd21405fc805dc0d494336a9df3401f94640278 (diff) | |
download | rockbox-502fbd710cc312dc54c6a9d236a1c1de80b62387.tar.gz rockbox-502fbd710cc312dc54c6a9d236a1c1de80b62387.zip |
Correct seeking behavior (whoops), might fix the coldfire deadlocks. Reintroduce the foreshortened initial buffer fill, this should maybe be optional
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9564 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/playback.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/apps/playback.c b/apps/playback.c index 081764caf2..e82930097b 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -96,7 +96,6 @@ enum { | |||
96 | Q_AUDIO_SKIP, | 96 | Q_AUDIO_SKIP, |
97 | Q_AUDIO_PRE_FF_REWIND, | 97 | Q_AUDIO_PRE_FF_REWIND, |
98 | Q_AUDIO_FF_REWIND, | 98 | Q_AUDIO_FF_REWIND, |
99 | Q_AUDIO_SEEK_COMPLETE, | ||
100 | Q_AUDIO_FLUSH_RELOAD, | 99 | Q_AUDIO_FLUSH_RELOAD, |
101 | Q_AUDIO_CODEC_DONE, | 100 | Q_AUDIO_CODEC_DONE, |
102 | Q_AUDIO_FLUSH, | 101 | Q_AUDIO_FLUSH, |
@@ -151,6 +150,7 @@ static void (*voice_getmore)(unsigned char** start, int* size); | |||
151 | 150 | ||
152 | /* Is file buffer currently being refilled? */ | 151 | /* Is file buffer currently being refilled? */ |
153 | static volatile bool filling; | 152 | static volatile bool filling; |
153 | static volatile bool filling_initial; | ||
154 | 154 | ||
155 | volatile int current_codec; | 155 | volatile int current_codec; |
156 | extern unsigned char codecbuf[]; | 156 | extern unsigned char codecbuf[]; |
@@ -686,8 +686,15 @@ off_t codec_mp3_get_filepos_callback(int newtime) | |||
686 | 686 | ||
687 | void codec_seek_complete_callback(void) | 687 | void codec_seek_complete_callback(void) |
688 | { | 688 | { |
689 | logf("seek_complete"); | ||
690 | if (pcm_is_paused()) { | ||
691 | /* If this is not a seamless seek, clear the buffer */ | ||
692 | pcmbuf_play_stop(); | ||
693 | /* If playback was not 'deliberately' paused, unpause now */ | ||
694 | if (!paused) | ||
695 | pcmbuf_pause(false); | ||
696 | } | ||
689 | ci.seek_time = 0; | 697 | ci.seek_time = 0; |
690 | queue_post(&audio_queue, Q_AUDIO_SEEK_COMPLETE, 0); | ||
691 | } | 698 | } |
692 | 699 | ||
693 | bool codec_seek_buffer_callback(size_t newpos) | 700 | bool codec_seek_buffer_callback(size_t newpos) |
@@ -918,6 +925,9 @@ static void audio_read_file(void) | |||
918 | track_widx = 0; | 925 | track_widx = 0; |
919 | } | 926 | } |
920 | tracks[track_widx].filesize = 0; | 927 | tracks[track_widx].filesize = 0; |
928 | /* If this is an initial fill, stop after one track is complete */ | ||
929 | if (filling_initial) | ||
930 | fill_bytesleft = 0; | ||
921 | } else { | 931 | } else { |
922 | logf("Partially buf:%d", tracks[track_widx].available); | 932 | logf("Partially buf:%d", tracks[track_widx].available); |
923 | } | 933 | } |
@@ -1395,7 +1405,11 @@ static void initialize_buffer_fill(bool start_play) | |||
1395 | { | 1405 | { |
1396 | int cur_idx, i; | 1406 | int cur_idx, i; |
1397 | 1407 | ||
1398 | fill_bytesleft = filebuflen - filebufused; | 1408 | if (!filling_initial && !start_play) |
1409 | { | ||
1410 | fill_bytesleft = filebuflen - filebufused; | ||
1411 | cur_ti->start_pos = ci.curpos; | ||
1412 | } | ||
1399 | 1413 | ||
1400 | /* Initialize only once; do not truncate the tracks. */ | 1414 | /* Initialize only once; do not truncate the tracks. */ |
1401 | if (filling) | 1415 | if (filling) |
@@ -1407,8 +1421,6 @@ static void initialize_buffer_fill(bool start_play) | |||
1407 | pcmbuf_set_boost_mode(true); | 1421 | pcmbuf_set_boost_mode(true); |
1408 | 1422 | ||
1409 | if (!start_play) { | 1423 | if (!start_play) { |
1410 | cur_ti->start_pos = ci.curpos; | ||
1411 | |||
1412 | /* Calculate real track count after throwing away old tracks. */ | 1424 | /* Calculate real track count after throwing away old tracks. */ |
1413 | cur_idx = track_ridx; | 1425 | cur_idx = track_ridx; |
1414 | for (i = 0; i < track_count; i++) { | 1426 | for (i = 0; i < track_count; i++) { |
@@ -1430,6 +1442,11 @@ static void initialize_buffer_fill(bool start_play) | |||
1430 | /* Mark all buffered entries null (not metadata for next track). */ | 1442 | /* Mark all buffered entries null (not metadata for next track). */ |
1431 | audio_clear_track_entries(true); | 1443 | audio_clear_track_entries(true); |
1432 | } | 1444 | } |
1445 | else | ||
1446 | { | ||
1447 | filling_initial = true; | ||
1448 | fill_bytesleft = filebuflen >> 2; | ||
1449 | } | ||
1433 | 1450 | ||
1434 | filling = true; | 1451 | filling = true; |
1435 | 1452 | ||
@@ -1460,6 +1477,7 @@ static void audio_fill_file_buffer(bool start_play, size_t offset) | |||
1460 | 1477 | ||
1461 | generate_postbuffer_events(); | 1478 | generate_postbuffer_events(); |
1462 | filling = false; | 1479 | filling = false; |
1480 | filling_initial = false; | ||
1463 | pcmbuf_set_boost_mode(false); | 1481 | pcmbuf_set_boost_mode(false); |
1464 | 1482 | ||
1465 | #ifndef SIMULATOR | 1483 | #ifndef SIMULATOR |
@@ -1862,17 +1880,6 @@ void audio_thread(void) | |||
1862 | ci.seek_time = (long)ev.data+1; | 1880 | ci.seek_time = (long)ev.data+1; |
1863 | break ; | 1881 | break ; |
1864 | 1882 | ||
1865 | case Q_AUDIO_SEEK_COMPLETE: | ||
1866 | logf("seek_complete"); | ||
1867 | if (pcm_is_paused()) { | ||
1868 | /* If this is not a seamless seek, clear the buffer */ | ||
1869 | pcmbuf_play_stop(); | ||
1870 | /* If playback was not 'deliberately' paused, unpause now */ | ||
1871 | if (!paused) | ||
1872 | pcmbuf_pause(false); | ||
1873 | } | ||
1874 | break; | ||
1875 | |||
1876 | case Q_AUDIO_DIR_SKIP: | 1883 | case Q_AUDIO_DIR_SKIP: |
1877 | logf("audio_dir_skip"); | 1884 | logf("audio_dir_skip"); |
1878 | playlist_end = false; | 1885 | playlist_end = false; |