2012-04-12 71 views

回答

1

顯然,答案是否定的。一直沒能找到任何東西。

0

使用的Quicktime API做這樣的事情,

我已經使用這個quickTime.jar

你可以從apple.com下載此工具解決我的問題。

+1

啊,但是我正在尋找一個SPI的原因是因爲我已經有支持幾乎所有其他媒體格式,並通過javasound在我的系統工作。因此,添加WMA支持就像拖放.jar一樣簡單。我真的不想要一個完整的API。雖然謝謝! – Nico 2012-04-12 15:00:41

0

我知道你正在尋找一個.jar文件,只是順路和WMA文件提供支持,但這種方法是怎麼弄到的WMA文件的支持,這是不是比下降的要複雜得多一個新的罐子。這在技術上並不是SPI,但由於似乎沒有這樣的事情,我認爲一個簡單的替代方案可能對張貼有用。

this answer我找到我的方向。您將深入瞭解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(); 
} 
0

如果您使用的是Windows 7或更高版本,則可能需要嘗試MFSampledSP

如果你喜歡冒險,並且需要支持其他平臺比Windows,你可以嘗試修改FFSampledSP及其上游項目。