4 <title>vorbisfile - chaining_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.3.2 -
20101101</p></td>
16 <h1>chaining_example.c
</h1>
19 The example program source:
22 <table border=
0 width=
100% color=black cellspacing=
0 cellpadding=
7>
27 <font color=
"#A020F0">#include
<vorbis/codec.h
></font>
28 <font color=
"#A020F0">#include
<vorbis/vorbisfile.h
></font>
30 <strong><font color=
"#4169E1"><a name=
"main"></a>int main()
</font></strong>{
34 <font color=
"#A020F0">#ifdef _WIN32
</font> <font color=
"#B22222">/* We need to set stdin to binary mode on windows. */
</font>
35 _setmode( _fileno( stdin ), _O_BINARY );
36 <font color=
"#A020F0">#endif
</font>
38 <font color=
"#B22222">/* open the file/pipe on stdin */
</font>
39 <font color=
"#4169E1">if
</font>(ov_open_callbacks(stdin,
&ov,NULL,-
1,OV_CALLBACKS_NOCLOSE)
<0){
40 printf(
<font color=
"#666666">"Could not open input as an OggVorbis file.\n\n"</font>);
44 <font color=
"#B22222">/* print details about each logical bitstream in the input */
</font>
45 <font color=
"#4169E1">if
</font>(ov_seekable(
&ov)){
46 printf(
<font color=
"#666666">"Input bitstream contained %ld logical bitstream section(s).\n"</font>,
48 printf(
<font color=
"#666666">"Total bitstream playing time: %ld seconds\n\n"</font>,
49 (long)ov_time_total(
&ov,-
1));
51 }
<font color=
"#4169E1">else
</font>{
52 printf(
<font color=
"#666666">"Standard input was not seekable.\n"</font>
53 <font color=
"#666666">"First logical bitstream information:\n\n"</font>);
56 <font color=
"#4169E1">for
</font>(i=
0;i
<ov_streams(
&ov);i++){
57 vorbis_info *vi=ov_info(
&ov,i);
58 printf(
<font color=
"#666666">"\tlogical bitstream section %d information:\n"</font>,i+
1);
59 printf(
<font color=
"#666666">"\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n"</font>,
60 vi-
>rate,vi-
>channels,ov_bitrate(
&ov,i)/
1000,
61 ov_serialnumber(
&ov,i));
62 printf(
<font color=
"#666666">"\t\tcompressed length: %ld bytes "</font>,(long)(ov_raw_total(
&ov,i)));
63 printf(
<font color=
"#666666">" play time: %lds\n"</font>,(long)ov_time_total(
&ov,i));
67 <font color=
"#4169E1">return
</font> 0;
78 <table border=
0 width=
100%
>
80 <td><p class=tiny
>copyright
© 2000-
2010 Xiph.Org
</p></td>
81 <td align=right
><p class=tiny
><a href=
"http://www.xiph.org/ogg/vorbis/index.html">Ogg Vorbis
</a></p></td>
83 <td><p class=tiny
>Vorbisfile documentation
</p></td>
84 <td align=right
><p class=tiny
>vorbisfile version
1.3.2 -
20101101</p></td>