summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-02-06 21:19:05 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-02-06 21:19:05 +0000
commitfeb7f91e286f824a92f85b22ce4461cc3d84c635 (patch)
treed2e9d61023b84b0c127d710ab29f4178ea033e86 /apps
parentbcb4d823b76a84a94eca4e1eb559f5246aeaa06b (diff)
downloadrockbox-feb7f91e286f824a92f85b22ce4461cc3d84c635.tar.gz
rockbox-feb7f91e286f824a92f85b22ce4461cc3d84c635.tar.bz2
rockbox-feb7f91e286f824a92f85b22ce4461cc3d84c635.zip
spinup the disk more early, and a recovery for underruns: seek to the last position.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4300 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/video.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/apps/plugins/video.c b/apps/plugins/video.c
index 3f21f7c9dd..eab4da5c70 100644
--- a/apps/plugins/video.c
+++ b/apps/plugins/video.c
@@ -46,7 +46,7 @@
// trigger levels, we need about 80 kB/sec
#define PRECHARGE (1024 * 64) // the initial filling before starting to play
-#define SPINUP 2500 // 2200 // from what level on to refill, in milliseconds
+#define SPINUP 3300 // from what level on to refill, in milliseconds
#define CHUNK (1024*32) // read size
@@ -537,6 +537,8 @@ int PlayTick(int fd)
int retval = 1;
int filepos;
+ // check buffer level
+
if (gPlay.bHasAudio)
avail_audio = Available(gBuf.pReadAudio);
if (gPlay.bHasVideo)
@@ -549,7 +551,8 @@ int PlayTick(int fd)
}
if ((!gPlay.bHasAudio || gPlay.bAudioUnderrun)
- && (!gPlay.bHasVideo || gPlay.bVideoUnderrun))
+ && (!gPlay.bHasVideo || gPlay.bVideoUnderrun)
+ && gBuf.bEOF)
return 0; // all expired
if (!gPlay.bRefilling || gBuf.bEOF)
@@ -594,6 +597,8 @@ int PlayTick(int fd)
button = rb->button_get(false);
}
+ // check keypresses
+
if (button != BUTTON_NONE)
{
filepos = rb->lseek(fd, 0, SEEK_CUR);
@@ -678,6 +683,9 @@ int PlayTick(int fd)
}
} /* if (button != BUTTON_NONE) */
+
+ // handle seeking
+
if (gPlay.bSeeking) // seeking?
{
if (gPlay.nSeekAcc < -MAX_ACC)
@@ -696,6 +704,27 @@ int PlayTick(int fd)
DrawPosition(gPlay.nSeekPos, rb->filesize(fd));
}
+
+ // check + recover underruns
+
+ if ((gPlay.bAudioUnderrun || gPlay.bVideoUnderrun) && !gBuf.bEOF)
+ {
+ filepos = rb->lseek(fd, 0, SEEK_CUR);
+
+ if (gPlay.bHasVideo && gPlay.bVideoUnderrun)
+ {
+ gStats.nVideoUnderruns++;
+ filepos -= Available(gBuf.pReadVideo); // take video position
+ SeekTo(fd, filepos);
+ }
+ else if (gPlay.bHasAudio && gPlay.bAudioUnderrun)
+ {
+ gStats.nAudioUnderruns++;
+ filepos -= Available(gBuf.pReadAudio); // else audio
+ SeekTo(fd, filepos);
+ }
+ }
+
return retval;
}
@@ -831,21 +860,21 @@ int main(char* filename)
// display statistics
rb->lcd_clear_display();
- rb->snprintf(gPrint, sizeof(gPrint), "AudioUnderrun: %d", gPlay.bAudioUnderrun);
+ rb->snprintf(gPrint, sizeof(gPrint), "%d Audio Underruns", gStats.nAudioUnderruns);
rb->lcd_puts(0, 0, gPrint);
- rb->snprintf(gPrint, sizeof(gPrint), "VideoUnderrun: %d", gPlay.bVideoUnderrun);
+ rb->snprintf(gPrint, sizeof(gPrint), "%d Video Underruns", gStats.nVideoUnderruns);
rb->lcd_puts(0, 1, gPrint);
- rb->snprintf(gPrint, sizeof(gPrint), "MinAudio: %d bytes", gStats.minAudioAvail);
+ rb->snprintf(gPrint, sizeof(gPrint), "%d MinAudio bytes", gStats.minAudioAvail);
rb->lcd_puts(0, 2, gPrint);
- rb->snprintf(gPrint, sizeof(gPrint), "MinVideo: %d bytes", gStats.minVideoAvail);
+ rb->snprintf(gPrint, sizeof(gPrint), "%d MinVideo bytes", gStats.minVideoAvail);
rb->lcd_puts(0, 3, gPrint);
rb->snprintf(gPrint, sizeof(gPrint), "ReadChunk: %d", gBuf.nReadChunk);
rb->lcd_puts(0, 4, gPrint);
rb->snprintf(gPrint, sizeof(gPrint), "SeekChunk: %d", gBuf.nSeekChunk);
rb->lcd_puts(0, 5, gPrint);
- rb->snprintf(gPrint, sizeof(gPrint), "1st Video: %d", gFileHdr.video_1st_frame);
+ rb->snprintf(gPrint, sizeof(gPrint), "LowWater: %d", gBuf.low_water);
rb->lcd_puts(0, 6, gPrint);
- rb->snprintf(gPrint, sizeof(gPrint), "pBufStart: %x", gBuf.pBufStart);
+ rb->snprintf(gPrint, sizeof(gPrint), "HighWater: %d", gBuf.high_water);
rb->lcd_puts(0, 7, gPrint);
rb->lcd_update();