annotate src/libvorbis-1.3.3/doc/vorbisfile/vorbisfile_example_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 - vorbisfile_example.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>vorbisfile_example.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 #include &lt;stdio.h&gt;
cannam@86 27 #include &lt;stdlib.h&gt;
cannam@86 28 #include &lt;math.h&gt;
cannam@86 29 #include "vorbis/codec.h"
cannam@86 30 #include "vorbis/vorbisfile.h"
cannam@86 31
cannam@86 32 #ifdef _WIN32
cannam@86 33 #include &lt;io.h&gt;
cannam@86 34 #include &lt;fcntl.h&gt;
cannam@86 35 #endif
cannam@86 36
cannam@86 37 char pcmout[4096];
cannam@86 38
cannam@86 39 int main(int argc, char **argv){
cannam@86 40 OggVorbis_File vf;
cannam@86 41 int eof=0;
cannam@86 42 int current_section;
cannam@86 43
cannam@86 44 #ifdef _WIN32
cannam@86 45 _setmode( _fileno( stdin ), _O_BINARY );
cannam@86 46 _setmode( _fileno( stdout ), _O_BINARY );
cannam@86 47 #endif
cannam@86 48
cannam@86 49 if(ov_open_callbacks(stdin, &vf, NULL, 0, OV_CALLBACKS_NOCLOSE) < 0) {
cannam@86 50 fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
cannam@86 51 exit(1);
cannam@86 52 }
cannam@86 53
cannam@86 54 {
cannam@86 55 char **ptr=ov_comment(&vf,-1)->user_comments;
cannam@86 56 vorbis_info *vi=ov_info(&vf,-1);
cannam@86 57 while(*ptr){
cannam@86 58 fprintf(stderr,"%s\n",*ptr);
cannam@86 59 ++ptr;
cannam@86 60 }
cannam@86 61 fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
cannam@86 62 fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
cannam@86 63 }
cannam@86 64
cannam@86 65 while(!eof){
cannam@86 66 long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,&current_section);
cannam@86 67 if (ret == 0) {
cannam@86 68 /* EOF */
cannam@86 69 eof=1;
cannam@86 70 } else if (ret < 0) {
cannam@86 71 /* error in the stream. Not a problem, just reporting it in
cannam@86 72 case we (the app) cares. In this case, we don't. */
cannam@86 73 } else {
cannam@86 74 /* we don't bother dealing with sample rate changes, etc, but
cannam@86 75 you'll have to */
cannam@86 76 fwrite(pcmout,1,ret,stdout);
cannam@86 77 }
cannam@86 78 }
cannam@86 79
cannam@86 80 ov_clear(&vf);
cannam@86 81
cannam@86 82 fprintf(stderr,"Done.\n");
cannam@86 83 return(0);
cannam@86 84 }
cannam@86 85
cannam@86 86 </b></pre>
cannam@86 87 </td>
cannam@86 88 </tr>
cannam@86 89 </table>
cannam@86 90
cannam@86 91
cannam@86 92 <br><br>
cannam@86 93 <hr noshade>
cannam@86 94 <table border=0 width=100%>
cannam@86 95 <tr valign=top>
cannam@86 96 <td><p class=tiny>copyright &copy; 2000-2010 Xiph.Org</p></td>
cannam@86 97 <td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis</a></p></td>
cannam@86 98 </tr><tr>
cannam@86 99 <td><p class=tiny>Vorbisfile documentation</p></td>
cannam@86 100 <td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td>
cannam@86 101 </tr>
cannam@86 102 </table>
cannam@86 103
cannam@86 104 </body>
cannam@86 105
cannam@86 106 </html>