1. 安裝 buildroot
a. 安裝 buildroot,安裝過程可參考此篇 。
b. 執行下列指令,試試 buildroot 建立的image是否正確。
2. 編譯 gstreamer$ cd output/images
$ QEMU_AUDIO_DRV=alsa qemu-system-arm -kernel zImage \ -M vexpress-a9 -m 512 -drive file=rootfs.ext2,if=sd,format=raw \ -dtb ./vexpress-v2p-ca9.dtb \ --append "root=/dev/mmcblk0 console=ttyAMA0,115200" -nographic
a. 設定 gstreamer 選項,再次編譯
$ cd buildroot/buildroot-2017.11
$ make menuconfig
b. ToolChain 設定修改成 glib
Toolchain -> C library -> glibc
c. 選擇 gstreamer
Target packages -> Audio and video applications -> gstreamer 1.x
為了方便使用,建議開啟 gst1-libav, gst1-rtsp-serve
另外 gst1-plugins-base, gst1-plugins-good 也要選擇自己需要的,例如選擇rtsp, alsa, souphttpsrc, videoconvert
d. 重新編譯
$ make clean;make
e. Test Gstreamer
$ QEMU_AUDIO_DRV=alsa qemu-system-arm -kernel zImage \ -M vexpress-a9 -m 512 -drive file=rootfs.ext2,if=sd,format=raw \ -dtb ./vexpress-v2p-ca9.dtb \ --append "root=/dev/mmcblk0 console=ttyAMA0,115200" -nographic
$ gst-launch-1.0 -v fakesrc num_buffers=5 ! fakesink
輸出結果如下:到達此步驟,表示編譯成功。
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.003942000
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
Setting pipeline to PAUSED ...
若是剛剛編譯有加入 souphttpsrc則可以試試此命令
3. 編譯成功後,若要在嵌入式平台上使用,則要注意相關 library 是否都已存在於平台內。$ gst-launch-1.0 souphttpsrc is-live=true location=http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8 ! hlsdemux ! decodebin ! videorate ! videoconvert ! ximagesink
$ arm-linux-gnueabihf-readelf -d ./gst-launch-1.0參考資料:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libgstreamer-1.0.so.0]
0x00000001 (NEEDED) Shared library: [libgobject-2.0.so.0]
0x00000001 (NEEDED) Shared library: [libgmodule-2.0.so.0]
0x00000001 (NEEDED) Shared library: [libglib-2.0.so.0]
0x00000001 (NEEDED) Shared library: [librt.so.1]
0x00000001 (NEEDED) Shared library: [libdl.so.2]
0x00000001 (NEEDED) Shared library: [libpthread.so.0]
0x00000001 (NEEDED) Shared library: [libc.so.6]
- API用法
- 測試範例