diff options
| author | Monty <xiphmont@xiph.org> | 1999-11-02 23:29:52 +0000 |
|---|---|---|
| committer | Monty <xiphmont@xiph.org> | 1999-11-02 23:29:52 +0000 |
| commit | 8e60b86f874da984edb5fd3d2e7b40ecff8f38e4 (patch) | |
| tree | 1cd939feb823829727cd1c518d05e15e13a2754b /lib | |
| parent | d73fb7fff6e70a0304b2eb3f61516a7fa1d75ffe (diff) | |
| download | libvorbis-git-8e60b86f874da984edb5fd3d2e7b40ecff8f38e4.tar.gz | |
Rearranged the chaining example a bit.
Monty
svn path=/trunk/vorbis/; revision=159
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/chaining_example.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/lib/chaining_example.c b/lib/chaining_example.c new file mode 100644 index 00000000..f686f914 --- /dev/null +++ b/lib/chaining_example.c @@ -0,0 +1,71 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * + * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. * + * PLEASE READ THESE TERMS DISTRIBUTING. * + * * + * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-1999 * + * by 1999 Monty <monty@xiph.org> and The XIPHOPHORUS Company * + * http://www.xiph.org/ * + * * + ******************************************************************** + + function: illustrate simple use of chained bitstream and vorbisfile.a + author: Monty <xiphmont@mit.edu> + modifications by: Monty + last modification date: Nov 02 1999 + + ********************************************************************/ + +#include "codec.h" +#include "vorbisfile.h" + +int main(){ + OggVorbis_File ov; + int i; + + /* open the file/pipe on stdin */ + if(ov_open(stdin,&ov,NULL,-1)==-1){ + printf("Could not open input as an OggVorbis file.\n\n"); + exit(1); + } + + /* print details about each logical bitstream in the input */ + if(ov.seekable){ + printf("Input bitstream contained %d logical bitstream section(s).\n", + ov.links); + printf("Total bitstream playing time: %ld seconds\n\n", + (long)ov_totaltime(&ov)); + + }else{ + printf("Standard input was not seekable.\n" + "First logical bitstream information:\n\n"); + } + + for(i=0;i<ov.links;i++){ + printf("\tlogical bitstream section %d information:\n",i+1); + printf("\t\t%ldHz %d channels serial number=%ld\n", + ov.vi[i].rate,ov.vi[i].channels,ov.serialnos[i]); + printf("\t\tcompressed length: %ldbytes ",(ov.offsets? + ov.offsets[i+1]-ov.offsets[i]: + -1)); + printf(" play time: %lds\n",(long)ov_lbtime(&ov,i)); + } + + ov_clear(&ov); + return 0; +} + + + + + + + + + + + + + |
