]>
Commit | Line | Data |
---|---|---|
964dd0bc JW |
1 | /* JOrbis |
2 | * Copyright (C) 2000 ymnk, JCraft,Inc. | |
3 | * | |
4 | * Written by: 2000 ymnk<ymnk@jcraft.com> | |
5 | * | |
6 | * Many thanks to | |
7 | * Monty <monty@xiph.org> and | |
8 | * The XIPHOPHORUS Company http://www.xiph.org/ . | |
9 | * JOrbis has been based on their awesome works, Vorbis codec. | |
10 | * | |
11 | * This program is free software; you can redistribute it and/or | |
12 | * modify it under the terms of the GNU Library General Public License | |
13 | * as published by the Free Software Foundation; either version 2 of | |
14 | * the License, or (at your option) any later version. | |
15 | ||
16 | * This program is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | * GNU Library General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU Library General Public | |
22 | * License along with this program; if not, write to the Free Software | |
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 | */ | |
25 | ||
26 | package com.jcraft.jorbis; | |
27 | ||
28 | class ChainingExample{ | |
29 | public static void main(String[] arg){ | |
30 | VorbisFile ov=null; | |
31 | ||
32 | try{ | |
33 | ov=new VorbisFile(System.in, null, -1); | |
34 | } | |
35 | catch(Exception e){ | |
36 | System.err.println(e); | |
37 | return; | |
38 | } | |
39 | ||
40 | if(ov.seekable()){ | |
41 | System.out.println("Input bitstream contained "+ov.streams()+" logical bitstream section(s)."); | |
42 | System.out.println("Total bitstream playing time: "+ov.time_total(-1)+" seconds\n"); | |
43 | } | |
44 | else{ | |
45 | System.out.println("Standard input was not seekable."); | |
46 | System.out.println("First logical bitstream information:\n"); | |
47 | } | |
48 | ||
49 | for(int i=0;i<ov.streams();i++){ | |
50 | Info vi=ov.getInfo(i); | |
51 | System.out.println("\tlogical bitstream section "+(i+1)+" information:"); | |
52 | System.out.println("\t\t"+vi.rate+"Hz "+vi.channels+" channels bitrate "+ | |
53 | (ov.bitrate(i)/1000)+"kbps serial number="+ov.serialnumber(i)); | |
54 | System.out.print("\t\tcompressed length: "+ov.raw_total(i)+" bytes "); | |
55 | System.out.println(" play time: "+ov.time_total(i)+"s"); | |
56 | Comment vc=ov.getComment(i); | |
57 | System.out.println(vc); | |
58 | } | |
59 | //clear(&ov); | |
60 | } | |
61 | } |