annotate src/libvorbis-1.3.3/doc/vorbisfile/seeking_test_c.html @ 148:b4bfdf10c4b3

Update Win64 capnp builds to v0.6
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 22 May 2017 18:56:49 +0100
parents 98c1576536ae
children
rev   line source
cannam@86 1 <html>
cannam@86 2
cannam@86 3 <head>
cannam@86 4 <title>vorbisfile - seeking_test.c</title>
cannam@86 5 <link rel=stylesheet href="style.css" type="text/css">
cannam@86 6 </head>
cannam@86 7
cannam@86 8 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
cannam@86 9 <table border=0 width=100%>
cannam@86 10 <tr>
cannam@86 11 <td><p class=tiny>Vorbisfile documentation</p></td>
cannam@86 12 <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
cannam@86 13 </tr>
cannam@86 14 </table>
cannam@86 15
cannam@86 16 <h1>seeking_test.c</h1>
cannam@86 17
cannam@86 18 <p>
cannam@86 19 The example program source:
cannam@86 20
cannam@86 21 <br><br>
cannam@86 22 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
cannam@86 23 <tr bgcolor=#cccccc>
cannam@86 24 <td>
cannam@86 25 <pre><b>
cannam@86 26
cannam@86 27 #include <stdlib.h>
cannam@86 28 #include <stdio.h>
cannam@86 29 #include "vorbis/codec.h"
cannam@86 30 #include "vorbis/vorbisfile.h"
cannam@86 31
cannam@86 32 int main(){
cannam@86 33 OggVorbis_File ov;
cannam@86 34 int i;
cannam@86 35
cannam@86 36 #ifdef _WIN32 /* We need to set stdin to binary mode under Windows */
cannam@86 37 _setmode( _fileno( stdin ), _O_BINARY );
cannam@86 38 #endif
cannam@86 39
cannam@86 40 /* open the file/pipe on stdin */
cannam@86 41 if(ov_open_callbacks(stdin,&ov,NULL,-1,OV_CALLBACKS_NOCLOSE)==-1){
cannam@86 42 printf("Could not open input as an OggVorbis file.\n\n");
cannam@86 43 exit(1);
cannam@86 44 }
cannam@86 45
cannam@86 46 /* print details about each logical bitstream in the input */
cannam@86 47 if(ov_seekable(&ov)){
cannam@86 48 double length=ov_time_total(&ov,-1);
cannam@86 49 printf("testing seeking to random places in %g seconds....\n",length);
cannam@86 50 for(i=0;i<100;i++){
cannam@86 51 double val=(double)rand()/RAND_MAX*length;
cannam@86 52 ov_time_seek(&ov,val);
cannam@86 53 printf("\r\t%d [%gs]... ",i,val);
cannam@86 54 fflush(stdout);
cannam@86 55 }
cannam@86 56
cannam@86 57 printf("\r \nOK.\n\n");
cannam@86 58 }else{
cannam@86 59 printf("Standard input was not seekable.\n");
cannam@86 60 }
cannam@86 61
cannam@86 62 ov_clear(&ov);
cannam@86 63 return 0;
cannam@86 64 }
cannam@86 65
cannam@86 66 </b></pre>
cannam@86 67 </td>
cannam@86 68 </tr>
cannam@86 69 </table>
cannam@86 70
cannam@86 71
cannam@86 72 <br><br>
cannam@86 73 <hr noshade>
cannam@86 74 <table border=0 width=100%>
cannam@86 75 <tr valign=top>
cannam@86 76 <td><p class=tiny>copyright &copy; 2000-2010 Xiph.Org</p></td>
cannam@86 77 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a></p></td>
cannam@86 78 </tr><tr>
cannam@86 79 <td><p class=tiny>Vorbisfile documentation</p></td>
cannam@86 80 <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
cannam@86 81 </tr>
cannam@86 82 </table>
cannam@86 83
cannam@86 84 </body>
cannam@86 85
cannam@86 86 </html>