/* * @(#)FormatConversionProvider.java 1.29 03/12/19 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.sound.sampled.spi; import java.io.InputStream; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; /** * A format conversion provider provides format conversion services * from one or more input formats to one or more output formats. * Converters include codecs, which encode and/or decode audio data, * as well as transcoders, etc. Format converters provide methods for * determining what conversions are supported and for obtaining an audio * stream from which converted data can be read. *

* The source format represents the format of the incoming * audio data, which will be converted. *

* The target format represents the format of the processed, converted * audio data. This is the format of the data that can be read from * the stream returned by one of the getAudioInputStream methods. * * @author Kara Kytle * @version 1.29, 03/12/19 * @since 1.3 */ public abstract class FormatConversionProvider { // NEW METHODS /** * Obtains the set of source format encodings from which format * conversion services are provided by this provider. * @return array of source format encodings. The array will always * have a length of at least 1. */ public abstract AudioFormat.Encoding[] getSourceEncodings(); /** * Obtains the set of target format encodings to which format * conversion services are provided by this provider. * @return array of target format encodings. The array will always * have a length of at least 1. */ public abstract AudioFormat.Encoding[] getTargetEncodings(); /** * Indicates whether the format converter supports conversion from the * specified source format encoding. * @param sourceEncoding the source format encoding for which support is queried * @return true if the encoding is supported, otherwise false */ public boolean isSourceEncodingSupported(AudioFormat.Encoding sourceEncoding){ AudioFormat.Encoding sourceEncodings[] = getSourceEncodings(); for(int i=0; itrue if the encoding is supported, otherwise false */ public boolean isTargetEncodingSupported(AudioFormat.Encoding targetEncoding){ AudioFormat.Encoding targetEncodings[] = getTargetEncodings(); for(int i=0; itrue if the conversion is supported, otherwise false */ public boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){ AudioFormat.Encoding targetEncodings[] = getTargetEncodings(sourceFormat); for(int i=0; itrue if the conversion is supported, otherwise false */ public boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat){ AudioFormat targetFormats[] = getTargetFormats( targetFormat.getEncoding(), sourceFormat ); for(int i=0; i