修改gmediarender对于ffmpeg的依赖库

来源:互联网 发布:ubuntu 优麒麟 编辑:程序博客网 时间:2024/06/05 17:12
在openwrt中移植了gmediarender,同时也配置了libffmpeg-custom。
libffmpeg-custom中包含了以下库:
define Package/libffmpeg-custom/install
 $(INSTALL_DIR) $(1)/usr/lib
 $(STRIP) $(PKG_INSTALL_DIR)/usr/lib/lib{swresample,avfilter,avdevice,avformat,avcodec,avutil}.so.*
 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{swresample,avfilter,avdevice,avformat,avcodec,avutil}.so.* $(1)/usr/lib/
endef

裁剪掉了ffmpeg中的 libpostproc、libswscale、libavresample三个库。而Libffmpeg-full则包含了ffmpeg的所有库。

根据gmediarender的makefile可以看出,gmediarender依赖于Libffmpeg-full 库。此时,将gmediarender修改为依赖于库libffmpeg-custom。如下:
define Package/gmediarender
  SECTION:=multimedia
  CATEGORY:=Multimedia
#  DEPENDS:=+libffmpeg-full +libupnp
 DEPENDS:=+libffmpeg-custom +libupnp
  TITLE:=A Headless UPnP Renderer
endef

修改gmediarendermakefile,使其依赖于libffmpeg-custom,而不是libffmpeg-full。编译后出现以下问题:

Package gmediarender is missing dependencies for the following libraries:

libswscale.so.4

说明gmediarender依赖于libswscale库。而gmediarender现在依赖的libffmpeg-custom已经把Libswscale库去掉了,所以会报这个错。可以查看,gmediarender在哪里填写了需要libswscale库。


查找openwrt/package/gmediarender下的makefile,里面并没有涉及到Libswscale;查看gmediarender源码中makefile,发现源码中并没有makefile文件,只有configure.ac与makefile.am文件,说明gmediarender的源码makefile文件,是由configure.ac自动产生的,即gmediarender是通过源码中的configure.ac文件生成configure,再通过configure 产生makefile.


源码里的configure.ac文件拷贝到编译路径(build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/)进行编译 ,所以需要修改源码里的configure.ac而不是编译路径里的configure.ac。

查看gmediarender源码里的configure.ac,可以看到有

PKG_CHECK_MODULES(LIBFFMPEG, libavdevice libavformat libavfilter libavcodec libswresample libswscale libavutil, HAVE_LIBFFMPEG=yes, HAVE_LIBFFMPEG=no),

说明这里定义的LIBFFMEPG中包含了libswscale库。这样在编译路径中产生的makefile中就包含了Libswscale:

LIBFFMPEG_CFLAGS = -I/home/yangjie/wifi-project/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include
LIBFFMPEG_LIBS = -L/home/yangjie/wifi-project/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lswscale -lavutil.


修改openwrt/package/gmediarender中的configure.ac,去掉libswscale

PKG_CHECK_MODULES(LIBFFMPEG, libavdevice libavformat libavfilter libavcodec libswresample libavutil, HAVE_LIBFFMPEG=yes, HAVE_LIBFFMPEG=no)

再编译,则在编译路径下产生的makefile中则不包含libswscale

LIBFFMPEG_CFLAGS = -I/home/yangjie/wifi-project/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/include
LIBFFMPEG_LIBS = -L/home/yangjie/wifi-project/openwrt_widora/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/usr/lib -lavdevice -lavformat -lavfilter -lavcodec -lswresample -lavutil

再编译openwrt,此时gmediarender编译通过,且不包含libswscale了。


附:

openwrt中移植相关程序,则包含两个makefile。

一个openwrt的,一个对应程序源码的。

其中,openwrt的makefile,基本上有相关的格式,这个可以查看 http://blog.csdn.net/teddy99999/article/details/17203501 (openwrt 添加模块(一)Makefile和config.in),包含程序源码地址来源、程序在menuconfig中的配置情况、是否有配置子目录、程序依赖库以及程序安装情况。

第二个makefile,对应于源码编译相关。这部分有待深入研究。涉及到autoconfig\automake、configure.ac\makefile.am相关知识。


(此次,gmediarender中,依赖于库libswscale。而openwrt的gmediarender的makefile中,并没有相关libswscale链接;所以查看gmediarender源码中makefile是否有libswscale链接,源码makefile又涉及到configure.ac相关,如此查找下去进行定位与修改。)






0 0