gstreamer目前有cerbora和meson两种编译方式,meson是gstreamer现在合并到一个git仓库后用的编译方式,编译参考另外一篇:使用meson编译gstreamer
step 1:进入gstreamer devenv
使用meson编译gstreamer后,gstreamer的库分布在不同的目录,如果要通过qtcreator调试,通过devenv进入dev环境:
$ ninja -C build/ devenv
ninja: Entering directory `build/'
[0/1] Running external command devenv (wrapped by meson to set env)
这时候,环境变量都被设置好了,找到gstreamer运行需要的环境变量,在这里,配置了四个,包括GST_PLUGIN_PATH,LD_LIBRARY_PATH,GST_PLUGIN_SCANNER,GST_REGISTRY。
step 2:获取GST相关环境变量
$ env | grep GST
GST_PLUGIN_SYSTEM_PATH=
GST_PLUGIN_PATH=/home/hui/
GST_REGISTRY=/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/build/registry.dat
GST_ENCODING_TARGET_PATH=/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/subprojects/gst-plugins-bad/data/targets
GST_PLUGIN_SCANNER=/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/build/subprojects/gstreamer/libs/gst/helpers/gst-plugin-scanner
GST_PRESET_PATH=/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/subprojects/gst-plugins-ugly/ext/x264:/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/subprojects/gst-plugins-good/gst/isomp4:/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/subprojects/gst-plugins-good/gst/equalizer:/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/subprojects/gst-plugins-bad/gst/freeverb
step 3:获取LD_LIBRARY_PATH环境变量
$ env | grep LD_
LD_LIBRARY_PATH=/home/hui/
step 4:导入代码到qtcreator
project name自己写一个就行,Location选择代码路径然后open,选择next->finish就可以了
/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/subprojects
进入qtcreator主界面,删掉Build directory,build相关的都不需要,直接用gstreamer原始的meson build就可以
进入Run标签页
step 5:配置Run三项
Executable:
/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/build/subprojects/gstreamer/tools/gst-launch-1.0
Command line arguments:
playbin uri=file:///home/hui/hbc9_h264.avi
Working directory:
/home/hui/disk4t/codes/gstreamer/gst-open-source/gstreamer-meson/
环境变量配置为前面找到的环境变量值
GST_PLUGIN_PATH
GST_PLUGIN_SCANNER
GST_REGISTRY
LD_LIBRARY_PATH
配置好后如下
然后在需要的地方设置断点,F5就可以进入debug模式了。
step 6:进入debug模式
上个效果图
|