001/* JOrbis
002 * Copyright (C) 2000 ymnk, JCraft,Inc.
003 *  
004 * Written by: 2000 ymnk<ymnk@jcaft.com>
005 *   
006 * Many thanks to 
007 *   Monty <monty@xiph.org> and 
008 *   The XIPHOPHORUS Company http://www.xiph.org/ .
009 * JOrbis has been based on their awesome works, Vorbis codec.
010 *   
011 * This program is free software; you can redistribute it and/or
012 * modify it under the terms of the GNU Library General Public License
013 * as published by the Free Software Foundation; either version 2 of
014 * the License, or (at your option) any later version.
015   
016 * This program is distributed in the hope that it will be useful,
017 * but WITHOUT ANY WARRANTY; without even the implied warranty of
018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
019 * GNU Library General Public License for more details.
020 * 
021 * You should have received a copy of the GNU Library General Public
022 * License along with this program; if not, write to the Free Software
023 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
024 */
025
026package com.jcraft.jorbis;
027
028class ChainingExample{
029  public static void main(String[] arg){
030    VorbisFile ov=null;
031
032    try{
033      ov=new VorbisFile(System.in, null, -1);
034    }
035    catch(Exception e){
036      System.err.println(e);
037      return;
038    }
039
040    if(ov.seekable()){
041      System.out.println("Input bitstream contained "+ov.streams()+" logical bitstream section(s).");
042      System.out.println("Total bitstream playing time: "+ov.time_total(-1)+" seconds\n");
043    }
044    else{
045      System.out.println("Standard input was not seekable.");
046      System.out.println("First logical bitstream information:\n");
047    }
048
049    for(int i=0;i<ov.streams();i++){
050      Info vi=ov.getInfo(i);
051      System.out.println("\tlogical bitstream section "+(i+1)+" information:");
052      System.out.println("\t\t"+vi.rate+"Hz "+vi.channels+" channels bitrate "+
053                         (ov.bitrate(i)/1000)+"kbps serial number="+ov.serialnumber(i));
054      System.out.print("\t\tcompressed length: "+ov.raw_total(i)+" bytes ");
055      System.out.println(" play time: "+ov.time_total(i)+"s");
056      Comment vc=ov.getComment(i);
057      System.out.println(vc);
058    }
059    //clear(&ov);
060  }
061}