GStreamer官方提供了一种基于非安装版本的GStreamer进行开发的方式,可以在不影响当前linux系统中安装版本的情况下,方便的基于最新版本的源码进行修改,调试和开发。
配置该环境的方法也很简单:
首先,下载安装GStreamer core及plugins依赖的包,以Ubuntu为例:
$ sudo apt-get build-dep gstreamer1.0-plugins-{base,good,bad,ugly}这样会下载安装很多的包,也可以根据自己的开发需求选择性的下载。或者可以先跳过这一步,在后面编译GStreamer代码的时候,针对特定plugin的依赖进行下载。(使用autogen.sh配置编译时,会提示每个plugin依赖的包)
然后,下载并执行create-uninstalled-setup.sh脚本(clone代码需要等待一段时间):
$ cd$ curl https://cgit.freedesktop.org/gstreamer/gstreamer/plain/scripts/create-uninstalled-setup.sh | sh执行脚本自动会自动创建相关目录并使用git下载最新的GStreamer源码,完成之后,目录结构如下:
$ cd /home/user/gst$ tree -L 2.├── gst-master -> master/gstreamer/scripts/gst-uninstalled└── master ├── gst-libav ├── gst-plugins-bad ├── gst-plugins-base ├── gst-plugins-good ├── gst-plugins-ugly ├── gstreamer └── PRefix可以看出core和plugins的源码已经下载完成,并且输出信息已经给出了后续的操作方法:
===========================================================================================Done. Created new GStreamer uninstalled environment for branch master in /home/user/gstTo enter the uninstalled environment do: cd /home/user/gst; ./gst-masterTo leave the uninstalled environment do: exitTo check the uninstalled environment do: printenv | grep GST (loads of output = you're in the uninstalled environment)===========================================================================================Now compile all GStreamer modules one by one by first switching intothe uninstalled environment and then doing: cd <MODULE>; ./autogen.sh; makeFirst gstreamer, then gst-plugins-base, then the other modules.You do not need to do 'make install'===========================================================================================If your system GLib is too old, you can install a newer versioninto --prefix=/home/user/gst/master/prefix and it should be picked upby autogen.sh/configure===========================================================================================按照提示,执行gst-master配置gst-uninstalled的环境
$ cd /home/user/gst$ ./gst-master检测环境配置:
$ printenv | grep GST可以发现 GST_PLUGIN_PATH等环境变量已经被设置到/home/user/gst/master/…相关目录下了,这样使用GStreamer命令行工具,以及代码执行时使用到的plugins都是在该路径下的,而不是使用系统中安装的版本了。
接下来,可以以此进入各模块源代码目录进行编译了。比如编译GStreamer core代码:
$ cd /home/user/gst/master/gstreamer/$ ./autogen.sh$ make如果编译过程中提示缺少依赖包,根据提示下载即可。编译完成后,可以看到GStreamer相关命令工具已经开始使用刚才编译的版本了。
$ which gst-launch-1.0/home/user/gst/master/gstreamer/tools/gst-launch-1.0使用该方法时,每次进入终端都需要重新执行一次gst-master脚本工具,取消环境配置是执行exit命令即可。
参考: https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/developing.html#how-do-i-develop-against-an-uninstalled-gstreamer-copy- https://arunraghavan.net/2014/07/quick-start-guide-to-gst-uninstalled-1-x/
新闻热点
疑难解答