要使用最新的Gstreamer,我将使用以下命令构建新版本。
meson --prefix=/media/jai/Entertainment/Software/gstreamer/gst-build-installed --reconfigure build/
ninja -C build/
meson install -C build/
我必须在Cmakelist.txt和package.xml中进行什么更改才能链接此Gstreamer?
我已经尝试了以下更改。但是到现在为止还没有运气。
Cmakelist.txt] >>
cmake_minimum_required(VERSION 2.8.3) project(mypkg) find_package(catkin REQUIRED COMPONENTS roscpp sensor_msgs std_msgs ) SET(ENV{PKG_CONFIG_PATH} "/media/jai/Entertainment/Software/gstreamer/gst-build-installed/lib/x86_64-linux-gnu/pkgconfig" $ENV{PKG_CONFIG_PATH}) SET(ENV{LD_LIBRARY_PATH} "/media/jai/Entertainment/Software/gstreamer/gst-build-installed/lib/x86_64-linux-gnu" $ENV{LD_LIBRARY_PATH}) find_package(PkgConfig REQUIRED) pkg_check_modules(GST1.0 REQUIRED gstreamer-1.0) find_package(Boost REQUIRED COMPONENTS thread) catkin_package( CATKIN_DEPENDS roscpp sensor_msgs std_msgs DEPENDS Boost GST1.0 INCLUDE_DIRS include LIBRARIES mypkg ) include_directories(include ${catkin_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${GST1.0_INCLUDE_DIRS}) add_executable(mypkg src/main.cpp) add_dependencies(mypkg ${catkin_EXPORTED_TARGETS}) target_link_libraries(mypkg ${catkin_LIBRARIES} ${GST1.0_LIBRARIES} ${Boost_LIBRARIES}) install(TARGETS mypkg DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
package.xml
<?xml version="1.0"?> <package format="2"> <name>mypkg</name> <version>0.1.0</version> <description>Description</description> <maintainer email="[email protected]">jai</maintainer> <license>Apache 2.0</license> <buildtool_depend>catkin</buildtool_depend> <build_depend>roscpp</build_depend> <build_depend>std_msgs</build_depend> <build_depend>sensor_msgs</build_depend> <build_depend>pkg-config</build_depend> <build_export_depend>roscpp</build_export_depend> <build_export_depend>std_msgs</build_export_depend> <build_export_depend>sensor_msgs</build_export_depend> <build_export_depend>boost</build_export_depend> <exec_depend>roscpp</exec_depend> <exec_depend>std_msgs</exec_depend> <exec_depend>sensor_msgs</exec_depend> <exec_depend>pkg-config</exec_depend> <export> </export> </package>
main.cpp
输出: jai @ jai:〜$ rosrun gstreamer gstreamer#include "ros/ros.h" #include <sensor_msgs/CompressedImage.h> #include "thread" #include <boost/thread.hpp> extern "C"{ #include <gst/gst.h> #include <gst/app/gstappsink.h> } int main(int argc, char **argv) { ros::init(argc, argv, "gstreamer"); gst_init(&argc, &argv); g_print ("**\nGstreamer version: %s\n**\n", gst_version_string ()); ros::spin(); }
经过以上所有修改,程序包仍在使用stock gstreamer而不是新的gstreamer。
************************************ Gstreamer version: GStreamer 1.8.3 ************************************ libva info: VA-API version 0.39.4 libva info: va_getDriverName() returns 0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so libva info: Found init function __vaDriverInit_0_39 libva info: va_openDriver() returns 0
我认为它可能能够访问包含文件,但不能访问LIBS。
要使用最新的Gstreamer,我将使用以下命令构建新版本。介子--prefix = / media / jai / Entertainment / Software / gstreamer / gst-build-installed --reconfigure build / ninja -C build / ...
我认为您在设置PKG_CONFIG_PATH时需要使用: