这两天有点闲,把MPD播放器重新编译了一遍,终于可以摆脱OSS,直接用ALSA输出了。还省掉了两个模块的加载,节约一点内存,在/etc/module.d/70-alsa文件注释掉:
#snd-mixer-oss
#snd-pcm-oss
装了kmod-alsa,就不需要kmod-usb-audio模块了,他是为oss准备的。
而且,MPD_0.15.5还支持居多文件格式,APE就是其中一个,以后不用搞格式转换了,呵呵。可惜不支持cue文件播放,还是要分割音轨。
Supported decoders:
[mad] mp3 mp2
[vorbis] ogg oga
[oggflac] ogg oga
[flac] flac
[audiofile] wav au aiff aif
[faad] aac
[mpcdec] mpc
[wavpack] wv
[ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav wma wmv wsaud wsvga wv wve
原来播放FLAC音轨开始的时候,不是很流畅,查了一下,还是linux 下OSS声音驱动的问题, 所以打算不再用ALSA模拟OSS,而直接用ALSA输出。
但是,Openwrt上MPD一直不是很顺畅,播放效果不好,编译也问题多多。因此采用Optware方案。
该方案比较复杂,因为Optwera支持的MPD是不带ALSA输出plugin的,必须自己编译alsa-lib。还有一个bug,也让编译不顺。不过最终还是搞定了,
具体方法如下,因为是发MPD论坛的,所以用英语,很蹩脚,凑合看吧:
To start, get Optware installed:
svn co http://svn.nslu2-linux.org/svnroot/optware/trunk optware
cd ./optware
Create compile target, my platform is wl-700ge, which is openwrt-brcm24:
make openwrt-brcm24-target
cd openwrt-brcm24
make directories
make ipkg-utils
make toolchain
Now compiling environment is ready.
Packages can be compiled now, but there could be a few problems, autoconf version is one, so we can download automake1.9:
sudo apt-get install automake1.9
and gettext
sudo apt-get install gettext
According to Optware compiling best practice, libtool from Ubuntu 9.04 and later can be problematic, so a vertion os libtool from Ubuntu 8.04 or 8.10 is needed, the deb package of which can be downloaded from ubuntu archive sites.
Also, there has been a bug with libavcodec/imgresample.c, a patch can to applied here:
***********************************************************
Index: libavcodec/imgresample.c
===================================================================
--- libavcodec/imgresample.c (revision 16975)
+++ libavcodec/imgresample.c (working copy)
@@ -517,10 +517,10 @@
static const AVClass context_class = { "imgresample", context_to_name, NULL };
-struct SwsContext *sws_getContext(int srcW, int srcH, int srcFormat,
- int dstW, int dstH, int dstFormat,
+struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
+ int dstW, int dstH, enum PixelFormat dstFormat,
int flags, SwsFilter *srcFilter,
- SwsFilter *dstFilter, double *param)
+ SwsFilter *dstFilter, const double *param)
{
struct SwsContext *ctx;
@@ -575,9 +575,10 @@
* asumed to remain valid.
*/
struct SwsContext *sws_getCachedContext(struct SwsContext *ctx,
- int srcW, int srcH, int srcFormat,
- int dstW, int dstH, int dstFormat, int flags,
- SwsFilter *srcFilter, SwsFilter *dstFilter, double *param)
+ int srcW, int srcH, enum PixelFormat srcFormat,
+ int dstW, int dstH, enum PixelFormat dstFormat,
+ int flags, SwsFilter *srcFilter,
+ SwsFilter *dstFilter, const double *param)
{
if (ctx != NULL) {
if ((ctx->resampling_ctx->iwidth != srcW) ||
*************************************************************************
Before mpd is compiled, compile alsa-lib first,
make alsa-lib
In case alsa-lib-1.0.8.tar.bz2 is not downloadible from site specified by the alsa-lib.mk file, get it from the Internet
After alsa-lib is compiled, all files and directories need to be copied to ./builds/mpc/alsa/ to make sure header files are accessible by Optware compiler.
And libasound.so file under ./alsa-lib/src/.libs/ has to be copied to ./staging/opt/lib/, otherwise alsa output plugin will not work.
Now, fire make mpd, it should be OK.
Then create ipk package by issuing:
make mpd-ipk
mpd_0.15.5-1_mipsel.ipk can be found under ./builds/
Have fun!
[ 本帖最后由 mohan29 于 22-11-2009 05:20 编辑 ] |