私はインターネットを少し調べましたが、運がありませんでした。誰かが存在するかどうか知っていますか?
4 に答える
どうやら答えはノーです。そこに何も見つけることができませんでした。
そのようなことをするためにQuicktimeAPIを使用してください、
私はこれを使って私の問題を解決しましたquickTime.jar
このユーティリティはからダウンロードできますapple.com
。
ドロップインして.wmaファイルのサポートを提供する.jarファイルを探していると思いますが、このソリューションは.wmaファイルのサポートを取得する方法であり、新しいjarをドロップするよりもそれほど複雑ではありませんでした。これは技術的にはSPIではありませんが、そのようなものはないように思われるので、簡単な代替案を投稿すると便利かもしれないと思いました。
この答えから私は自分の方向性を見つけました。ただし、JAVEに飛び込んでその内容を確認する前に、wmaファイルを変換して再生するために、どれだけのコードを記述しなければならないかを確認できるように、コードの長さを説明します。JAVEが行うことはすべて、Encoderクラスのインスタンスを使用する必要があります。
try {
EncodingAttributes attr = new EncodingAttributes();
attr.setAudioAttributes(new AudioAttributes()); //default values
attr.setVideoAttributes(new VideoAttributes()); //default values
attr.setFormat("wav"); //this is the target format I am trying to achieve
//b.wma is a file I brought to the project
File wma = new File("Resources\\b.wma");
//target.wav is the created file I'll achieve after the encode, which gets used to make a Clip
File target = new File("Resources\\target.wav");
Encoder encoder = new Encoder();
//this will show you all supported encoding / decoding formats
//String[] list = encoder.getSupportedEncodingFormats();
//String[] list = encoder.getSupportedDecodingFormats()
encoder.encode(wma, target, attr);
AudioInputStream is = AudioSystem.getAudioInputStream(target);
Clip clip = AudioSystem.getClip();
clip.open(is);
clip.setFramePosition(0);
clip.start();
} catch (IllegalArgumentException | EncoderException e) {
e.printStackTrace();
} catch (UnsupportedAudioFileException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (LineUnavailableException e) {
e.printStackTrace();
}
Windows 7以降を使用している場合は、MFSampledSPを試してみることをお勧めします。
冒険心があり、Windows以外のプラットフォームをサポートする必要がある場合は、FFSampledSPとそのアップストリームプロジェクトを変更してみてください。