Qt——用在ARM板上的Mplayer(1.3.0,1.0rc4)安装编译步骤!还有,Mplayer背景抖动闪烁问题解答,终于来了!

17 篇文章 13 订阅

注意:若转载,请贴上链接“https://blog.csdn.net/qq_41042595/article/details/112308184”,如若发现抄袭或未标明来源现象,都可举报反馈!!!

提示:若想知道Mplayer背景抖动、闪烁的解决方案,请直接点击“文章目录”——“一、”中的“5、”——“4)与Mplayer的Demo结合使用”!!!


前言

2020.11月中旬遇到Mplayer“彩条——黑色——透明色”三种色的闪烁、抖动的问题,找了一两个月(国内为主,国外没看懂)网上方案,依然不知道:到底是哪里出的问题?!!!
后续与同事、领导齐心合力,终于找到了问题所在!

就此在CSDN中发表,为后人做个参考,让 被Mplayer问题纠缠已久、苦寻答案的难兄难弟 得个痛快!
在这里插入图片描述

咳咳~言归正传,先下载好要用的库包吧!

安装库包下载:
CSDN下载分享,无需积分,免费

本文主要以这篇文章编写安装步骤,算是它的升华版!
MPlayer移植步骤

无论是哪个版本,环境都是一样的:

1)环境:

Linux(Ubuntu14.0 LTS),本地交叉工具链gcc x86 4.8.4,Arm交叉工具链arm-linux-gcc5.4.0,Arm板Linux3.10

2)辅助软件:

Tera Term(Windows环境下)、Source Insight(Windows环境下)

3)硬件:

ARM开发板(全志T3),USB转串口线,虚拟机下Linux系统


提示:以下是本篇文章正文内容,下面案例可供参考

一、MPlayer1.0rc4的安装编译

1、前提

1)安装库包:

MPlayer-1.0rc4.tar.bz2、libmad-0.15.1b.tar.gz

2、准备工作

1)建个目录

去“家(即“~”目录)”里建个‘mplayer_workstation’目录(为了放置两个包):

root@virtual-machine:/# cd ~
root@virtual-machine:~# pwd
/root
root@virtual-machine:~# mkdir mplayer_workstation
root@virtual-machine:~# ls
mplayer_workstation  公共的  模板  视频  图片  文档  下载  音乐  桌面

在这里插入图片描述

注:

cd ~ 是跳转到当前用户的家目录;
如果是root用户,cd ~相当于 cd /root;
如果是普通用户,cd ~相当于cd /home/当前用户名;

cd / 是跳转到根目录,
根目录是所有用户共享的目录;

延伸:
cd /home 相当于查看 有多少普通用户 的家目录;
因为所有的普通用户的父目录都是home目录。


pwdecho $PWDecho $(pwd)echo $(PWD)echo $pwd指令的区别:

pwdecho $PWD的打印结果相同,
pwd命令,而$PWD变量(无需定义),
另外,echo $(pwd)指令有效,打印结果与上面相同,
echo $(PWD)echo $pwd两个指令无效!

2)将包放入该目录

将下载好的两个库包拷贝至‘mplayer_workstation’目录:
在这里插入图片描述

3、配置编译libmad库

1)解压libmad-0.15.1b.tar.gz压缩包

tar xzvf libmad\-0.15.1b.tar.gz

打印结果:

root@virtual-machine: ~/mplayer_workstation# tar xzvf libmad-0.15.1b.tar.gz
libmad-0.15.1b/
libmad-0.15.1b/README
libmad-0.15.1b/configure.ac
libmad-0.15.1b/aclocal.m4
libmad-0.15.1b/mad.h
libmad-0.15.1b/Makefile.am
libmad-0.15.1b/Makefile.in
libmad-0.15.1b/config.h.in
libmad-0.15.1b/libmad.list.in
libmad-0.15.1b/configure
libmad-0.15.1b/COPYING
libmad-0.15.1b/INSTALL
。。。。。
libmad-0.15.1b/msvc++/Makefile.am
libmad-0.15.1b/msvc++/Makefile.in
libmad-0.15.1b/msvc++/mad.h
libmad-0.15.1b/msvc++/config.h
libmad-0.15.1b/msvc++/libmad.dsp

解压好的libmad-0.15.1b目录,进行查看检查

root@virtual-machine:~/mplayer_workstation# cd libmad-0.15.1b
root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b# ls
aclocal.m4    COPYRIGHT  global.h       layer3.h        msvc++        timer.h
bit.c         CREDITS    huffman.c      libmad.list.in  qc_table.dat  TODO
bit.h         D.dat      huffman.h      ltmain.sh       README        VERSION
CHANGES       decoder.c  imdct_l_arm.S  mad.h           rq_table.dat  version.c
config.guess  decoder.h  imdct_s.dat    mad.h.sed       sf_table.dat  version.h
config.h.in   depcomp    INSTALL        Makefile.am     stream.c
config.sub    fixed.c    install-sh     Makefile.in     stream.h
configure     fixed.h    layer12.c      minimad.c       synth.c
configure.ac  frame.c    layer12.h      missing         synth.h
COPYING       frame.h    layer3.c       mkinstalldirs   timer.c
root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b#

2)配置

1】建个目录

创建文件夹libmad_install(为了放置libmad编译安装之后产生的文件):
mkdir libmad_install

root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b# mkdir libmad_install

在这里插入图片描述

2】关键操作:配置

到了 配置 操作,其中会产生一些文件,包含Makefile:

./configure CC=arm-linux-gcc --host=arm-linux --disable-shared --disable-debugging --prefix=/root/mplayer_workstation/libmad-0.15.1b/libmad_install

打印结果:

root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b# ./configure CC=arm-linux-gcc --host=arm-linux --disable-shared --disable-debugging --prefix=/root/mplayer_workstation/libmad-0.15.1b/libmad_install
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for arm-linux-strip... arm-linux-strip
checking build system type... x86_64-unknown-linux-gnu
checking host system type... arm-unknown-linux-gnu
。。。。。
checking for fork... yes
checking whether to optimize for speed or for accuracy... default
checking for architecture-specific fixed-point math routines... ARM
checking for ISO/IEC interpretation... best accepted practices
checking whether to enable profiling... no
checking whether to enable debugging... no
checking whether to enable experimental code... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating msvc++/Makefile
config.status: creating libmad.list
config.status: creating config.h
config.status: executing depfiles commands

注:

--prefix指的是放置编译安装之后产生的 include(含头文件)、lib(静态链接库文件) 两个目录的文件夹绝对路径位置

如果对配置指令中的--disable-shared参数(不允许共享)改为--enable-shared参数(允许共享),那么编译make安装后产生的lib目录中,除了.a静态链接库、.la两种文件生成,还会生成.so动态链接库(共享文件)、.so.0、.so.0.2.1三个多余文件:
在这里插入图片描述


.o文件,即目标文件。
.so文件,是动态链接库文件,即共享库文件,shared object 共享库(对象),相当于windows下的dll。
.a文件,archive 归档包,即静态库。其实质是多个.o文件打包的结果,相当于VC下的.lib文件
.la文件,libtool archive 文件,是libtool自动生成的共享库文件。

3)准备工作

对Makefile文件进行删减,删除“-fforce-mem”:

第一种删除方式

在这里插入图片描述
在这里插入图片描述

第二种删除方式

vim Makefile

root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b# vim Makefile

回车后:
进入Vim模式,直接输入搜索命令(:g/-fforce-mem)按下回车,进行行末模式,光标会出现在搜索目标的当前行:
在这里插入图片描述
在这里插入图片描述

然后基于英文输入法按i键,进入插入模式,将“-fforce-mem”标签删除:

在这里插入图片描述

紧接着按Esc键退出插入模式,基于英文输入法输入:wq!:wq,回车之后,保存且退出Vim模式!

不删除的后果

会遇到这个异常:

arm-linux-gcc.br_real: error: unrecognized command line option '-fforce-mem'
make[2]: *** [version.lo] 错误 1
make[2]:正在离开目录 `/root/mplayer_workstation/libmad-0.15.1b'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/root/mplayer_workstation/libmad-0.15.1b'
make: *** [all] 错误 2

在这里插入图片描述

4)编译

1】编译、安装

makemake install

打印结果:

root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b# make
(sed -e '1s|.*|/*|' -e '1b' -e '$s|.*| */|' -e '$b'  \
		-e 's/^.*/ *&/' ./COPYRIGHT; echo;  \
	echo "# ifdef __cplusplus";  \
	echo 'extern "C" {';  \
	echo "# endif"; echo;  \
	if [ ".-DFPM_ARM" != "." ]; then  \
		echo ".-DFPM_ARM" | sed -e 's|^\.-D|# define |'; echo;  \
	fi;  \
	sed -ne 's/^# *define  *\(HAVE_.*_ASM\).*/# define \1/p'  \
		config.h; echo;  \
	sed -ne 's/^# *define  *OPT_\(SPEED\|ACCURACY\).*/# define OPT_\1/p'  \
		config.h; echo;  \
	sed -ne 's/^# *define  *\(SIZEOF_.*\)/# define \1/p'  \
		config.h; echo;  \
	for header in version.h fixed.h bit.h timer.h stream.h frame.h synth.h decoder.h; do  \
		echo;  \
		sed -n -f ./mad.h.sed ./$header;  \
	done; echo;  \
	echo "# ifdef __cplusplus";  \
	echo '}';  \
	echo "# endif") >mad.h
make  all-recursive
make[1]: 正在进入目录 `/root/mplayer_workstation/libmad-0.15.1b'
make[2]: 正在进入目录 `/root/mplayer_workstation/libmad-0.15.1b'
make[2]:正在离开目录 `/root/mplayer_workstation/libmad-0.15.1b'
make[1]:正在离开目录 `/root/mplayer_workstation/libmad-0.15.1b'
root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b# make install
make  install-recursive
make[1]: 正在进入目录 `/root/mplayer_workstation/libmad-0.15.1b'
make[2]: 正在进入目录 `/root/mplayer_workstation/libmad-0.15.1b'
make[3]: 正在进入目录 `/root/mplayer_workstation/libmad-0.15.1b'
mkdir -p -- . /root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib
 /bin/sh ./libtool --mode=install /usr/bin/install -c  libmad.la /root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib/libmad.la
/usr/bin/install -c .libs/libmad.lai /root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib/libmad.la
/usr/bin/install -c .libs/libmad.a /root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib/libmad.a
arm-linux-ranlib /root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib/libmad.a
chmod 644 /root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib/libmad.a
PATH="$PATH:/sbin" ldconfig -n /root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib
----------------------------------------------------------------------
Libraries have been installed in:
   /root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
mkdir -p -- . /root/mplayer_workstation/libmad-0.15.1b/libmad_install/include
 /usr/bin/install -c -m 644 mad.h /root/mplayer_workstation/libmad-0.15.1b/libmad_install/include/mad.h
make[3]:正在离开目录 `/root/mplayer_workstation/libmad-0.15.1b'
make[2]:正在离开目录 `/root/mplayer_workstation/libmad-0.15.1b'
make[1]:正在离开目录 `/root/mplayer_workstation/libmad-0.15.1b'

注:

顺序不能打乱!


上面贴出的make打印语句少,是因为只编译成功一半,其实,主要原因是因为没提前删Makefile中的那个值“-fforce-mem”,使得第一次make编译一半被迫停止,所以修改之后(做好准备工作后),再make一遍,未编译的另一半就正常运行了,
我也就只能贴出的打印语句剩下一半的信息咯!

2】进行查看检查

查看安装之后产生的文件,确定一下:

root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b# cd libmad_install/
root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b/libmad_install# ls
include  lib
root@virtual-machine:~/mplayer_workstation/libmad-0.15.1b/libmad_install# tree
.
├── include
│   └── mad.h
└── lib
    ├── libmad.a
    └── libmad.la
2 directories, 3 files

注:
若输入“tree”指令回车后,得到“程序tree尚未安装”的信息,就说明要安装“树”插件:
请输入指令sudo apt-get install tree
在这里插入图片描述在这里插入图片描述

4、配置编译MPlayer包

1)解压MPlayer-1.0rc4.tar.bz2压缩包

解压Mplayer压缩包的目录,包含Makefile文件:
tar xvf MPlayer-1.0rc4.tar.bz2

打印结果:

root@virtual-machine:~/mplayer_workstation# tar xvf MPlayer-1.0rc4.tar.bz2
MPlayer-1.0rc4/
MPlayer-1.0rc4/libdvdnav/
MPlayer-1.0rc4/libdvdnav/remap.h
MPlayer-1.0rc4/libdvdnav/README.MAP
MPlayer-1.0rc4/libdvdnav/Makefile.am
MPlayer-1.0rc4/libdvdnav/highlight.c
MPlayer-1.0rc4/libdvdnav/FELLOWSHIP.map
MPlayer-1.0rc4/libdvdnav/remap.c
MPlayer-1.0rc4/libdvdnav/searching.c
MPlayer-1.0rc4/libdvdnav/read_cache.h
。。。。。
MPlayer-1.0rc4/libmpcodecs/ae_faac.c
MPlayer-1.0rc4/path.h
MPlayer-1.0rc4/vobsub.c

解压好的MPlayer-1.0rc4目录,进行查看检查

root@virtual-machine:~/mplayer_workstation# cd MPlayer-1.0rc4
root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# ls
access_mpcontext.h  gui          mixer.h         playtree.h
asxparser.c         help         m_option.c      playtreeparser.c
asxparser.h         input        m_option.h      playtreeparser.h
AUTHORS             libaf        mp3lib          README
av_opts.c           libao2       mpbswap.h       rpm
av_opts.h           libass       mpcommon.c      spudec.c
cfg-common.h        libavcodec   mpcommon.h      spudec.h
cfg-mencoder.h      libavformat  mp_core.h       stream
cfg-mplayer-def.h   libavutil    mp_fifo.c       sub_cc.c
cfg-mplayer.h       libdvdcss    mp_fifo.h       sub_cc.h
Changelog           libdvdnav    mplayer.c       subdir.mak
codec-cfg.c         libdvdread4  mplayer.h       subopt-helper.c
codec-cfg.h         libfaad2     mp_msg.c        subopt-helper.h
command.c           libmenu      mp_msg.h        subreader.c
command.h           libmpcodecs  mp_osd.h        subreader.h
common.mak          libmpdemux   m_property.c    TOOLS
configure           libmpeg2     m_property.h    tremor
Copyright           libpostproc  m_struct.c      unrar_exec.c
cpudetect.c         libswscale   m_struct.h      unrar_exec.h
cpudetect.h         libvo        osdep           VERSION
cpuinfo.c           LICENSE      parser-cfg.c    version.sh
DOCS                loader       parser-cfg.h    vidix
drivers             Makefile     parser-mecmd.c  vobsub.c
edl.c               mangle.h     parser-mecmd.h  vobsub.h
edl.h               m_config.c   parser-mpcmd.c  xvid_vbr.c
etc                 m_config.h   parser-mpcmd.h  xvid_vbr.h
find_sub.c          mencoder.c   path.c
fmt-conversion.c    metadata.h   path.h
fmt-conversion.h    mixer.c      playtree.c
root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4#

2)配置

1】建个目录

创建文件夹mplayer4_install(为了放置Mplayer编译安装之后产生的文件):
mkdir mplayer4_install

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# mkdir mplayer4_install

在这里插入图片描述

2】关键操作:配置

到了 配置 操作,其中会产生一些文件,包含config.mak:

./configure --host-cc=gcc --cc=arm-linux-gcc --target=arm-linux --enable-fbdev --enable-static --disable-dvdread --disable-live --disable-mp3lib --enable-mad --disable-win32dll --disable-mencoder --disable-ivtv --disable-dvdnav --disable-dvdread-internal --disable-libdvdcss-internal --enable-libavcodec_a --prefix=/root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install

打印结果:

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# ./configure --host-cc=gcc --cc=arm-linux-gcc --target=arm-linux --enable-fbdev --enable-static --disable-dvdread --disable-live --disable-mp3lib --enable-mad --disable-win32dll --disable-mencoder --disable-ivtv --disable-dvdnav --disable-dvdread-internal --disable-libdvdcss-internal --enable-libavcodec_a --prefix=/root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install
Checking for arm-linux-gcc version ... 5.4.0 
Detected operating system: Linux
Detected host architecture: arm
Checking for host cc ... gcc 
Checking for cross compilation ... ./configure: line 1670: /tmp/mplayer-configure-23959-19479/tmp: cannot execute binary file: Exec format error
yes 
Checking for byte order ... little-endian 
Checking for extern symbol prefix ...  
Checking for assembler support of -pipe option ... yes 
Checking for compiler support of named assembler arguments ... yes 
Checking for .align is a power of two ... yes 
Checking for ARM pld instruction ... yes 
Checking for ARMv5TE (Enhanced DSP Extensions) ... yes 
Checking for ARMv6 (SIMD instructions) ... yes 
。。。。。
Checking for lircc ... no 
Checking for maemo (Nokia 770|8x0) ... no 
Checking for DVD support (libdvdnav) ... no 
Creating config.mak
Creating config.h

Config files successfully generated by ./configure --host-cc=gcc --cc=arm-linux-gcc --target=arm-linux --enable-fbdev --enable-static --disable-dvdread --disable-live --disable-mp3lib --enable-mad --disable-win32dll --disable-mencoder --disable-ivtv --disable-dvdnav --disable-dvdread-internal --disable-libdvdcss-internal --enable-libavcodec_a --prefix=/root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install !

  Install prefix: /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install
  Data directory: /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/share/mplayer
  Config direct.: /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/etc/mplayer

  Byte order: little-endian
  Optimizing for: 

  Languages:
    Messages/GUI: en
    Manual pages: en
    Documentation: en

  Enabled optional drivers:
    Input: ftp tv vcd dvb network 
    Codecs: libavcodec(internal) real xanim faad2(internal) libmpeg2(internal) tremor(internal) libmad 
    Audio output: oss v4l2 mpegpes(dvb) 
    Video output: v4l2 pnm mpegpes(dvb) fbdev yuv4mpeg md5sum tga 

  Disabled optional drivers:
    Input: dvdnav vstream pvr radio tv-v4l2 tv-v4l1 tv-dshow librtmp live555 nemesi cddb cdda libdvdcss(internal) dvdread bluray smb 
    Codecs: libvpx libschroedinger libdirac x264 xvid libdv libopencore_amrwb libopencore_amrnb qtx win32 faac musepack libdca liba52 mpg123 mp3lib(internal) libtheora libgsm speex toolame twolame liblzo gif OpenJPEG 
    Audio output: sun alsa openal jack pulse nas esd arts ivtv dxr2 sdl 
    Video output: zr zr2 xmga mga ivtv dxr3 dxr2 matrixview opengl sdl vesa gif89a jpeg svga caca aa ggi xvidix winvidix cvidix 3dfx dga vdpau xvmc xv x11 dfbmga directfb bl xvr100 tdfx_vid wii s3fb tdfxfb 

'config.h' and 'config.mak' contain your configuration options.
Note: If you alter theses files (for instance CFLAGS) MPlayer may no longer
      compile *** DO NOT REPORT BUGS if you tweak these files ***

'make' will now compile MPlayer and 'make install' will install it.
Note: On non-Linux systems you might need to use 'gmake' instead of 'make'.

NOTE: Win32 codec DLLs are not supported on your CPU (arm) or your
operating system (Linux). You may encounter a few files that cannot
be played due to missing open source video/audio codec support.

Check config.log if you wonder why an autodetection failed (make sure
development headers/packages are installed).

NOTE: The --enable-* parameters unconditionally force options on, completely
skipping autodetection. This behavior is unlike what you may be used to from
autoconf-based configure scripts that can decide to override you. This greater
level of control comes at a price. You may have to provide the correct compiler
and linker flags yourself.
If you used one of these options (except --enable-menu and similar ones that
turn on internal features) and experience a compilation or linking failure,
make sure you have passed the necessary compiler/linker flags to configure.

If you suspect a bug, please read DOCS/HTML//bugreports.html.

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# 

注:
--host-cc指的是Linux本地交叉工具链;
--cc指的是Arm板的交叉工具链;
--prefix指的是放置编译安装之后产生的 bin(mplayer可执行文件)、etcsharelib(静态链接库文件) 四个目录的文件夹绝对路径位置

3)准备工作一

查看/MPlayer-1.0rc4/config.mak文件:

vim config.mak

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# vim config.mak

回车后:
进入Vim模式
在这里插入图片描述

然后基于英文输入法按i键,进入插入模式,将内容(不可漏“/lib”目录,该目录才有静态链接文件,否则make失败)添加在“EXTRALIBS”变量值的末端:

-L/root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib

在这里插入图片描述

紧接着按Esc键退出插入模式,基于英文输入法输入:wq!:wq,回车之后,保存且退出Vim模式!

注:

添加的内容与libmad库配置的prefix参数差不多,只是多加了“/lib”,但多的这个目录一定不能漏输,否则make失败!


不做剩下的准备工作(后果很严重),直接make,编译一会儿之后,结果如此:

CC	base64.o
CC	crc.o
CC	des.o
CC	error.o
CC	fifo.o
CC	intfloat_readwrite.o
CC	lfg.o
CC	lls.o
。。。。。
CC	tree.o
CC	utils.o
AR	libavutil.a
make[1]: Leaving directory `/root/mplayer_workstation/MPlayer-1.0rc4/libavutil'
touch libavutil/libavutil.a
make -C libpostproc
make[1]: Entering directory `/root/mplayer_workstation/MPlayer-1.0rc4/libpostproc'
CC	postprocess.o
AR	libpostproc.a
make[1]: Leaving directory `/root/mplayer_workstation/MPlayer-1.0rc4/libpostproc'
touch libpostproc/libpostproc.a
make -C libswscale
make[1]: Entering directory `/root/mplayer_workstation/MPlayer-1.0rc4/libswscale'
CC	options.o
CC	rgb2rgb.o
CC	swscale.o
CC	utils.o
In file included from /home/cqr40_linuxqt_bv3/buildroot-2017.02.3/output/host/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include/inttypes.h:25:0,
                 from utils.c:22:
/home/cqr40_linuxqt_bv3/buildroot-2017.02.3/output/host/usr/arm-buildroot-linux-gnueabihf/sysroot/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
CC	yuv2rgb.o
yuv2rgb.c: In function 'ff_yuv2rgb_c_init_tables':
。。。。。
yuv2rgb.c:833:66: warning: 'abase' may be used uninitialized in this function [-Wmaybe-uninitialized]
             y_table32[i     ] = (yval << rbase) + (needAlpha ? 0 : (255 << abase));
                                                                  ^
AR	libswscale.a
make[1]: Leaving directory `/root/mplayer_workstation/MPlayer-1.0rc4/libswscale'
touch libswscale/libswscale.a
arm-linux-gcc -o mplayer command.o m_property.o mixer.o
mp_fifo.o mplayer.o parser-mpcmd.o input/input.o 
libao2/ao_mpegpes.o libao2/ao_null.o libao2/ao_pcm.o 
libao2/audio_out.o libvo/aspect.o libvo/geometry.o 
libvo/spuenc.o libvo/video_out.o libvo/vo_mpegpes.o 
。。。。。

tremor/floor1.o tremor/framing.o tremor/info.o tremor/mapping0.o tremor/mdct.o tremor/registry.o tremor/res012.o tremor/sharedbook.o tremor/synthesis.o tremor/window.o stream/stream_tv.o stream/tv.o stream/frequencies.o stream/tvi_dummy.o unrar_exec.o stream/stream_vcd.o libmpcodecs/ad_libvorbis.o libmpdemux/demux_ogg.o libmpcodecs/vd_xanim.o libavformat/libavformat.a libavcodec/libavcodec.a libavutil/libavutil.a libpostproc/libpostproc.a libswscale/libswscale.a -ffast-math   -lbz2 -lmad -lpthread -ldl -rdynamic -static -lm -L/root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib 
libmpcodecs/ad_realaud.o: In function `preinit':
ad_realaud.c:(.text+0x1f8): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
libavformat/libavformat.a(tcp.o): In function `tcp_open':
tcp.c:(.text+0x3d8): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
stream/librtsp/rtsp_rtp.o: In function `rtp_setup_and_play':
rtsp_rtp.c:(.text+0x82c): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
stream/tcp.o: In function `connect2Server_with_af':
tcp.c:(.text+0xd4): warning: Using 'gethostbyname2' in statically linked applications requires at runtime 
the shared libraries from the glibc version used for linking
【译为:
tcp.c:(.text+0xd4):警告:在静态链接的应用程序中使用'gethostbyname2'在运行时需要glibc版本中用于链接的共享库
】
root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4#

这个打印确实看不出明显的错误,但是到了“make install”步骤,错误就明显打印出来了:

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# make install
install -d /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/bin /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/etc/mplayer /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/lib
install -m 755 -s mplayer /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/bin
strip: Unable to recognise the format of the input file `/root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/bin/mplayer'
install: strip process terminated abnormally
make: *** [install-mplayer] 错误 1
root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4#

所以剩下准备工作请耐心操作!

4)准备工作二

查看/MPlayer-1.0rc4/libmpeg2/motion_comp_arm_s.S文件:

vim libmpeg2/motion_comp_arm_s.S

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# vim libmpeg2/motion_comp_arm_s.S

回车后:
进入Vim模式
在这里插入图片描述

然后基于英文输入法按i键,进入插入模式,将内容添加在文件最开始处——顶端:

#ifndef HAVE_PLD
.macro pld reg
.endm
#endif

在这里插入图片描述

紧接着按Esc键退出插入模式,基于英文输入法输入:wq!:wq,回车之后,保存且退出Vim模式!

5)准备工作三

查看/MPlayer-1.0rc4/Makefile文件:

vim Makefile

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# vim Makefile

回车后:
进入Vim模式,

因文中资料表示要找到“INSALLSTRIP”变量,还要在“installation”设置范围中添加内容INSTALLSTRIP:= #
在这里插入图片描述

所以,直接输入搜索命令(:g/INSTALLSTRIP)按下回车,进行行末模式,光标会出现在搜索目标的当前行:
在这里插入图片描述
在这里插入图片描述

然后基于英文输入法按i键,进入插入模式,将内容添加installation注释下一行:

INSTALLSTRIP:= #

在这里插入图片描述
在这里插入图片描述

紧接着按Esc键退出插入模式,基于英文输入法输入:wq!:wq,回车之后,保存且退出Vim模式!

6)编译

1】编译、安装

makemake install

打印结果:

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# make
。。。。。
root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# make install
install -d /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/bin /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/etc/mplayer /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/lib
install -m 755  mplayer /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/bin
install -d /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/share/man/man1
install -m 644 DOCS/man/en/mplayer.1 /root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install/share/man/man1/
2】进行查看检查

查看安装之后产生的文件,确定一下:

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# cd mplayer4_install/
root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install# tree
.
├── bin
│   └── mplayer
├── etc
│   └── mplayer
├── lib
└── share
    └── man
        └── man1
            └── mplayer.1
7 directories, 2 files

注:
都到了这个步骤,就不要输入这个指令了:
make distclean

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# make distclean

在这里插入图片描述在这里插入图片描述

因为这个指令,会删除config.mak,但没删除Makefile、libmpeg2/motion_comp_arm_s.S文件,
可是没了config.mak文件,make后会报错!
所以需重新“配置”,生成config.mak文件,然后做准备工作、编译、安装等操作!

root@virtual-machine:~/mplayer_workstation/MPlayer-1.0rc4# make
Makefile:22: config.mak: 没有那个文件或目录
make: *** osdep/: 是一个目录。 停止。

5、测试

1)拷贝

将生成的可执行文件mplayer复制到/home/nfs目录下

在这里插入图片描述
在这里插入图片描述

2)放入Arm开发板

Arm开发板插上电源,开机,用USB转串口线插至主机连接电脑,然后在Windows系统下打开Tera Term辅助软件(虚拟终端):
在这里插入图片描述
连接对应串口COM9
在这里插入图片描述

1】将开发板mnt目录挂载虚拟机的nfs目录

挂载自己虚拟机的Linux系统,可以找到nfs文件夹进行共享:

# mount -t nfs -o nolock,nfsvers=3,vers=3 172.21.x.xxx或198.162.xx.xxx:/home/nfs /mnt
# cd /mnt
# ls
mplayer video.WMV
2】在/usr/bin目录下放入mplayer文件

进入“/usr/bin/”目录,放置mplayer可执行文件:

# cd /usr/bin/
# cp /mnt/mplayer1.0rc4/mplayer mplayer【最后参数表示,拷贝至当前目录,并为拷贝后的文件重命名】# cp /mnt/mplayer1.0rc4/mplayer .【最后参数表示,拷贝至当前目录,名字不变】
3】给予权限

给予该可执行文件一些权限:

# chmod +x mplayer

注:
挂载指令的“172.21.x.xxx”值指的是:虚拟机的IP地址
(用指令“ifconfig”查看虚拟机IP地址)
在这里插入图片描述

若虚拟机对应IP地址错误或者虚拟机没启动Linux系统,就会打印这样的信息:

# mount -t nfs -o nolock,nfsvers=3,vers=3 172.21.x.xxx:/home/nfs /mnt
mount: mounting 172.21.x.xxx:/home/nfs on /mnt failed: No route to host

3)测试

到根目录去,播放对应的视频(例如:mnt/video.WMV【分辨率为500x280】)

# cd /
# mplayer /mnt/video.WMV -zoom -x 720 -y 576
MPlayer 1.0rc2-4.4.1 (C) 2000-2007 MPlayer Team
CPU: ARM

Playing /mnt/video.WMV.
ASF file format detected.
[asfheader] Audio stream found, -aid 1
[asfheader] Video stream found, -vid 2
VIDEO:  [WMV2]  500x280  24bpp  1000.000 fps    0.0 kbps ( 0.0 kbyte/s)
Clip info:
 name: Vending Machine
 author: Rg Animation Studios
 copyright: Rg Animation Studios
 comments: http://www.rgstudios.com/
==========================================================================
Requested video codec family [wmv8] (vfm=dshow) not available.
Enable it at compilation.
Requested video codec family [wmvdmo] (vfm=dmo) not available.
dde [fFegvec audiocr: 16000 Hz, 2 ch, s16le, 20.0 kbit/3.91% (ratio: 2500->64000Selected io codec: [mavafm: fegivu g
                                    ========================AO:o] 0Hzch1e (byperale
   tglaacc: vo nfrues-00 2 (efeed corace:lanar YV1
d tind tcnrspa - trngit-vsce
ening deo fier: cal
Vc: usinPlar 12sut
scS2a7206O:75;:   3.1 A- 340.  1
。。。。。

在这里插入图片描述

注:
指令中的“-zoom”属性:调整画面,加上“-x、-y”属性可使其全屏,若不加,全屏就是视频最大像素——该视频多大尺寸就显示多大尺寸!

4)与Mplayer的Demo结合使用

1】例子

成功的Mplayer例子:

跳转“Mplayer的Demo”CSDN下载 【上面已经下载了安装包,那么Demo也在里面,无需重复下载 】
——是从这篇文章《Linux基于QT的mplayer视频播放器(实现进度条的拖动、播放列表等)》中下载的Demo成功示例
——原文的Demo遇到一些bug,对此修复了一点,写了篇文《QT——Linux(Ubuntu、Arm板Linux)成功播放的Mplayer视频Demo

当然,先在虚拟机Linux执行正常了,再用Arm交叉工具链编译:
qmakemake cleanmake

打印结果:

root@virtual-machine:/qt/MplayerTest# qmake
root@virtual-machine:/qt/MplayerTest# make clean
Makefile:588: 警告:覆盖关于目标“moc_imageview.cpp”的命令
Makefile:568: 警告:忽略关于目标“moc_imageview.cpp”的旧命令
rm -f qrc_images.cpp
rm -f moc_predefs.h
rm -f moc_widget.cpp moc_previewphotos.cpp moc_showphotos.cpp moc_imageview.cpp moc_previewvideos.cpp moc_showvideos.cpp moc_imageview.cpp moc_colorbutton.cpp moc_showmplayer.cpp moc_showtop.cpp moc_showbottom.cpp moc_showmid.cpp
rm -f ui_widget.h ui_previewphotos.h ui_showphotos.h ui_previewvideos.h ui_showvideos.h ui_showmplayer.h ui_showtop.h ui_showbottom.h ui_showmid.h
rm -f main.o widget.o previewphotos.o showphotos.o imageview.o previewvideos.o showvideos.o colorbutton.o showmplayer.o showtop.o showbottom.o showmid.o qrc_images.o moc_widget.o moc_previewphotos.o moc_showphotos.o moc_imageview.o moc_previewvideos.o moc_showvideos.o moc_colorbutton.o moc_showmplayer.o moc_showtop.o moc_showbottom.o moc_showmid.o
rm -f *~ core *.core
root@virtual-machine:/qt/MplayerTest# make 
Makefile:588: 警告:覆盖关于目标“moc_imageview.cpp”的命令
Makefile:568: 警告:忽略关于目标“moc_imageview.cpp”的旧命令
/home/cqr40_linuxqt_bv3/buildroot-2017.02.3/output/host/usr/bin/uic widget.ui -o ui_widget.h
/home/cqr40_linuxqt_bv3/buildroot-2017.02.3/output/host/usr/bin/uic gui/previewphotos.ui -o ui_previewphotos.h
/home/cqr40_linuxqt_bv3/buildroot-2017.02.3/output/host/usr/bin/uic gui/showphotos.ui -o ui_showphotos.h
/home/cqr40_linuxqt_bv3/buildroot-2017.02.3/output/host/usr/bin/uic gui/previewvideos.ui -o ui_previewvideos.h
/home/cqr40_linuxqt_bv3/buildroot-2017.02.3/output/host/usr/bin/uic gui/showvideos.ui -o ui_showvideos.h
/home/cqr40_linuxqt_bv3/buildroot-2017.02.3/output/host/usr/bin/uic gui/showmplayer.ui -o ui_showmplayer.h
/home/cqr40_linuxqt_bv3/buildroot-2017.02.3/output/host/usr/bin/uic gui/showtop.ui -o ui_showtop.h
。。。。。

生成新的Demo可执行文件,放入nfs(与Arm开发板有联系的目录)文件夹中。

2】问题

挂载后,执行Demo文件,播放视频时,发现视频外的程序会闪烁、抖动:
在这里插入图片描述在这里插入图片描述在这里插入图片描述

3】解决

将Mplayerrc4源码中Video_out.c里的
“int vo_doublebuffering = 1;”
改为
“int vo_doublebuffering = 0;”

这个涉及到了“双缓存”概念,设置为零,就不实现双通道缓存,而是单通道缓存,播放只依赖一处缓存,不会依赖两处导致播放暂停时一处缓存不提供数据但另一处缓存提供数据从而让视频出现“彩条-黑背景-透明色”三种颜色抖动闪烁的状况!

4】详细解决过程

同事研究时,看到这篇文得到了启示!
——《MPlayer源代码分析

其实我早就看到过这篇文,无论是百度还是必应、谷歌!
搜索“Mplayer抖动”问题,文章、回答有限(可以说屈指可数),往往会模糊查询——推荐Mplayer相关资料,但是了解源码不是我想要的答案,对类似文章就没往下翻阅!

没想到,答案还真的能在里面找到!!!
在这里插入图片描述
附上图(在文章末尾有这么一段话):
在这里插入图片描述
然后左思右想,
现在思考的问题是:我们的视频在录制时没有出现任何问题,在Windows、Linux、Shell时播放也没有问题!怎么在Mplayer播放就出问题了???
在这里插入图片描述
对,播放器出了问题!
一般播放器工作原理是:数据接收——解复用——解码——视频输出【另一个说法:解协议——解封装——解码视音频——视音频同步】

接下来问题是:问题到底出在哪里?
在这里插入图片描述
问题就出在输出

将视频输出至显示屏,首先,要将解码后的视频数据放入物理内存——page cache缓存,然后从缓存(这就会涉及到显存、“FrameBuffer——fb”)中获取视频数据并在显示屏显示出来【可能读取fb0设备】!

不要问我怎么知道的,,,我只想说,这真的(口吐芬芳.gif)需要细心,需要分析!
在这里插入图片描述

我一直以为是Qt方面导致的问题,试验几次下来,排除了Qt(因为他只是无辜的前端,只是进行简单交互工作,算是第三方,抿心自问——它怎么可能会影响Mplayer呢?),所以,只能是“开发板内核”(我们又没钱没权换开发板,只能研究了,而且换板治标不治本)、“播放器本身”方面导致的问题,因为不想改播放器源码,源码太庞大了,我被吓到了,所以我们都在找“内核”影响播放器方面的问题!
在这里插入图片描述
但研究“内核”也很吃力呀,所以还是要多思考!让思路清晰些!

对,比较下来,Mplayer源码才是相对轻松的!

【使用Source Insight软件可以整个项目搜索】
根据文章给予的启示,发现Video_out.c中有双缓存变量:
在这里插入图片描述
发现确实与许多“vo”开头的文件有关,每个翻阅看了看,主要的是这个文件Vo_fbdev.c,能找到我想要的答案:
在这里插入图片描述
在该文件的config()函数中:
在这里插入图片描述
你细品!!!
fb_page赋值为0,表示去缓存0通道获取数据 (到底是不是这个意思,不重要) ;由于vo_doublebuffering在Video_out.c赋值为1,程序执行到if语句,一定能进去了,这样可以让fb_page赋值为1,在某种情况下会去到缓存1通道获取数据或进行缓存 (到底是不是这个意思,也不重要,重要的是,本来就希望只在一个通道里取数据,方便关闭出口,现在倒好,居然允许双缓存,如果我关掉一个通道,另一个通道到底如何关闭,没人告诉呀!这差不多就是源头了?!!!) ,实现双管道缓存,所以,关闭通道0,通道1却不一定关闭,
按着这样说法,如果视频播放暂停,一处缓存不提供数据,但可能可以通过另一处缓存继续提供数据,让视频出现“彩条-黑背景-透明色”三种颜色转换(你以为只是“黑色-透明色”两种颜色转换?随你怎么认为,最好遇不到,T-T,反正解决方案是一样的),这不就导致视频闪烁、抖动现象了吗?!
在这里插入图片描述
所以,呼~~~~~~~~
让我来个回血!!!
在这里插入图片描述

所以,我讲了那么多,答案却只是需要在Video_out.c中,将vo_doublebuffering的值从1改成0!!!

你懂我的感觉吗?(不想懂?程序猿不为难程序猿了 T_T)
就是这样无奈,两个月时间,原来只需要改一个数字!!!
在这里插入图片描述
不,我要笑看人生、微笑生活!!!
在这里插入图片描述
当然,最后环节就是“感恩”环节:
可以说,这段经历丰富多彩、永生难忘,让我成长了许多、学习了许多,也让我知道了一些道理,然后我非常感谢能让我经历这一切,非常感谢上天@#$¥%&*…以下省略10000字
在这里插入图片描述

6、总结

简言之,步骤为:

① 下载MPlayer-1.0rc4.tar.bz2、libmad-0.15.1b.tar.gz
② 都放在“~/mplayer_workstation目录”下,包分别解压
③ 先配置libmad库
./configure CC=arm-linux-gcc --host=arm-linux --disable-shared --disable-debugging --prefix=/root/mplayer_workstation/libmad-0.15.1b/libmad_install
④ 然后删除libmd目录内的Makefile文件里的“-fforce-mem”内容
⑤ 最后对libmad库make编译、make install安装
⑥ 先配置Mplayer
./configure --host-cc=gcc --cc=arm-linux-gcc --target=arm-linux --enable-fbdev --enable-static --disable-dvdread --disable-live --disable-mp3lib --enable-mad --disable-win32dll --disable-mencoder --disable-ivtv --disable-dvdnav --disable-dvdread-internal --disable-libdvdcss-internal --enable-libavcodec_a --prefix=/root/mplayer_workstation/MPlayer-1.0rc4/mplayer4_install
⑦ 然后

  • 1)确认Mplayer目录的config.mak文件里的EXTRALIBS值是否含有
    “-L/root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib”,
    另外确认AS、CC、CXX值是否为arm-linux-gcc
  • 2)在Mplayer目录的libmpeg2/motion_comp_arm_s.S文件开头添加:

    #ifndef HAVE_PLD
    .macro pld reg
    .endm
    #endif
  • 3)在Mplayer目录的Makefile文件添加:
    “INSTALLSTRIP:=#”

⑧ 最后对Mplayer程序make编译、make install安装
⑨ 测试:
将mplayer可执行文件放入ARM开发板的“/usr/bin”中,
并“chmod +x mplayer”授予权限,
然后“mplayer /mnt/video.mp4”执行MP4视频,播放成功!

注:
mplayer_workstation目录代指主文件夹~下的工作目录;文件夹名可以自定义!

除了播放MP4视频,还可以播放AVI、H264、WMV等格式视频、Mp3等格式音频!

二、MPlayer1.3的安装编译

提示:安装编译大多步骤与Mplayer1.0rc4的安装编译步骤相同,就是配置指令改一下

1.前提

1)安装库包:

MPlayer1.3.0.tar、libmad-0.15.1b.tar.gz

2.配置编译libmad库

与Mplayer1.0rc4的libmad库安装编译步骤类似,
若已安装libmad库,就无需安装编译了,可以直接配置Mplayer1.3:

3.配置编译MPlayer包

1)配置

./configure --host-cc=gcc --cc=arm-linux-gcc --target=arm-linux --target=arm-linux --enable-fbdev --disable-static --disable-dvdread --disable-live --enable-mad --disable-win32dll --disable-mencoder --disable-ivtv --disable-dvdnav --extra-ldflags="-L/root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib" --extra-cflags="-I/root/mplayer_workstation/libmad-0.15.1b/libmad_install/include" --prefix=/root/mplayer_workstation/MPlayer-1.3/MPlayer-1.3.0/mplayer_install

注:
--extra-ldflags指的 libmad库的 链接库文件【lib目录】 所在绝对路径(会自动添加到config.mak文件的“EXTRALIBS”值中,如下图所示);
--extra-cflags指的 libmad库的 libmad头文件(mad.h)【include目录】 所在绝对路径
在这里插入图片描述

--prefix指的是放置编译安装之后产生的 bin(mplayer可执行文件)、etcsharelib(静态链接库文件) 四个目录的文件夹绝对路径位置
--disable-shared参数一定要有,让Mplayer禁用某方面的动态库链接的使用,让编译、安装成功执行!

延伸:
加–disable-shared参数

对此解释一下《为什么一定要加上--disable-shared参数呢?》;

运行make后,打印结果部分信息:

make[1]: Leaving directory `/root/mplayer_workstation/MPlayer-1.3/MPlayer-1.3.0/ffmpeg'
arm-linux-gcc -o mplayer command.o m_property.o mixer.o mp_fifo.o mplayer.o parser-mpcmd.o pnm_loader.o input/input.o libao2/ao_mpegpes.o libao2/ao_null.o libao2/ao_pcm.o 
。。。。。
libmpcodecs/vd_realvid.o stream/cache2.o stream/frequencies.o stream/stream_tv.o stream/tv.o stream/tvi_dummy.o sub/unrar_exec.o stream/stream_vcd.o libmpcodecs/vd_xanim.o osdep/shmem.o ffmpeg/libpostproc/libpostproc.a ffmpeg/libavfilter/libavfilter.a ffmpeg/libavformat/libavformat.a ffmpeg/libavcodec/libavcodec.a ffmpeg/libswscale/libswscale.a ffmpeg/libswresample/libswresample.a ffmpeg/libavutil/libavutil.a -static  -ffast-math   -lrt -lbz2 -lmad -lpthread -ldl -rdynamic -lm -L/root/mplayer_workstation/libmad-0.15.1b/libmad_install/lib 
libmpcodecs/ad_realaud.o: In function `preinit':
ad_realaud.c:(.text+0x1f8): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
ffmpeg/libavformat/libavformat.a(rtpproto.o): In function `rtp_parse_addr_list':
rtpproto.c:(.text+0x62c): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
stream/librtsp/rtsp_rtp.o: In function `rtp_setup_and_play':
rtsp_rtp.c:(.text+0x808): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
stream/tcp.o: In function `connect2Server_with_af':
tcp.c:(.text+0xd8): warning: Using 'gethostbyname2' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
ffmpeg/libavcodec/libavcodec.a(pngdec.o): In function `decode_text_chunk.isra.4':
pngdec.c:(.text+0x1f8): undefined reference to `inflateInit_'
pngdec.c:(.text+0x248): undefined reference to `inflate'
。。。。。
screenpresso.c:(.text+0x80): undefined reference to `uncompress'
ffmpeg/libavcodec/libavcodec.a(tdsc.o): In function `tdsc_decode_frame':
tdsc.c:(.text+0x64): undefined reference to `uncompress'
collect2: error: ld returned 1 exit status
make: *** [mplayer] 错误 1

对,其中出现了报错:

ad_realaud.c:(.text+0x1f8): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
【译为:
在静态链接的应用程序中使用'dlopen'需要在运行时使用用于链接的glibc版本的共享库
】

这就表明:make编译时,会默认、首选调用动态链接库(共享库)文件,但出现报错了,根据问题找解决方案,发现禁用动态库,让编译选择调用静态库,结果成功了——打印信息不出现报错!

动态、静态链接库简单区别

动态链接库,即为共享库:
这种文件只是起一个链接、建桥梁的作用,假设编译make成功,mplayer可执行文件将会是很轻便,文件大小不大,程序体积小!

摘录专业解释:

编译时只对库进行简单的引用而不载入程序,在mplayer程序运行时才将动态库中的代码载入内存使用,因此使用动态库的程序在运行时需要其相关的动态库都存在。
linux中,动态库的命名通常是*.so。

优点:

  • 生成的可执行程序体积小
  • 动态库在内存只加载一次,同时可为多个进程共享,由此会提高一定的效率。

缺点:

  • 依赖库文件,不方便移植

静态链接库:
这种文件,假设编译成功,mplayer可执行文件就会显得笨重,文件蛮大的!

摘录专业解释:

在编译过程中,就将静态库中的代码载入程序,由此生成出的可执行程序在运行中不再需要静态库,但因为库中的程序代码被复制进目标程序中,因此生成的程序体积会比较大。
linux中,静态库的命名规则通常为lib*.a。

优点:

  • 因为将库中代码加载进mplayer程序中,因此运行时省去动态链接加载的过程,带来一定的性能提升。
  • 程序运行可以不依赖于库文件,即便库文件被删除也可以照样运行。

缺点:

  • 生成的可执行程序体积较大
  • 使用静态链接库无法在内存中共享,会造成一定的浪费。

2)编译、安装

先make
再make install

4.测试

生成的可执行文件放入ARM开发板的“/usr/bin”目录,与Mplayer1.0rc4测试步骤类似!


三、除此之外

因为我的是MPlayer1.0rc4版本,安装过程中遇到的错误可能与其他Mplayer版本有所不同,所以这文帮助小伙伴们 范围有限,为此,与一位CSDN小伙伴针对MPlayer1.0rc2版本安装产生的问题进行讨论,遇到的错误在此进行简单补充!

libts

该库在tslib目录下,
将libts库复制到 Arm板上 “/usr/lib” 下

运行qt程序时找不到libts-0.0.so.0,请教如何解决
error while loading shared libraries : libts-0.0.so.0:cannot open shared object file

libid

交叉编译libid3tag-0.15.1b.tar.gz(这个编译要依赖zlib的库)

————————安装libid3tag
#tar -xvf libid3tag-0.15.1b.tar.gz
#cd libid3tag-0.15.1b/
#./configure --host=arm-linux --disable-shared --prefix=/usr/local/arm/4.5.1/lib CC="arm-linux-gcc" --disable-shared  CPPFLAGS="-I/usr/local/arm/4.5.1/lib/include" LDFLAGS="-L/usr/local/arm/4.5.1/lib/lib"
#make CC=arm-linux-gcc
#sudo make CC=arm-linux-gcc

libmad

————————安装libmad-0.15.1b
#cd libmad-0.15.1b
#sudo ./configure --enable-fpm=arm --host=arm-linux --disable-shared --disable-debugging --prefix=/usr/local/libmad CC=/opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc
#sudo make
#sudo make install

总结

两个版本的安装编译,可以得知:

  1. 有两种压缩包——Mplayer、libmad
  2. 放入指定目录中,进行后续操作
  3. 解压后,都要先“configure”配置,然后做“准备工作”,紧接着做“编译安装”
  4. 得到mplayer可执行文件,就放入arm开发板中进行测试
  5. 注意:要给mplayer访问权限
  6. 视频播放成功,放入例子中,出现闪烁、抖动现象,可以修改“Video_out.c”文件的全局变量vo_doublebuffering值为0
  7. 然后重新“config”配置,在config.mak添加部分内容,然后make、make install操作,重复测试操作即可

参考文献:
linux中"cd /" ,“cd ~”,“cd /home”,家目录的区别
Linux中 大写的$PWD 与小写的 pwd 之间的区别 (变量 与 命令 的区别)
Linux中的动态库和静态库(.a.la.so.o)
UNIX再学习 – 静态库与共享库
播放器基本原理(播放四步法)
播放器的基本原理
视频播放器的基本原理
关于–enable-assembler,–enable-static,–enable-shared编译项的研究
嵌入式开发的建议(请查看该文的评论)

  • 12
    点赞
  • 33
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 22
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 22
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Yvette_QIU

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值