00001 <html>
00002
00003 <head>
00004 <title>vorbisfile - chaining_example.c</title>
00005 <link rel=stylesheet href="style.css" type="text/css">
00006 </head>
00007
00008 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
00009 <table border=0 width=100%>
00010 <tr>
00011 <td><p class=tiny>Vorbisfile documentation</p></td>
00012 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
00013 </tr>
00014 </table>
00015
00016 <h1>chaining_example.c</h1>
00017
00018 <p>
00019 The example program source:
00020
00021 <br><br>
00022 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
00023 <tr bgcolor=#cccccc>
00024 <td>
00025 <pre width="80"><b>
00026
00027 <font color="#A020F0">#include <vorbis/codec.h></font>
00028 <font color="#A020F0">#include <vorbis/vorbisfile.h></font>
00029
00030 <strong><font color="#4169E1"><a name="main"></a>int main()</font></strong>{
00031 OggVorbis_File ov;
00032 int i;
00033
00034 <font color="#B22222"></font>
00035 <font color="#4169E1">if</font>(ov_open(stdin,&ov,NULL,-1)<0){
00036 printf(<font color="#666666">"Could not open input as an OggVorbis file.\n\n"</font>);
00037 exit(1);
00038 }
00039
00040 <font color="#B22222"></font>
00041 <font color="#4169E1">if</font>(ov_seekable(&ov)){
00042 printf(<font color="#666666">"Input bitstream contained %ld logical bitstream section(s).\n"</font>,
00043 ov_streams(&ov));
00044 printf(<font color="#666666">"Total bitstream playing time: %ld seconds\n\n"</font>,
00045 (long)ov_time_total(&ov,-1));
00046
00047 }<font color="#4169E1">else</font>{
00048 printf(<font color="#666666">"Standard input was not seekable.\n"</font>
00049 <font color="#666666">"First logical bitstream information:\n\n"</font>);
00050 }
00051
00052 <font color="#4169E1">for</font>(i=0;i<ov_streams(&ov);i++){
00053 vorbis_info *vi=ov_info(&ov,i);
00054 printf(<font color="#666666">"\tlogical bitstream section %d information:\n"</font>,i+1);
00055 printf(<font color="#666666">"\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n"</font>,
00056 vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,
00057 ov_serialnumber(&ov,i));
00058 printf(<font color="#666666">"\t\tcompressed length: %ld bytes "</font>,(long)(ov_raw_total(&ov,i)));
00059 printf(<font color="#666666">" play time: %lds\n"</font>,(long)ov_time_total(&ov,i));
00060 }
00061
00062 ov_clear(&ov);
00063 <font color="#4169E1">return</font> 0;
00064 }
00065
00066 </b></pre>
00067 </td>
00068 </tr>
00069 </table>
00070
00071
00072 <br><br>
00073 <hr noshade>
00074 <table border=0 width=100%>
00075 <tr valign=top>
00076 <td><p class=tiny>copyright © 2004 Xiph.org</p></td>
00077 <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>
00078 </tr><tr>
00079 <td><p class=tiny>Vorbisfile documentation</p></td>
00080 <td align=right><p class=tiny>vorbisfile version 1.68 - 20030307</p></td>
00081 </tr>
00082 </table>
00083
00084 </body>
00085
00086 </html>