/**
* Indicates whether an audio input stream of the specified encoding can be
* obtained from an audio input stream that has the specified format.
*
* @param targetEncoding the desired encoding after conversion
* @param sourceFormat the audio format before conversion
* @return {@code true} if the conversion is supported, otherwise
* {@code false}
* @throws NullPointerException if {@code targetEncoding} or
* {@code sourceFormat} are {@code null}
*/
public static boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat) {
Objects.requireNonNull(targetEncoding);
Objects.requireNonNull(sourceFormat);
if (sourceFormat.getEncoding().equals(targetEncoding)) {
return true;
}
List<FormatConversionProvider> codecs = getFormatConversionProviders();
for(int i=0; i<codecs.size(); i++ ) {
FormatConversionProvider codec = codecs.get(i);
if(codec.isConversionSupported(targetEncoding,sourceFormat) ) {
return true;
}
}
return false;
}
AudioSystem.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录