summaryrefslogtreecommitdiff
path: root/songdbj/javazoom/jl/converter/jlc.java
diff options
context:
space:
mode:
Diffstat (limited to 'songdbj/javazoom/jl/converter/jlc.java')
-rw-r--r--songdbj/javazoom/jl/converter/jlc.java216
1 files changed, 0 insertions, 216 deletions
diff --git a/songdbj/javazoom/jl/converter/jlc.java b/songdbj/javazoom/jl/converter/jlc.java
deleted file mode 100644
index 57c84eba4a..0000000000
--- a/songdbj/javazoom/jl/converter/jlc.java
+++ /dev/null
@@ -1,216 +0,0 @@
1/*
2 * 11/19/04 1.0 moved to LGPL.
3 *
4 * 29/01/00 Initial version. mdm@techie.com
5 *
6 * 12/12/99 JavaLayer 0.0.7 mdm@techie.com
7 *
8 * 14/02/99 MPEG_Args Based Class - E.B
9 * Adapted from javalayer and MPEG_Args.
10 * Doc'ed and integerated with JL converter. Removed
11 * Win32 specifics from original Maplay code.
12 *-----------------------------------------------------------------------
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU Library General Public License as published
15 * by the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Library General Public License for more details.
22 *
23 * You should have received a copy of the GNU Library General Public
24 * License along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 *----------------------------------------------------------------------
27 */
28
29package javazoom.jl.converter;
30
31import java.io.PrintWriter;
32
33import javazoom.jl.decoder.Crc16;
34import javazoom.jl.decoder.JavaLayerException;
35import javazoom.jl.decoder.OutputChannels;
36
37/**
38 * The <code>jlc</code> class presents the JavaLayer
39 * Conversion functionality as a command-line program.
40 *
41 * @since 0.0.7
42 */
43public class jlc
44{
45
46 static public void main(String args[])
47 {
48 String[] argv;
49 long start = System.currentTimeMillis();
50 int argc = args.length + 1;
51 argv = new String[argc];
52 argv[0] = "jlc";
53 for(int i=0;i<args.length;i++)
54 argv[i+1] = args[i];
55
56 jlcArgs ma = new jlcArgs();
57 if (!ma.processArgs(argv))
58 System.exit(1);
59
60 Converter conv = new Converter();
61
62 int detail = (ma.verbose_mode ?
63 ma.verbose_level :
64 Converter.PrintWriterProgressListener.NO_DETAIL);
65
66 Converter.ProgressListener listener =
67 new Converter.PrintWriterProgressListener(
68 new PrintWriter(System.out, true), detail);
69
70 try
71 {
72 conv.convert(ma.filename, ma.output_filename, listener);
73 }
74 catch (JavaLayerException ex)
75 {
76 System.err.println("Convertion failure: "+ex);
77 }
78
79 System.exit(0);
80 }
81
82
83 /**
84 * Class to contain arguments for maplay.
85 */
86 static class jlcArgs
87 {
88 // channel constants moved into OutputChannels class.
89 //public static final int both = 0;
90 //public static final int left = 1;
91 //public static final int right = 2;
92 //public static final int downmix = 3;
93
94 public int which_c;
95 public int output_mode;
96 public boolean use_own_scalefactor;
97 public float scalefactor;
98 public String output_filename;
99 public String filename;
100 //public boolean stdout_mode;
101 public boolean verbose_mode;
102 public int verbose_level = 3;
103
104 public jlcArgs()
105 {
106 which_c = OutputChannels.BOTH_CHANNELS;
107 use_own_scalefactor = false;
108 scalefactor = (float) 32768.0;
109 //stdout_mode = false;
110 verbose_mode = false;
111 }
112
113 /**
114 * Process user arguments.
115 *
116 * Returns true if successful.
117 */
118 public boolean processArgs(String[] argv)
119 {
120 filename = null;
121 Crc16[] crc;
122 crc = new Crc16[1];
123 int i;
124 int argc = argv.length;
125
126 //stdout_mode = false;
127 verbose_mode = false;
128 output_mode = OutputChannels.BOTH_CHANNELS;
129 output_filename = "";
130 if (argc < 2 || argv[1].equals("-h"))
131 return Usage();
132
133 i = 1;
134 while (i < argc)
135 {
136 /* System.out.println("Option = "+argv[i]);*/
137 if (argv[i].charAt(0) == '-')
138 {
139 if (argv[i].startsWith("-v"))
140 {
141 verbose_mode = true;
142 if (argv[i].length()>2)
143 {
144 try
145 {
146 String level = argv[i].substring(2);
147 verbose_level = Integer.parseInt(level);
148 }
149 catch (NumberFormatException ex)
150 {
151 System.err.println("Invalid verbose level. Using default.");
152 }
153 }
154 System.out.println("Verbose Activated (level "+verbose_level+")");
155 }
156 /* else if (argv[i].equals("-s"))
157 ma.stdout_mode = true; */
158 else if (argv[i].equals("-p"))
159 {
160 if (++i == argc)
161 {
162 System.out.println("Please specify an output filename after the -p option!");
163 System.exit (1);
164 }
165 //output_mode = O_WAVEFILE;
166 output_filename = argv[i];
167 }
168 /*else if (argv[i].equals("-f"))
169 {
170 if (++i == argc)
171 {
172 System.out.println("Please specify a new scalefactor after the -f option!");
173 System.exit(1);
174 }
175 ma.use_own_scalefactor = true;
176 // ma.scalefactor = argv[i];
177 }*/
178 else return Usage();
179 }
180 else
181 {
182 filename = argv[i];
183 System.out.println("FileName = "+argv[i]);
184 if (filename == null) return Usage();
185 }
186 i++;
187 }
188 if (filename == null)
189 return Usage();
190
191 return true;
192 }
193
194
195 /**
196 * Usage of JavaLayer.
197 */
198 public boolean Usage()
199 {
200 System.out.println("JavaLayer Converter :");
201 System.out.println(" -v[x] verbose mode. ");
202 System.out.println(" default = 2");
203 /* System.out.println(" -s write u-law samples at 8 kHz rate to stdout");
204 System.out.println(" -l decode only the left channel");
205 System.out.println(" -r decode only the right channel");
206 System.out.println(" -d downmix mode (layer III only)");
207 System.out.println(" -s write pcm samples to stdout");
208 System.out.println(" -d downmix mode (layer III only)");*/
209 System.out.println(" -p name output as a PCM wave file");
210 System.out.println("");
211 System.out.println(" More info on http://www.javazoom.net");
212 /* System.out.println(" -f ushort use this scalefactor instead of the default value 32768");*/
213 return false;
214 }
215 };
216}; \ No newline at end of file