summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-08-07 06:04:24 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-08-07 06:04:24 +0000
commit8abcf1bd20d8568c3b39f97fb7ee9560b132f2a3 (patch)
tree5a6fbbaf5e2b567dad7263ef74add58585d91ae4
parent7b95b82e2e9e8a4e0b030fad425f82ef20eb1c68 (diff)
downloadrockbox-8abcf1bd20d8568c3b39f97fb7ee9560b132f2a3.zip
rockbox-8abcf1bd20d8568c3b39f97fb7ee9560b132f2a3.tar.gz
rockbox-8abcf1bd20d8568c3b39f97fb7ee9560b132f2a3.tar.bz2
rockbox-8abcf1bd20d8568c3b39f97fb7ee9560b132f2a3.tar.xz
Changed playlist API again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1575 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playlist.c4
-rw-r--r--apps/playlist.h4
-rw-r--r--apps/tree.c34
3 files changed, 15 insertions, 27 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 465470c..44d1e34 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -153,13 +153,15 @@ char* playlist_next(int steps)
}
}
-void play_list(char *dir, char *file)
+void play_list(char *dir, char *file, int start_index)
{
char *sep="";
int dirlen;
empty_playlist();
+ playlist.index = start_index;
+
/* If file is NULL, the list is in RAM */
if(file) {
lcd_clear_display();
diff --git a/apps/playlist.h b/apps/playlist.h
index a218209..2e3d6a3 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -37,10 +37,10 @@ typedef struct
bool in_ram; /* True if the playlist is RAM-based */
} playlist_info_t;
-//extern playlist_info_t playlist;
+extern playlist_info_t playlist;
extern bool playlist_shuffle;
-void play_list(char *dir, char *file);
+void play_list(char *dir, char *file, int start_index);
char* playlist_next(int steps);
void randomise_playlist( unsigned int seed );
void sort_playlist(void);
diff --git a/apps/tree.c b/apps/tree.c
index 6e4b6f7..733545a 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -109,12 +109,13 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6];
#define TREE_ATTR_M3U 0x80 /* unused by FAT attributes */
#define TREE_ATTR_MP3 0x40 /* unused by FAT attributes */
-static void build_playlist(int start_index)
+static void build_playlist(void)
{
int i;
playlist_clear();
- for(i = start_index;i < filesindir;i++)
+
+ for(i = 0;i < filesindir;i++)
{
if(dircacheptr[i]->attr & TREE_ATTR_MP3)
{
@@ -251,7 +252,6 @@ static int start=0;
static int dirpos[MAX_DIR_LEVELS];
static int cursorpos[MAX_DIR_LEVELS];
static int dirlevel=0;
-static int play_mode = 0;
static char currdir[MAX_PATH];
/* QUICK HACK! this should be handled by the playlist code later */
@@ -303,8 +303,6 @@ bool dirbrowse(char *root)
button = button_get(true);
switch ( button ) {
case TREE_EXIT:
- if ( play_mode == 1 )
- play_mode = 0;
i=strlen(currdir);
if (i>1) {
while (currdir[i-1]!='/')
@@ -328,7 +326,6 @@ bool dirbrowse(char *root)
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_OFF:
mpeg_stop();
- play_mode = 0;
status_set_playmode(STATUS_STOP);
break;
#endif
@@ -349,8 +346,6 @@ bool dirbrowse(char *root)
}
if (dircacheptr[dircursor+start]->attr & ATTR_DIRECTORY) {
- if ( play_mode == 1 )
- play_mode = 0;
memcpy(currdir,buf,sizeof(currdir));
if ( dirlevel < MAX_DIR_LEVELS ) {
dirpos[dirlevel] = start;
@@ -363,16 +358,14 @@ bool dirbrowse(char *root)
lcd_stop_scroll();
if(dircacheptr[dircursor+start]->attr & TREE_ATTR_M3U )
{
- play_mode = 2;
- play_list(currdir, dircacheptr[dircursor+start]->name);
- status_set_playmode(STATUS_PLAY);
+ play_list(currdir,
+ dircacheptr[dircursor+start]->name, 0);
}
else {
- build_playlist(dircursor+start);
- play_mode = 2;
- play_list(currdir, NULL);
- status_set_playmode(STATUS_PLAY);
+ build_playlist();
+ play_list(currdir, NULL, dircursor+start);
}
+ status_set_playmode(STATUS_PLAY);
status_draw();
lcd_stop_scroll();
rc = wps_show();
@@ -384,7 +377,6 @@ bool dirbrowse(char *root)
dirlevel = 0;
dircursor = 0;
start = 0;
- play_mode = 0;
}
}
restore = true;
@@ -582,12 +574,8 @@ bool dirbrowse(char *root)
case BUTTON_ON:
browse_speed = 0;
- /* The mpeg thread may have stopped playing, so we'd
- better update our status */
- if(!mpeg_is_playing())
- play_mode = 0;
-
- if ( play_mode ) {
+ if (mpeg_is_playing())
+ {
lcd_stop_scroll();
rc = wps_show();
if(rc == SYS_USB_CONNECTED)
@@ -598,7 +586,6 @@ bool dirbrowse(char *root)
dirlevel = 0;
dircursor = 0;
start = 0;
- play_mode = 0;
}
restore = true;
}
@@ -620,7 +607,6 @@ bool dirbrowse(char *root)
dirlevel = 0;
dircursor = 0;
start = 0;
- play_mode = 0;
break;
#endif
}