4 <title>vorbisfile - seeking_test.c
</title>
5 <link rel=stylesheet
href=
"style.css" type=
"text/css">
8 <body bgcolor=white text=black
link=
"#5555ff" alink=
"#5555ff" vlink=
"#5555ff">
9 <table border=
0 width=
100%
>
11 <td><p class=tiny
>Vorbisfile documentation
</p></td>
12 <td align=right
><p class=tiny
>vorbisfile version
1.3.2 -
20101101</p></td>
16 <h1>seeking_test.c
</h1>
19 The example program source:
22 <table border=
0 width=
100% color=black cellspacing=
0 cellpadding=
7>
27 #include
<stdlib.h
>
28 #include
<stdio.h
>
29 #include
"vorbis/codec.h"
30 #include
"vorbis/vorbisfile.h"
36 #ifdef _WIN32 /* We need to set stdin to binary mode under Windows */
37 _setmode( _fileno( stdin ), _O_BINARY );
40 /* open the file/pipe on stdin */
41 if(ov_open_callbacks(stdin,
&ov,NULL,-
1,OV_CALLBACKS_NOCLOSE)==-
1){
42 printf(
"Could not open input as an OggVorbis file.\n\n");
46 /* print details about each logical bitstream in the input */
47 if(ov_seekable(
&ov)){
48 double length=ov_time_total(
&ov,-
1);
49 printf(
"testing seeking to random places in %g seconds....\n",length);
50 for(i=
0;i
<100;i++){
51 double val=(double)rand()/RAND_MAX*length;
52 ov_time_seek(
&ov,val);
53 printf(
"\r\t%d [%gs]... ",i,val);
57 printf(
"\r \nOK.\n\n");
59 printf(
"Standard input was not seekable.\n");
74 <table border=
0 width=
100%
>
76 <td><p class=tiny
>copyright
© 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>
79 <td><p class=tiny
>Vorbisfile documentation
</p></td>
80 <td align=right
><p class=tiny
>vorbisfile version
1.3.2 -
20101101</p></td>