• <code id="zjelh"></code>

          <source id="zjelh"><form id="zjelh"></form></source><acronym id="zjelh"><form id="zjelh"><blockquote id="zjelh"></blockquote></form></acronym>

          1. <acronym id="zjelh"><form id="zjelh"></form></acronym>

            <input id="zjelh"><rt id="zjelh"></rt></input>
            <var id="zjelh"><rt id="zjelh"></rt></var>
            <source id="zjelh"><form id="zjelh"><del id="zjelh"></del></form></source>
            Hi,歡迎來到嵌入式培訓高端品牌 - 華清遠見教育集團<北京總部官網>,專注嵌入式工程師培養15年!
            當前位置: > 華清遠見教育集團 > 嵌入式學習 > 講師博文 > Mplayer 移植
            Mplayer 移植
            時間:2017-01-05作者:華清遠見

            關于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中對這些命令有詳細的解析。

            Mplayer相關文章:

            Qt編寫Mplayer前端程序

            發表評論
            評論列表(網友評論僅供網友表達個人看法,并不表明本站同意其觀點或證實其描述)
            yy4480影院