All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javazoom.jl.converter.jlc Maven / Gradle / Ivy

The newest version!
/*
 * 11/19/04		1.0 moved to LGPL.
 *  
 * 29/01/00		Initial version. [email protected]
 * 
 * 12/12/99     JavaLayer 0.0.7 [email protected]
 * 
 * 14/02/99     MPEG_Args Based Class - E.B
 * Adapted from javalayer and MPEG_Args.
 * Doc'ed and integerated with JL converter. Removed
 * Win32 specifics from original Maplay code.
 *-----------------------------------------------------------------------
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library General Public License as published
 *   by the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU Library General Public License for more details.
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *----------------------------------------------------------------------
 */

package javazoom.jl.converter;

import java.io.PrintWriter;

import javazoom.jl.decoder.Crc16;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.decoder.OutputChannels;

/**
 * The jlc class presents the JavaLayer
 * Conversion functionality as a command-line program.
 *
 * @since 0.0.7
 */
public class jlc
{

	static public void main(String args[])
	{
		String[] argv;
		long start = System.currentTimeMillis();
		int argc = args.length + 1;
		argv = new String[argc];
		argv[0] = "jlc";
		for(int i=0;i2)
				{
					try
					{
						String level = argv[i].substring(2);
						verbose_level = Integer.parseInt(level);
					}
					catch (NumberFormatException ex)
					{
						System.err.println("Invalid verbose level. Using default.");
					}
				}
				System.out.println("Verbose Activated (level "+verbose_level+")");
			 }
			 /* else if (argv[i].equals("-s"))
				ma.stdout_mode = true; */
			 else if (argv[i].equals("-p"))
			 {
	      		if (++i == argc)
			  	{
		           System.out.println("Please specify an output filename after the -p option!");
	 	           System.exit (1);
	          	}
		        //output_mode = O_WAVEFILE;
	  		    output_filename = argv[i];
			 }
			 /*else if (argv[i].equals("-f"))
			 {
		        if (++i == argc)
				{
		           System.out.println("Please specify a new scalefactor after the -f option!");
		           System.exit(1);
		   		}
		   	    ma.use_own_scalefactor = true;
		   		// ma.scalefactor = argv[i];
			 }*/
		     else return Usage();
	      }
		  else
		  {
		  	filename = argv[i];
			System.out.println("FileName = "+argv[i]);
			if (filename == null) return Usage();
		  }
		  i++;
	    }
		if (filename == null)
			return Usage();

		return true;
	  }


	   /**
	    * Usage of JavaLayer.
		*/
	   public boolean Usage()
	   {
	  	 System.out.println("JavaLayer Converter :");
		 System.out.println("  -v[x]         verbose mode. ");
		 System.out.println("                default = 2");
	     /* System.out.println("  -s         write u-law samples at 8 kHz rate to stdout");
	     System.out.println("  -l         decode only the left channel");
	     System.out.println("  -r         decode only the right channel");
	     System.out.println("  -d         downmix mode (layer III only)");
	     System.out.println("  -s         write pcm samples to stdout");
	     System.out.println("  -d         downmix mode (layer III only)");*/
	     System.out.println("  -p name    output as a PCM wave file");
	     System.out.println("");
	     System.out.println("  More info on http://www.javazoom.net");
	     /* System.out.println("  -f ushort  use this scalefactor instead of the default value 32768");*/
		 return false;
	   }
	};
};




© 2015 - 2024 Weber Informatics LLC | Privacy Policy