我已经安装了 Gstreamer sdk 并尝试编译此代码:
#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>
int main (int argc, char *argv[])
{
GMainLoop *loop;
GstRTSPServer *server;
GstRTSPMediaMapping *mapping;
GstRTSPMediaFactory *factory;
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
server = gst_rtsp_server_new ();
mapping = gst_rtsp_server_get_media_mapping (server);
factory = gst_rtsp_media_factory_new ();
gst_rtsp_media_factory_set_launch (factory,
"( videotestsrc is-live=1 ! x264enc ! rtph264pay )");
gst_rtsp_media_factory_set_shared (factory, TRUE);
gst_rtsp_media_mapping_add_factory (mapping, "/test", factory);
g_object_unref (mapping);
gst_rtsp_server_attach (server, NULL);
g_main_loop_run (loop);
return 0;
}
我遇到了像这个问题一样的错误,
在函数“主”中:
test-launch01.c:(.text+0x64): 未定义的引用
`gst_rtsp_server_new' test-launch01.c:(.text+0x74): 未定义
参考`gst_rtsp_server_get_media_mapping'
test-launch01.c:(.text+0x7d): 未定义的引用
`gst_rtsp_media_factory_new' test-launch01.c:(.text+0x95): 未定义
参考`gst_rtsp_media_factory_set_shared'
test-launch01.c:(.text+0xad): 未定义的引用
`gst_rtsp_media_factory_set_launch' test-launch01.c:(.text+0xc9):
未定义对“gst_rtsp_media_mapping_add_factory”的引用
test-launch01.c:(.text+0xe9): 未定义的引用
`gst_rtsp_server_attach' collect2: ld 返回 1 个退出状态
我正在使用 Qt Creator,这是我的 .pro 文件:
QT += 核心
QT -= gui
目标 = gstreamer 配置 += 控制台配置 -= app_bundle
CONFIG+=link_pkgconfig
PKGCONFIG += gstreamer-0.10
模板 = 应用程序
来源 += main.cpp
INCLUDEPATH += /home/kato/ew-gst-sdk-linux-x86_64-2012.03-0/include/gstreamer-0.10
INCLUDEPATH += /usr/include/glib-2.0 INCLUDEPATH += /usr/lib/x86_64-linux-gnu/glib-2.0/include INCLUDEPATH += /usr/include/libxml2
LIBS += -L/home/kato/ew-gst-sdk-linux-x86_64-2012.03-0/lib \ -lgstreamer-0.10 \ -lgstrtsp-0.10
链接pkg-config gstreamer-rtsp-0.10 --libs
正确吗??
我得到了同样的错误。