00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <stdlib.h>
00019 #include <vorbis/codec.h>
00020 #include <vorbis/vorbisfile.h>
00021
00022 #if defined(_WIN32) && !defined(__SYMBIAN32__)
00023 #include <io.h>
00024 #include <fcntl.h>
00025 #endif
00026
00027 int main(){
00028 OggVorbis_File ov;
00029 int i;
00030
00031 #if defined(_WIN32) && !defined(__SYMBIAN32__)
00032
00033
00034 _setmode( _fileno( stdin ), _O_BINARY );
00035 _setmode( _fileno( stdout ), _O_BINARY );
00036 #endif
00037
00038
00039 if(ov_open(stdin,&ov,NULL,-1)<0){
00040 printf("Could not open input as an OggVorbis file.\n\n");
00041 exit(1);
00042 }
00043
00044
00045 if(ov_seekable(&ov)){
00046 printf("Input bitstream contained %ld logical bitstream section(s).\n",
00047 ov_streams(&ov));
00048 printf("Total bitstream samples: %ld\n\n",
00049 (long)ov_pcm_total(&ov,-1));
00050 printf("Total bitstream playing time: %ld seconds\n\n",
00051 (long)ov_time_total(&ov,-1));
00052
00053 }else{
00054 printf("Standard input was not seekable.\n"
00055 "First logical bitstream information:\n\n");
00056 }
00057
00058 for(i=0;i<ov_streams(&ov);i++){
00059 vorbis_info *vi=ov_info(&ov,i);
00060 printf("\tlogical bitstream section %d information:\n",i+1);
00061 printf("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n",
00062 vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,
00063 ov_serialnumber(&ov,i));
00064 printf("\t\theader length: %ld bytes\n",(long)
00065 (ov.dataoffsets[i]-ov.offsets[i]));
00066 printf("\t\tcompressed length: %ld bytes\n",(long)(ov_raw_total(&ov,i)));
00067 printf("\t\tplay time: %lds\n",(long)ov_time_total(&ov,i));
00068 }
00069
00070 ov_clear(&ov);
00071 return 0;
00072 }
00073