首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Qt Creator中的Gstreamer rtsp服务器链接

Qt Creator中的Gstreamer rtsp服务器链接
EN

Stack Overflow用户
提问于 2013-02-15 22:14:05
回答 1查看 3.6K关注 0票数 0

我安装了Gstreamer并试图编译以下代码:

代码语言:javascript
复制
#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;
}

我和this question有同样的错误,

在函数main': test-launch01.c:(.text+0x64): undefined reference togst_rtsp_server_new的测试-Launch01.c:(.text+0x74):未定义 引用gst\_rtsp\_server\_get\_media\_mapping' test-launch01.c:(.text+0x7d): undefined reference togst_rtsp_media_factory_new的test-launch01.c:(.text+0x95):未定义 参考gst\_rtsp\_media\_factory\_set\_shared' test-launch01.c:(.text+0xad): undefined reference togst_rtsp_media_factory_set_launch‘测试-Launch01.c:(.text+0xc9): 对gst\_rtsp\_media\_mapping\_add\_factory' test-launch01.c:(.text+0xe9): undefined reference togst_rtsp_server_attach‘collect2的未定义引用: ld返回了1个退出状态

我正在使用,下面是我的.pro文件:

QT +=核 QT -= gui +=控制台配置-= app_bundle CONFIG+=link_pkgconfig PKGCONFIG += gstreamer-0.10 TEMPLATE = app 源+= main.cpp /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/ += /usr/include/libxml2 2 LIBS += +=\-lgstreamer 0.10\ -lgstrtsp-0.10

是否正确链接到pkg-config gstreamer-rtsp-0.10 --libs ??

我也犯了同样的错误。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-17 07:57:52

我的.pro文件是:

代码语言:javascript
复制
    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

这份汇编对我来说很好。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14904246

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档