- ogg_int64_t val=(double)rand()/RAND_MAX*pcmlength;
- ogg_int64_t pos;
- printf("\r\t%d [pcm position %ld]... ",i,(long)val);
- fflush(stdout);
- ret=ov_pcm_seek_page(&ov,val);
- if(ret<0){
- printf("seek failed: %d\n",ret);
- exit(1);
- }
-
- _verify(&ov,pos,-1,val,pcmlength,bigassbuffer);
+ 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,"seek failed: %d\n",ret);
+ exit(1);
+ }
+
+ _verify(&ov,-1,val,-1.,pcmlength,bigassbuffer);
+
+ }
+ }
+
+ fprintf(stderr,"\r");
+ {
+ fprintf(stderr,"testing pcm exact seeking to random places in %f seconds....\n",
+ timelength);
+ for(i=0;i<1000;i++){
+ 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){
+ fprintf(stderr,"seek failed: %d\n",ret);
+ exit(1);
+ }
+ if(ov_pcm_tell(&ov)!=((val>>hs)<<hs)){
+ fprintf(stderr,"Declared position didn't perfectly match request: %ld != %ld\n",
+ (long)val,(long)ov_pcm_tell(&ov));
+ exit(1);
+ }
+
+ _verify(&ov,-1,val,-1.,pcmlength,bigassbuffer);