00001 <html>
00002
00003 <head>
00004 <title>vorbisfile - seeking_test.c</title>
00005 <link rel=stylesheet href="style.css" type="text/css">
00006 </head>
00007
00008 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
00009 <table border=0 width=100%>
00010 <tr>
00011 <td><p class=tiny>Vorbisfile documentation</p></td>
00012 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
00013 </tr>
00014 </table>
00015
00016 <h1>seeking_test.c</h1>
00017
00018 <p>
00019 The example program source:
00020
00021 <br><br>
00022 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
00023 <tr bgcolor=#cccccc>
00024 <td>
00025 <pre><b>
00026
00027 #include <stdlib.h>
00028 #include <stdio.h>
00029 #include "vorbis/codec.h"
00030 #include "vorbis/vorbisfile.h"
00031 #include "../lib/misc.h"
00032
00033 int main(){
00034 OggVorbis_File ov;
00035 int i;
00036
00037
00038 if(ov_open(stdin,&ov,NULL,-1)==-1){
00039 printf("Could not open input as an OggVorbis file.\n\n");
00040 exit(1);
00041 }
00042
00043
00044 if(ov_seekable(&ov)){
00045 double length=ov_time_total(&ov,-1);
00046 printf("testing seeking to random places in %g seconds....\n",length);
00047 for(i=0;i<100;i++){
00048 double val=(double)rand()/RAND_MAX*length;
00049 ov_time_seek(&ov,val);
00050 printf("\r\t%d [%gs]... ",i,val);
00051 fflush(stdout);
00052 }
00053
00054 printf("\r \nOK.\n\n");
00055 }else{
00056 printf("Standard input was not seekable.\n");
00057 }
00058
00059 ov_clear(&ov);
00060 return 0;
00061 }
00062
00063 </b></pre>
00064 </td>
00065 </tr>
00066 </table>
00067
00068
00069 <br><br>
00070 <hr noshade>
00071 <table border=0 width=100%>
00072 <tr valign=top>
00073 <td><p class=tiny>copyright © 2003 Xiph.org</p></td>
00074 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a><br><a href="mailto:team@vorbis.org">team@vorbis.org</a></p></td>
00075 </tr><tr>
00076 <td><p class=tiny>Vorbisfile documentation</p></td>
00077 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
00078 </tr>
00079 </table>
00080
00081 </body>
00082
00083 </html>