[英]Gstreamer rtsp server linking in Qt Creator
I've installed Gstreamer sdk and trying to compile this code: 我已经安装了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;
}
I am having the same error like this question , 我遇到了像这个问题一样的错误,
In function `main':
在函数`main'中:
test-launch01.c:(.text+0x64): undefined reference to
test-launch01.c :(。text + 0x64):未定义引用
`gst_rtsp_server_new' test-launch01.c:(.text+0x74): undefined
`gst_rtsp_server_new'test-launch01.c :(。text + 0x74):undefined
reference to `gst_rtsp_server_get_media_mapping'
引用`gst_rtsp_server_get_media_mapping'
test-launch01.c:(.text+0x7d): undefined reference to
test-launch01.c :(。text + 0x7d):未定义引用
`gst_rtsp_media_factory_new' test-launch01.c:(.text+0x95): undefined
`gst_rtsp_media_factory_new'test-launch01.c :(。text + 0x95):undefined
reference to `gst_rtsp_media_factory_set_shared'
对'gst_rtsp_media_factory_set_shared'的引用
test-launch01.c:(.text+0xad): undefined reference to
test-launch01.c :(。text + 0xad):未定义的引用
`gst_rtsp_media_factory_set_launch' test-launch01.c:(.text+0xc9):
`gst_rtsp_media_factory_set_launch'test-launch01.c :(。text + 0xc9):
undefined reference to `gst_rtsp_media_mapping_add_factory'
对'gst_rtsp_media_mapping_add_factory'的未定义引用
test-launch01.c:(.text+0xe9): undefined reference to
test-launch01.c :(。text + 0xe9):未定义引用
`gst_rtsp_server_attach' collect2: ld returned 1 exit status
`gst_rtsp_server_attach'collect2:ld返回1退出状态
I am using Qt Creator and here is my .pro file: 我正在使用Qt Creator,这是我的.pro文件:
QT += core
QT + =核心
QT -= gui
QT - = gui
TARGET = gstreamer CONFIG += console CONFIG -= app_bundle
TARGET = gstreamer CONFIG + = console CONFIG - = app_bundle
CONFIG+=link_pkgconfig
CONFIG + = link_pkgconfig
PKGCONFIG += gstreamer-0.10
PKGCONFIG + = gstreamer-0.10
TEMPLATE = app
TEMPLATE = app
SOURCES += main.cpp
来源+ = main.cpp
INCLUDEPATH += /home/kato/ew-gst-sdk-linux-x86_64-2012.03-0/include/gstreamer-0.10
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
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
LIBS + = -L / home / kato / ew-gst-sdk-linux-x86_64-2012.03-0 / lib \\ -lgstreamer-0.10 \\ -lgstrtsp-0.10
Am linking to pkg-config gstreamer-rtsp-0.10 --libs
correctly ?? 我正确链接到
pkg-config gstreamer-rtsp-0.10 --libs
??
I got the same errors. 我得到了同样的错误。
My .pro file is : 我的.pro文件是:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Gestion_Flux_Video
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
streaming.cpp
HEADERS += mainwindow.h \
streaming.h
FORMS += mainwindow.ui
INCLUDEPATH += /opt/gstreamer-sdk/include \
/opt/gstreamer-sdk/include/gstreamer-0.10 \
/opt/gstreamer-sdk/lib/glib-2.0/include \
/opt/gstreamer-sdk/include/glib-2.0 \
/opt/gstreamer-sdk/include/libxml2
LIBS += -L/opt/gstreamer-sdk/lib -lglib-2.0 \
-lgstreamer-0.10 \
-lgobject-2.0 \
-lgtk-x11-2.0 \
-lgstrtsp-0.10 \
-lgstapp-0.10 \
-L/opt/gstreamer-sdk/include/gstreamer-0.10/gst/rtsp-server -lgstrtspserver-0.10
And the compilation works fine for me. 编译对我来说很好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.