********************************************************************
function: illustrate seeking, and test it too
- last mod: $Id$
********************************************************************/
bread=ov_read(ov,buffer,4096,1,1,1,&dummy);
for(j=0;j<bread;j++){
if(buffer[j]!=bigassbuffer[j+((pos>>hs)*2)]){
- fprintf(stderr,"data after seek doesn't match declared pcm position %lld\n",pos);
+ fprintf(stderr,"data after seek doesn't match declared pcm position %ld\n",(long)pos);
for(i=0;i<(pcmlength>>hs)*2-bread;i++){
for(j=0;j<bread;j++)
if(buffer[j] != bigassbuffer[i+j])break;
if(j==bread){
- fprintf(stderr,"data after seek appears to match position %lld\n",(i/2)<<hs);
+ fprintf(stderr,"data after seek appears to match position %ld\n",(long)((i/2)<<hs));
}
}
{
exit(1);
}
}
-
+
/* because we want to do sample-level verification that the seek
does what it claimed, decode the entire file into memory */
pcmlength=ov_pcm_total(&ov,-1);
fprintf(stderr,"\rloading.... [%ld left] ",
(long)((pcmlength>>hs)*2-i));
}
-
+
{
ogg_int64_t length=ov.end;
fprintf(stderr,"\rtesting raw seeking to random places in %ld bytes....\n",
(long)length);
-
+
for(i=0;i<1000;i++){
ogg_int64_t val=(double)rand()/RAND_MAX*length;
fprintf(stderr,"\r\t%d [raw position %ld]... ",i,(long)val);
{
fprintf(stderr,"testing pcm page seeking to random places in %ld samples....\n",
(long)pcmlength);
-
+
for(i=0;i<1000;i++){
- ogg_int64_t val=(double)rand()/RAND_MAX*pcmlength;
+ ogg_int64_t val= i==0?(ogg_int64_t)0:(double)rand()/RAND_MAX*pcmlength;
fprintf(stderr,"\r\t%d [pcm position %ld]... ",i,(long)val);
ret=ov_pcm_seek_page(&ov,val);
if(ret<0){
fprintf(stderr,"\r");
{
- fprintf(stderr,"testing pcm exact seeking to random places in %ld samples....\n",
- (long)pcmlength);
-
+ fprintf(stderr,"testing pcm exact seeking to random places in %f seconds....\n",
+ timelength);
for(i=0;i<1000;i++){
- ogg_int64_t val=(double)rand()/RAND_MAX*pcmlength;
+ ogg_int64_t val= i==0?(ogg_int64_t)0:(double)rand()/RAND_MAX*pcmlength;
fprintf(stderr,"\r\t%d [pcm position %ld]... ",i,(long)val);
ret=ov_pcm_seek(&ov,val);
if(ret<0){