[英]Flash/Flex Speex audio decode, to play a speex file
我想播放由Web上的Speex編碼的* .spx文件。
但我不了解Flash / Flex或任何Flash Audio編解碼器。 谷歌搜索了一整天后,我得到了一些解決方案,即:
使用FLV容器執行包裝Speex文件的操作,因為Speex只能作為FLV容器中的音頻編解碼器播放。
現在我可以在Flex中播放SPX-Audio-Only FLV文件,我使用netStream.play("audio-only-speex.flv")
,但我不知道如何使用ActionScript用FLV容器包裝Spx文件。
任何示例項目?
使用AS解碼Spx。
我檢查了他們都解碼了OGG Vorbis但沒有Speex的flfl頁面:(
http://barelyfocused.net/blog/2008/10/03/flash-vorbis-player
http://www.exswap.com/?p=132
http://mauft.com/2010/11/ogg-vorbis-in-flash
Adobe還提供了一個由Alchemy移植的AS3 OggVorbis庫:
http://labs.adobe.com/wiki/index.php/Alchemy:Libraries
FMS:使用FMS或Red / Xuggle進行服務器流式傳輸。 我以前從未聽說過FMS的東西,我也不確定我的虛擬主機是否可以支持...
將每個Spx文件轉換為MP3。
我認為最好的解決方案是在AS3中解碼Spx,是的,我想制作一個Spx Flash Player。
所以,我從speex.org下載了Speex Library,安裝了Adobe Alchemy。 via Alchemy. 之后./configure;make
的libspeex,建立libspeex / speex.c出通過煉金術 然后,我不知道接下來該怎么做。 如何使用AS3解碼speex音頻?
我的libspeex.swc: http ://demo.0x123.com/libspeex.swc
另外 ,在構建libspeex.swc之前,我應該使用Alchemy API重寫libspeex嗎?
雖然我不是AS的專業,但我有很強的學習能力。 任何建議將不勝感激,非常感謝。
Adobe特別指出不依賴Alchemy,所以在客戶端沒有官方的方法(據我所知)。鑒於使用了明顯的speex解碼器,這是荒謬的。
你可以使用Xuggle的欺騙版ffmpeg(http://code.google.com/p/xuggle-ffmpeg/)將speex嵌入FLV嗎? 如果您可以批量或動態運行xuggle,那么無論原始音頻格式如何,您都可以提供speex編碼的FLV,可以從netStream.play
播放。
ffmpeg -i test.wav -acodec libspeex -f flv -y speex.flv
對於基本播放,您甚至不需要閃存介質服務器。
現在我知道我必須使用煉金術API重寫speex庫:
http://labs.adobe.com/wiki/index.php/Alchemy:Documentation:Developing_with_Alchemy:C_API
http://labs.adobe.com/wiki/index.php/Alchemy:Documentation:Developing_with_Alchemy:AS3_API
我做了一個簡單的helloWorld。 這是第一步很麻煩。 :)
MAIN.C
#include <stdio.h>
#include "AS3.h"
static AS3_Val addNumber(void* self, AS3_Val args)
{
double num1 = 0.0;
double num2 = 0.0;
AS3_ArrayValue( args, "DoubleType, DoubleType",
&num1, &num2);
double sum = num1 + num2;
return AS3_Number(sum);
}
static AS3_Val helloString(void* self, AS3_Val args)
{
char *str = "Hello, Alchemy!";
return AS3_String(str);
}
int main ()
{
// define the methods exposed to ActionScript
// typed as an ActionScript Function instance
AS3_Val addNumberMethod = AS3_Function(NULL, addNumber);
AS3_Val helloStringMethod = AS3_Function(NULL, helloString);
// construct an object that holds references to the functions
AS3_Val result = AS3_Object("addNumber: AS3ValType, helloString: AS3ValType",
addNumberMethod,
helloStringMethod);
// Release
AS3_Release(addNumberMethod);
AS3_Release(helloStringMethod);
// notify that we initialized -- THIS DOES NOT RETURN!
AS3_LibInit(result);
// should never get here!
return 0;
}
使用$ main.c -O3 -Wall -swc -o HelloAlchemy.swc
AS代碼:
import cmodule.HelloAlchemy.CLibInit;
import mx.controls.Alert;
private var loader:CLibInit;
private var lib:Object;
private function init():void
{
loader = new CLibInit;
lib = loader.init();
}
protected function button1_clickHandler(event:MouseEvent):void
{
Alert.show(String(lib.addNumber(Number(3),Number(5))));
}
protected function helloStringButton_ClickHandler(event:MouseEvent):void
{
var str:String = String(lib.helloString());
Alert.show(str);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.