chaining_example_c.html 2.1 KB

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