Documentation updates to reflect crosslap API extentions
[platform/upstream/libvorbis.git] / doc / vorbisfile / seeking_test_c.html
1 <html>
2
3 <head>
4 <title>vorbisfile - seeking_test.c</title>
5 <link rel=stylesheet href="style.css" type="text/css">
6 </head>
7
8 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
9 <table border=0 width=100%>
10 <tr>
11 <td><p class=tiny>Vorbisfile documentation</p></td>
12 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
13 </tr>
14 </table>
15
16 <h1>seeking_test.c</h1>
17
18 <p>
19 The example program source:
20
21 <br><br>
22 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
23 <tr bgcolor=#cccccc>
24         <td>
25 <pre><b>
26
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include "vorbis/codec.h"
30 #include "vorbis/vorbisfile.h"
31 #include "../lib/misc.h"
32
33 int main(){
34   OggVorbis_File ov;
35   int i;
36
37   /* open the file/pipe on stdin */
38   if(ov_open(stdin,&ov,NULL,-1)==-1){
39     printf("Could not open input as an OggVorbis file.\n\n");
40     exit(1);
41   }
42   
43   /* print details about each logical bitstream in the input */
44   if(ov_seekable(&ov)){
45     double length=ov_time_total(&ov,-1);
46     printf("testing seeking to random places in %g seconds....\n",length);
47     for(i=0;i<100;i++){
48       double val=(double)rand()/RAND_MAX*length;
49       ov_time_seek(&ov,val);
50       printf("\r\t%d [%gs]...     ",i,val);
51       fflush(stdout);
52     }
53     
54     printf("\r                                   \nOK.\n\n");
55   }else{
56     printf("Standard input was not seekable.\n");
57   }
58
59   ov_clear(&ov);
60   return 0;
61 }
62
63 </b></pre>
64         </td>
65 </tr>
66 </table>
67
68
69 <br><br>
70 <hr noshade>
71 <table border=0 width=100%>
72 <tr valign=top>
73 <td><p class=tiny>copyright &copy; 2003 Xiph.org</p></td>
74 <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>
75 </tr><tr>
76 <td><p class=tiny>Vorbisfile documentation</p></td>
77 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
78 </tr>
79 </table>
80
81 </body>
82
83 </html>