1
0
Fork 0
forked from len0rd/rockbox

First step towards better ID3 handling

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1450 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-07-25 23:12:41 +00:00
parent d2018ebfc6
commit e5792d6f6c
2 changed files with 23 additions and 2 deletions

View file

@ -139,11 +139,13 @@ int mpeg_sound_default(int setting)
} }
/* list of tracks in memory */ /* list of tracks in memory */
#define MAX_ID3_TAGS 4 #define MAX_ID3_TAGS 12
static struct { static struct {
struct mp3entry id3; struct mp3entry id3;
int mempos; int mempos;
} id3tags[MAX_ID3_TAGS]; } id3tags[MAX_ID3_TAGS];
static unsigned int current_track_counter = 0;
static unsigned int last_track_counter = 0;
#ifndef SIMULATOR #ifndef SIMULATOR
static int last_tag = 0; static int last_tag = 0;
@ -582,6 +584,8 @@ static void mpeg_thread(void)
/* Tell the file loading code that we want to start playing /* Tell the file loading code that we want to start playing
as soon as we have some data */ as soon as we have some data */
play_pending = true; play_pending = true;
current_track_counter++;
break; break;
case MPEG_STOP: case MPEG_STOP:
@ -629,6 +633,8 @@ static void mpeg_thread(void)
/* Tell the file loading code that we want to start playing /* Tell the file loading code that we want to start playing
as soon as we have some data */ as soon as we have some data */
play_pending = true; play_pending = true;
current_track_counter++;
} }
break; break;
@ -655,6 +661,8 @@ static void mpeg_thread(void)
/* Tell the file loading code that we want to start playing /* Tell the file loading code that we want to start playing
as soon as we have some data */ as soon as we have some data */
play_pending = true; play_pending = true;
current_track_counter++;
} }
break; break;
@ -820,6 +828,8 @@ static void mpeg_thread(void)
DEBUGF("tc: %d, %x\n", i, id3tags[i].mempos); DEBUGF("tc: %d, %x\n", i, id3tags[i].mempos);
} }
last_tag--; last_tag--;
current_track_counter++;
break; break;
case SYS_USB_CONNECTED: case SYS_USB_CONNECTED:
@ -885,6 +895,16 @@ struct mp3entry* mpeg_current_track(void)
return &(id3tags[0].id3); return &(id3tags[0].id3);
} }
bool mpeg_has_changed_track(void)
{
if(last_track_counter != current_track_counter)
{
last_track_counter = current_track_counter;
return true;
}
return false;
}
void mpeg_play(char* trackname) void mpeg_play(char* trackname)
{ {
#ifdef SIMULATOR #ifdef SIMULATOR
@ -1196,5 +1216,5 @@ void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, i
mpeg_sound_set(SOUND_SUPERBASS, bass_boost); mpeg_sound_set(SOUND_SUPERBASS, bass_boost);
mpeg_sound_set(SOUND_AVC, avc); mpeg_sound_set(SOUND_AVC, avc);
#endif #endif
#endif /* SIMULATOR */ #endif /* !SIMULATOR */
} }

View file

@ -37,6 +37,7 @@ int mpeg_val2phys(int setting, int value);
char *mpeg_sound_unit(int setting); char *mpeg_sound_unit(int setting);
int mpeg_sound_numdecimals(int setting); int mpeg_sound_numdecimals(int setting);
struct mp3entry* mpeg_current_track(void); struct mp3entry* mpeg_current_track(void);
bool mpeg_has_changed_track(void);
#define SOUND_VOLUME 0 #define SOUND_VOLUME 0
#define SOUND_BASS 1 #define SOUND_BASS 1