VirtualBox

source: vbox/trunk/src/libs/libvorbis-1.3.7/doc/vorbisfile/vorbisfile_example_c.html

最後變更 在這個檔案是 96468,由 vboxsync 提交於 3 年 前

libs/libvorbis-1.3.7: Re-exporting, hopefully this time everything is there. bugref:10275

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette