Fixed some mp3 metadata reading performance problem. Next track

switching should be more reliable.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6691 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2005-06-12 15:14:20 +00:00
parent 7cdae1ac65
commit 097444d07c
3 changed files with 15 additions and 3 deletions

View file

@ -666,7 +666,7 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
mp3info(&tracks[track_widx].id3, trackname, v1first); mp3info(&tracks[track_widx].id3, trackname, v1first);
lseek(fd, 0, SEEK_SET); lseek(fd, 0, SEEK_SET);
/* This is too slow to execute on some files. */ /* This is too slow to execute on some files. */
// get_mp3file_info(fd, &tracks[track_widx].mp3data); get_mp3file_info(fd, &tracks[track_widx].mp3data);
if (offset) { if (offset) {
lseek(fd, offset, SEEK_SET); lseek(fd, offset, SEEK_SET);
tracks[track_widx].id3.offset = offset; tracks[track_widx].id3.offset = offset;
@ -1272,7 +1272,7 @@ void codec_thread(void)
case CODEC_LOAD: case CODEC_LOAD:
if (status != PLUGIN_OK) { if (status != PLUGIN_OK) {
logf("Codec failure"); logf("Codec failure");
playing = false; // playing = false;
} else { } else {
logf("Codec finished"); logf("Codec finished");
} }

View file

@ -37,6 +37,11 @@
#include "file.h" #include "file.h"
#include "buffer.h" #include "buffer.h"
#if defined(IRIVER_H100) && !defined(SIMULATOR)
#include "pcm_playback.h"
#include "kernel.h"
#endif
#define DEBUG_VERBOSE #define DEBUG_VERBOSE
#define BYTES2INT(b1,b2,b3,b4) (((long)(b1 & 0xFF) << (3*8)) | \ #define BYTES2INT(b1,b2,b3,b4) (((long)(b1 & 0xFF) << (3*8)) | \
@ -259,6 +264,13 @@ static unsigned long __find_next_frame(int fd, long *offset, long max_offset,
static int fileread(int fd, unsigned char *c) static int fileread(int fd, unsigned char *c)
{ {
#if defined(IRIVER_H100) && !defined(SIMULATOR)
/* We don't want to eat all cpu power. Maybe better way to do this
should be implemented. */
while (pcm_is_lowdata())
yield();
#endif
return read(fd, c, 1); return read(fd, c, 1);
} }

View file

@ -44,7 +44,7 @@
/* Must be a power of 2 */ /* Must be a power of 2 */
#define NUM_PCM_BUFFERS (PCMBUF_SIZE / CHUNK_SIZE) #define NUM_PCM_BUFFERS (PCMBUF_SIZE / CHUNK_SIZE)
#define NUM_PCM_BUFFERS_MASK (NUM_PCM_BUFFERS - 1) #define NUM_PCM_BUFFERS_MASK (NUM_PCM_BUFFERS - 1)
#define PCM_WATERMARK (CHUNK_SIZE * 3) #define PCM_WATERMARK (CHUNK_SIZE * 6)
static bool pcm_playing; static bool pcm_playing;
static bool pcm_paused; static bool pcm_paused;