Add Russian translation provided by Валерий Крувялис <valkru@mail.ru>
[xiph-mirror.git] / vorbis / doc / vorbisfile / seeking_example_c.html
blobeb10a98f0c0a8b0bbd1f38e8b57afda4fe333d4d
1 <html>
3 <head>
4 <title>vorbisfile - seeking_test.c</title>
5 <link rel=stylesheet href="style.css" type="text/css">
6 </head>
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.3.2 - 20101101</p></td>
13 </tr>
14 </table>
16 <h1>seeking_test.c</h1>
18 <p>
19 The example program source:
21 <br><br>
22 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
23 <tr bgcolor=#cccccc>
24 <td>
25 <pre><b>
27 #include &lt;stdlib.h&gt;
28 #include &lt;stdio.h&gt;
29 #include "vorbis/codec.h"
30 #include "vorbis/vorbisfile.h"
32 int main(){
33 OggVorbis_File ov;
34 int i;
36 #ifdef _WIN32 /* We need to set stdin to binary mode under Windows */
37 _setmode( _fileno( stdin ), _O_BINARY );
38 #endif
40 /* open the file/pipe on stdin */
41 if(ov_open_callbacks(stdin,&amp;ov,NULL,-1,OV_CALLBACKS_NOCLOSE)==-1){
42 printf("Could not open input as an OggVorbis file.\n\n");
43 exit(1);
46 /* print details about each logical bitstream in the input */
47 if(ov_seekable(&amp;ov)){
48 double length=ov_time_total(&amp;ov,-1);
49 printf("testing seeking to random places in %g seconds....\n",length);
50 for(i=0;i&lt;100;i++){
51 double val=(double)rand()/RAND_MAX*length;
52 ov_time_seek(&amp;ov,val);
53 printf("\r\t%d [%gs]... ",i,val);
54 fflush(stdout);
57 printf("\r \nOK.\n\n");
58 }else{
59 printf("Standard input was not seekable.\n");
62 ov_clear(&amp;ov);
63 return 0;
66 </b></pre>
67 </td>
68 </tr>
69 </table>
72 <br><br>
73 <hr noshade>
74 <table border=0 width=100%>
75 <tr valign=top>
76 <td><p class=tiny>copyright &copy; 2000-2010 Xiph.Org</p></td>
77 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a></p></td>
78 </tr><tr>
79 <td><p class=tiny>Vorbisfile documentation</p></td>
80 <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
81 </tr>
82 </table>
84 </body>
86 </html>