summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-03-07 14:38:51 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-03-07 14:38:51 +0000
commit728868a86311bf67ba6624896bb461351010f415 (patch)
tree894a88b24c71736730d22b6710ab96f1c1fe1082
parentb443ba46ecabf3460ed8664da64e67f76ed50e43 (diff)
downloadrockbox-728868a86311bf67ba6624896bb461351010f415.tar.gz
rockbox-728868a86311bf67ba6624896bb461351010f415.zip
I am silly. We need the dedicated buffer for ram playlists (dir play). Now only uses the mp3 buffer when loading a list from disk.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3398 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playlist.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 31c8648147..c458821688 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -40,10 +40,11 @@
40static struct playlist_info playlist; 40static struct playlist_info playlist;
41 41
42#define QUEUE_FILE ROCKBOX_DIR "/.queue_file" 42#define QUEUE_FILE ROCKBOX_DIR "/.queue_file"
43#define PLAYLIST_BUFFER_SIZE (&mp3end - &mp3buf[0]) 43
44#define PLAYLIST_BUFFER_SIZE (AVERAGE_FILENAME_LENGTH*MAX_FILES_IN_DIR)
45static unsigned char playlist_buffer[PLAYLIST_BUFFER_SIZE];
44 46
45extern unsigned char mp3buf[],mp3end; 47extern unsigned char mp3buf[],mp3end;
46static unsigned char* playlist_buffer = mp3buf;
47static int playlist_end_pos = 0; 48static int playlist_end_pos = 0;
48 49
49static char now_playing[MAX_PATH+1]; 50static char now_playing[MAX_PATH+1];
@@ -643,15 +644,20 @@ void add_indices_to_playlist(void)
643 int i = 0; 644 int i = 0;
644 int count = 0; 645 int count = 0;
645 int next_tick = current_tick + HZ; 646 int next_tick = current_tick + HZ;
647 unsigned char* buffer = playlist_buffer;
648 int buflen = PLAYLIST_BUFFER_SIZE;
646 bool store_index; 649 bool store_index;
647 650 unsigned char *p;
648 unsigned char *p = playlist_buffer;
649 char line[16]; 651 char line[16];
650 652
651 if(!playlist.in_ram) { 653 if(!playlist.in_ram) {
652 fd = open(playlist.filename, O_RDONLY); 654 fd = open(playlist.filename, O_RDONLY);
653 if(-1 == fd) 655 if(-1 == fd)
654 return; /* failure */ 656 return; /* failure */
657
658 /* use mp3 buffer for maximum load speed */
659 buflen = (&mp3end - &mp3buf[0]);
660 buffer = mp3buf;
655 } 661 }
656 662
657 store_index = true; 663 store_index = true;
@@ -663,13 +669,13 @@ void add_indices_to_playlist(void)
663 if(playlist.in_ram) { 669 if(playlist.in_ram) {
664 nread = playlist_end_pos; 670 nread = playlist_end_pos;
665 } else { 671 } else {
666 nread = read(fd, playlist_buffer, PLAYLIST_BUFFER_SIZE); 672 nread = read(fd, buffer, buflen);
667 /* Terminate on EOF */ 673 /* Terminate on EOF */
668 if(nread <= 0) 674 if(nread <= 0)
669 break; 675 break;
670 } 676 }
671 677
672 p = playlist_buffer; 678 p = buffer;
673 679
674 for(count=0; count < nread; count++,p++) { 680 for(count=0; count < nread; count++,p++) {
675 681