GStreamer官方提供了一種基于非安裝版本的GStreamer進行開發(fā)的方式,可以在不影響當前linux系統(tǒng)中安裝版本的情況下,方便的基于最新版本的源碼進行修改,調試和開發(fā)。
配置該環(huán)境的方法也很簡單:
首先,下載安裝GStreamer core及plugins依賴的包,以Ubuntu為例:
$ sudo apt-get build-dep gstreamer1.0-plugins-{base,good,bad,ugly}這樣會下載安裝很多的包,也可以根據(jù)自己的開發(fā)需求選擇性的下載。或者可以先跳過這一步,在后面編譯GStreamer代碼的時候,針對特定plugin的依賴進行下載。(使用autogen.sh配置編譯時,會提示每個plugin依賴的包)
然后,下載并執(zhí)行create-uninstalled-setup.sh腳本(clone代碼需要等待一段時間):
$ cd$ curl https://cgit.freedesktop.org/gstreamer/gstreamer/plain/scripts/create-uninstalled-setup.sh | sh執(zhí)行腳本自動會自動創(chuàng)建相關目錄并使用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的源碼已經下載完成,并且輸出信息已經給出了后續(xù)的操作方法:
===========================================================================================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===========================================================================================按照提示,執(zhí)行gst-master配置gst-uninstalled的環(huán)境
$ cd /home/user/gst$ ./gst-master檢測環(huán)境配置:
$ printenv | grep GST可以發(fā)現(xiàn) GST_PLUGIN_PATH等環(huán)境變量已經被設置到/home/user/gst/master/…相關目錄下了,這樣使用GStreamer命令行工具,以及代碼執(zhí)行時使用到的plugins都是在該路徑下的,而不是使用系統(tǒng)中安裝的版本了。
接下來,可以以此進入各模塊源代碼目錄進行編譯了。比如編譯GStreamer core代碼:
$ cd /home/user/gst/master/gstreamer/$ ./autogen.sh$ make如果編譯過程中提示缺少依賴包,根據(jù)提示下載即可。編譯完成后,可以看到GStreamer相關命令工具已經開始使用剛才編譯的版本了。
$ which gst-launch-1.0/home/user/gst/master/gstreamer/tools/gst-launch-1.0使用該方法時,每次進入終端都需要重新執(zhí)行一次gst-master腳本工具,取消環(huán)境配置是執(zhí)行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/
新聞熱點
疑難解答