4 <title>vorbisfile - vorbisfile_example.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.68 - 20030307</p></td>
16 <h1>vorbisfile_example.c</h1>
19 The example program source:
22 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <math.h>
29 #include "vorbis/codec.h"
30 #include "vorbis/vorbisfile.h"
34 #include <fcntl.h>
39 int main(int argc, char **argv){
45 _setmode( _fileno( stdin ), _O_BINARY );
46 _setmode( _fileno( stdout ), _O_BINARY );
49 if(ov_open(stdin, &vf, NULL, 0) < 0) {
50 fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
55 char **ptr=ov_comment(&vf,-1)->user_comments;
56 vorbis_info *vi=ov_info(&vf,-1);
58 fprintf(stderr,"%s\n",*ptr);
61 fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
62 fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
66 long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,¤t_section);
71 /* error in the stream. Not a problem, just reporting it in
72 case we (the app) cares. In this case, we don't. */
74 /* we don't bother dealing with sample rate changes, etc, but
76 fwrite(pcmout,1,ret,stdout);
82 fprintf(stderr,"Done.\n");
94 <table border=0 width=100%>
96 <td><p class=tiny>copyright © 2003 Xiph.org</p></td>
97 <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>
99 <td><p class=tiny>Vorbisfile documentation</p></td>
100 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>