Merge branch_beta3 onto the mainline.
[platform/upstream/libvorbis.git] / doc / vorbisfile / chaining_example_c.html
1 <html>
2
3 <head>
4 <title>vorbisfile - chaining_example.c</title>
5 <link rel=stylesheet href="style.css" type="text/css">
6 </head>
7
8 <body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff">
9 <table border=0 width=100%>
10 <tr>
11 <td><p class=tiny>vorbisfile documentation</p></td>
12 <td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
13 </tr>
14 </table>
15
16 <h1>chaining_example.c</h1>
17
18 <p>
19 The example program source:
20
21 <br><br>
22 <table border=0 width=100% color=black cellspacing=0 cellpadding=7>
23 <tr bgcolor=#cccccc>
24         <td>
25 <pre><b>
26
27 #include <vorbis/codec.h>\r
28 #include <vorbis/vorbisfile.h>\r
29 \r
30 int main(){\r
31   OggVorbis_File ov;\r
32   int i;\r
33 \r
34   /* open the file/pipe on stdin */\r
35   if(ov_open(stdin,&ov,NULL,-1)<0){\r
36     printf("Could not open input as an OggVorbis file.\n\n");\r
37     exit(1);\r
38   }\r
39   \r
40   /* print details about each logical bitstream in the input */\r
41   if(ov_seekable(&ov)){\r
42     printf("Input bitstream contained %ld logical bitstream section(s).\n",\r
43            ov_streams(&ov));\r
44     printf("Total bitstream playing time: %ld seconds\n\n",\r
45            (long)ov_time_total(&ov,-1));\r
46 \r
47   }else{\r
48     printf("Standard input was not seekable.\n"\r
49            "First logical bitstream information:\n\n");\r
50   }\r
51 \r
52   for(i=0;i<ov_streams(&ov);i++){\r
53     vorbis_info *vi=ov_info(&ov,i);\r
54     printf("\tlogical bitstream section %d information:\n",i+1);\r
55     printf("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n",\r
56            vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,\r
57            ov_serialnumber(&ov,i));\r
58     printf("\t\tcompressed length: %ld bytes ",(long)(ov_raw_total(&ov,i)));\r
59     printf(" play time: %lds\n",(long)ov_time_total(&ov,i));\r
60   }\r
61 \r
62   ov_clear(&ov);\r
63   return 0;\r
64 }\r
65
66 </b></pre>
67         </td>
68 </tr>
69 </table>
70
71
72 <br><br>
73 <hr noshade>
74 <table border=0 width=100%>
75 <tr valign=top>
76 <td><p class=tiny>copyright &copy; 2000 vorbis team</p></td>
77 <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>
78 </tr><tr>
79 <td><p class=tiny>vorbisfile documentation</p></td>
80 <td align=right><p class=tiny>vorbisfile version 1.25 - 20000615</p></td>
81 </tr>
82 </table>
83
84 </body>
85
86 </html>