AudioSystem.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
/**
 * Indicates whether an audio input stream of a specified format can be
 * obtained from an audio input stream of another specified format.
 *
 * @param  targetFormat the desired audio format after conversion
 * @param  sourceFormat the audio format before conversion
 * @return {@code true} if the conversion is supported, otherwise
 *         {@code false}
 * @throws NullPointerException if {@code targetFormat} or
 *         {@code sourceFormat} are {@code null}
 */
public static boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat) {
    Objects.requireNonNull(targetFormat);
    Objects.requireNonNull(sourceFormat);
    if (sourceFormat.matches(targetFormat)) {
        return true;
    }

    List<FormatConversionProvider> codecs = getFormatConversionProviders();

    for(int i=0; i<codecs.size(); i++ ) {
        FormatConversionProvider codec = codecs.get(i);
        if(codec.isConversionSupported(targetFormat, sourceFormat) ) {
            return true;
        }
    }
    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号