Chris@1:
Chris@1:
Chris@1:
Chris@1: #include <vorbis/codec.h>
Chris@1: #include <vorbis/vorbisfile.h>
Chris@1:
Chris@1: int main(){
Chris@1: OggVorbis_File ov;
Chris@1: int i;
Chris@1:
Chris@1: #ifdef _WIN32 /* We need to set stdin to binary mode on windows. */
Chris@1: _setmode( _fileno( stdin ), _O_BINARY );
Chris@1: #endif
Chris@1:
Chris@1: /* open the file/pipe on stdin */
Chris@1: if(ov_open_callbacks(stdin,&ov,NULL,-1,OV_CALLBACKS_NOCLOSE)<0){
Chris@1: printf("Could not open input as an OggVorbis file.\n\n");
Chris@1: exit(1);
Chris@1: }
Chris@1:
Chris@1: /* print details about each logical bitstream in the input */
Chris@1: if(ov_seekable(&ov)){
Chris@1: printf("Input bitstream contained %ld logical bitstream section(s).\n",
Chris@1: ov_streams(&ov));
Chris@1: printf("Total bitstream playing time: %ld seconds\n\n",
Chris@1: (long)ov_time_total(&ov,-1));
Chris@1:
Chris@1: }else{
Chris@1: printf("Standard input was not seekable.\n"
Chris@1: "First logical bitstream information:\n\n");
Chris@1: }
Chris@1:
Chris@1: for(i=0;i<ov_streams(&ov);i++){
Chris@1: vorbis_info *vi=ov_info(&ov,i);
Chris@1: printf("\tlogical bitstream section %d information:\n",i+1);
Chris@1: printf("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n",
Chris@1: vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,
Chris@1: ov_serialnumber(&ov,i));
Chris@1: printf("\t\tcompressed length: %ld bytes ",(long)(ov_raw_total(&ov,i)));
Chris@1: printf(" play time: %lds\n",(long)ov_time_total(&ov,i));
Chris@1: }
Chris@1:
Chris@1: ov_clear(&ov);
Chris@1: return 0;
Chris@1: }
Chris@1:
Chris@1:
Chris@1: |
Chris@1:
Chris@1: