1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
5 * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH *
6 * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9 * by the XIPHOPHORUS Company http://www.xiph.org/ *
11 ********************************************************************
13 function: illustrate simple use of chained bitstream and vorbisfile.a
14 last mod: $Id: chaining_example.c,v 1.8 2001/02/02 03:51:53 xiphmont Exp $
16 ********************************************************************/
18 #include <vorbis/codec.h>
19 #include <vorbis/vorbisfile.h>
25 /* open the file/pipe on stdin */
26 if(ov_open(stdin,&ov,NULL,-1)<0){
27 printf("Could not open input as an OggVorbis file.\n\n");
31 /* print details about each logical bitstream in the input */
33 printf("Input bitstream contained %ld logical bitstream section(s).\n",
35 printf("Total bitstream playing time: %ld seconds\n\n",
36 (long)ov_time_total(&ov,-1));
39 printf("Standard input was not seekable.\n"
40 "First logical bitstream information:\n\n");
43 for(i=0;i<ov_streams(&ov);i++){
44 vorbis_info *vi=ov_info(&ov,i);
45 printf("\tlogical bitstream section %d information:\n",i+1);
46 printf("\t\t%ldHz %d channels bitrate %ldkbps serial number=%ld\n",
47 vi->rate,vi->channels,ov_bitrate(&ov,i)/1000,
48 ov_serialnumber(&ov,i));
49 printf("\t\tcompressed length: %ld bytes ",(long)(ov_raw_total(&ov,i)));
50 printf(" play time: %lds\n",(long)ov_time_total(&ov,i));