From 7039a05147b8bbfc829babea1c65bd436450b505 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Mon, 8 Jan 2007 23:53:00 +0000 Subject: Splitting out songdbj git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11953 a1c6a512-1295-4272-9138-f99709370657 --- .../convert/TEncodingFormatConversionProvider.java | 129 --------------------- 1 file changed, 129 deletions(-) delete mode 100644 songdbj/org/tritonus/share/sampled/convert/TEncodingFormatConversionProvider.java (limited to 'songdbj/org/tritonus/share/sampled/convert/TEncodingFormatConversionProvider.java') diff --git a/songdbj/org/tritonus/share/sampled/convert/TEncodingFormatConversionProvider.java b/songdbj/org/tritonus/share/sampled/convert/TEncodingFormatConversionProvider.java deleted file mode 100644 index 6b83403..0000000 --- a/songdbj/org/tritonus/share/sampled/convert/TEncodingFormatConversionProvider.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * TEncodingFormatConversionProvider.java - * - * This file is part of Tritonus: http://www.tritonus.org/ - */ - -/* - * Copyright (c) 2000 by Florian Bomers - * - * - * 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. - * - */ - -/* -|<--- this code is formatted to fit into 80 columns --->| -*/ - -package org.tritonus.share.sampled.convert; - -import java.util.Collection; -import java.util.Iterator; - -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioSystem; - -import org.tritonus.share.TDebug; -import org.tritonus.share.ArraySet; - - -// this class depends on handling of AudioSystem.NOT_SPECIFIED in AudioFormat.matches() - -/** - * This is a base class for FormatConversionProviders that only - * change the encoding, i.e. they never - * - *

It is assumed that each source format can be encoded to all - * target formats. - *

In the sourceFormats and targetFormats collections that are passed to - * the constructor of this class, fields may be set to AudioSystem.NOT_SPECIFIED. - * This means that it handles all values of that field, but cannot change it. - *

This class prevents that a conversion is done (e.g. for sample rates), - * because the overriding class specified AudioSystem.NOT_SPECIFIED as sample rate, - * meaning it handles all sample rates. - *

Overriding classes must implement at least - * AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream) - * and provide a constructor that calls the protected constructor of this class. - * - * @author Florian Bomers - */ -public abstract class TEncodingFormatConversionProvider -extends TSimpleFormatConversionProvider -{ - protected TEncodingFormatConversionProvider( - Collection sourceFormats, - Collection targetFormats) - { - super(sourceFormats, targetFormats); - } - - - - /** - * This implementation assumes that the converter can convert - * from each of its source formats to each of its target - * formats. If this is not the case, the converter has to - * override this method. - *

When conversion is supported, for every target encoding, - * the fields sample size in bits, channels and sample rate are checked: - *

- * For this, replaceNotSpecified(sourceFormat, targetFormat) in the base - * class TSimpleFormatConversionProvider is used - and accordingly, the frameSize - * is recalculated with getFrameSize(...) if a field with AudioSystem.NOT_SPECIFIED - * is replaced. Inheriting classes may wish to override this method if the - * default mode of calculating the frame size is not appropriate. - */ - public AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) { - if (TDebug.TraceAudioConverter) { - TDebug.out(">TEncodingFormatConversionProvider.getTargetFormats(AudioFormat.Encoding, AudioFormat):"); - TDebug.out("checking if conversion possible"); - TDebug.out("from: " + sourceFormat); - TDebug.out("to: " + targetEncoding); - } - if (isConversionSupported(targetEncoding, sourceFormat)) { - // TODO: check that no duplicates may occur... - ArraySet result=new ArraySet(); - Iterator iterator = getCollectionTargetFormats().iterator(); - while (iterator.hasNext()) { - AudioFormat targetFormat = iterator.next(); - targetFormat=replaceNotSpecified(sourceFormat, targetFormat); - result.add(targetFormat); - } - if (TDebug.TraceAudioConverter) { - TDebug.out("< returning "+result.size()+" elements."); - } - return result.toArray(EMPTY_FORMAT_ARRAY); - } else { - if (TDebug.TraceAudioConverter) { - TDebug.out("< returning empty array."); - } - return EMPTY_FORMAT_ARRAY; - } - } - -} - -/*** TEncodingFormatConversionProvider.java ***/ -- cgit v1.1