arm上移植mplayer

來源:互聯網
上載者:User

標籤:使用   os   strong   檔案   io   for   

關於mplayer移植網上資料很多,但都很混亂。在此,我做了一個關於mplayer 的詳細總結。在做之前最好在解壓源碼包後,先通過./configure --help看一下相關配置。

X86的LINUX上已經內建瞭解碼庫,不需要另外安裝解碼庫,而arm平台自己做的檔案系統沒有解碼庫,需要另外安裝解碼庫。

下載MPlayer:MPlayer-1.0rc2.tar.bz2
        解碼庫:libmad-0.15.0b.tar.gz

一、在x86的LINUX上安裝mplayer

1 #./configure (./configure    --enable-gui    –-enable-live    –-language=zh )
        2 #make
        3 #make install

此時在MPlayer-1.0rc2目錄下會產生可執行檔mplayer.
        把它拷貝到/bin/目錄下。要執行時:
        #/bin/mpalyer /路徑/要播放的媒體檔案名;
        #/bin/mplayer a.mp3

二、移植mplayer到arm平台的LINUX上(使用4.3.2編譯器)

1 配置安裝libmad

(如果不先配置安裝libmad,則在make mplayer時出現找不到mad.h 錯誤)
        echo PATH=/usr/local/arm/3.3.2/bin:$PATH

(1)#./configure --enable-fpm=arm --host=arm-none-linux-gnueabi --disable-shared --disable-debugging        --prefix=/usr/local/arm/3.3.2/lib CC=arm-none-linux-gnueabi-gcc

參數解析:
        --enable-fpm=arm
        --host=arm-none-linux-gnueabi
        --disable-shared
        --disable-debugging
        --prefix=/home/linux/libmad(make install 安裝路徑)
        CC=arm-none-linux-gnueabi-gcc(4.3.2的交叉編譯工具鏈)

(2)#make

注意如果出現error:unrecognized command line option "-fforce-mem"錯誤,需要修改makefile,去掉--fforce-mem標誌(因為arm-eabi編譯器都不支援這個選項)

(3)#make install

此時會在/home/linux目錄下產生include目錄和lib目錄。
        其中liclude目錄下有檔案 mad.h
        lib 目錄有檔案 libmad.a libmad.la

2 配置安裝mplayer

(1)#./configure    --host-cc=gcc    --cc=arm-none-linux-gnueabi-gcc    --target=arm-linux    --enable-static    --enable-ossaudio    --prefix=/tmp/mplayer-rc2     --disable-win32dll    --disable-dvdread    --enable-fbdev    --disable-mencoder    --disable-live --disable-mp3lib --enable-mad --enable-libavcodec_a    --disable-armv5te    --disable-armv6    --disable-dvdnav    --disable-dvdread    --disable-dvdread-internal        with-extraincdir=/usr/local/arm/3.3.2/lib/include        --with-extralibdir=/usr/local/arm/3.3.2/lib/lib

參數解析:
        --host-cc=gcc         # C compiler for tools needed while building [gcc]
        --cc=arm-none-linux-gnueabi-gcc        #C compiler to build MPlayer [gcc]
        --target=arm-linux        #target platform (i386-linux, arm-linux, etc)
        --enable-static        #build a statically linked binary
        --enable-ossaudio        #enable OSS audio output [autodetect]
        --prefix=/tmp/mplayer-rc2        #prefix directory for installation [/usr/local]
        --disable-win32dll         # disable Win32 DLL support [enabled]
        --disable-dvdread        #disable libdvdread [autodetect]
        --enable-fbdev        #enable FBDev video output [autodetect]
        --disable-mencoder        #disable MEncoder (A/V encoder) compilation [enable] 使能編碼器編輯
        --disable-live        #disable LIVE555 Streaming Media [autodetect] 讓Mpalyer不支援流媒體協議
        --disable-mp3lib        # disable builtin mp3lib [enabled]
        --enable-mad        #disable libmad (MPEG audio) support [autodetect]
        --enable-libavcodec_a        #disable static libavcodec [autodetect]
        --disable-armv5te        #disable DSP extensions (ARM) [autodetect]
        --disable-armv6        #disable ARMv6 (ARM) [autodetect]
        --with-extraincdir=/usr/local/arm/3.3.2/lib/include        #指明mad.h檔案所在路徑
        --with-extralibdir=/usr/local/arm/3.3.2/lib/lib        #指明limad相關連結庫所在路徑

(2)#make

其中可能會遇到如下問題:

1.Error:motion_comp_arm_s.S

在libmpeg2/motion_comp_arm_s.S檔案的最前面加上如下的內容:

#ifndef HAVE_PLD
        .macro pld reg
        .endm
        #endif

2.vo_ivtv.c:79: error: storage size of ’sd’ isn’t known

vo_ivtv.c:80: error: storage size of ’sd1′ isn’t known

添加--disable-ivtv

3. undefined reference to `video_out_ivtv‘

在檔案 file libvo/video_out.c, 找到
        #ifdef HAVE_DXR2
        extern vo_functions_t video_out_dxr2;
        #endif
        extern vo_functions_t video_out_dxr3;
        #ifdef HAVE_IVTV
        extern vo_functions_t video_out_ivtv;
        #endif
        edit it like this:
        #ifdef HAVE_DXR2
        extern vo_functions_t video_out_dxr2;
        #endif
        #ifdef HAVE_DXR3    //這一句是要添加的
        extern vo_functions_t video_out_dxr3;
        #endif    //這句是要添加的
        #ifdef HAVE_IVTV
        extern vo_functions_t video_out_ivtv;
        #endif

使用arm-linux-gcc 3.3.2編譯mplayer可能會出現in.h標頭檔錯誤如下:

/usr/local/arm/3.3.2/include/netinet/in.h:259: parse error before ‘(‘ token
        /usr/local/arm/3.3.2/include/netinet/in.h:259: parse error before "__u32"
        /usr/local/arm/3.3.2/include/netinet/in.h:260: parse error before ‘(‘ token
        /usr/local/arm/3.3.2/include/netinet/in.h:260: parse error before "__u16"
        /usr/local/arm/3.3.2/include/netinet/in.h:262: parse error before ‘(‘ token
        /usr/local/arm/3.3.2/include/netinet/in.h:262: parse error before "__u32"

需要修改一下/usr/local/arm/3.3.2/include/netinet/in.h中,在 __BEGIN_DECLS 後面增加下述文字

#undef ntohl
        #undef ntohs
        #undef htonl
        #undef htons

(3) make install(出現提示不認識的檔案。因為是ARM平台啟動並執行檔案,所有不認識)

install -m 755 -s mplayer /tmp/mplayer-rc2/bin
        strip: Unable to recognise the format of the input file `/tmp/mplayer-rc2/bin/mplayer‘
        此時在MPlayer-1.0rc2目錄下會產生可執行檔mplayer.
        把它拷貝到/bin/目錄下。

要執行時:

#/bin/mpalyer /路徑/要播放的媒體檔案名;
        #/bin/mplayer -ac mad a.mp3

三、MPlayer slave命令

在命令中添加 -slave 和 -quiet就可以通過命令設定Mplayer實現相應的功能。在mplayer源碼中的,/DOCS/tech/slave.txt中對這些命令有詳細的解析。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.