[英]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.