带有 Gstreamer 的 RTSP 服务器

问题描述 投票:0回答:1

我正在尝试在 Visual Studio 中使用 GStreamer 构建 RTSP 服务器,但遇到一些错误。

错误 LNK2019:函数 main 中引用了无法解析的外部符号 __imp_gst_rtsp_media_factory_new 错误 LNK2019:函数 main 中引用的无法解析的外部符号 __imp_gst_rtsp_media_factory_set_launch 错误 LNK2019:函数 main 中引用的无法解析的外部符号 __imp_gst_rtsp_mount_points_add_factory 错误 LNK2019:函数 main 中引用了无法解析的外部符号 __imp_gst_rtsp_server_new 错误 LNK2019:函数 main 中引用的无法解析的外部符号 __imp_gst_rtsp_server_get_mount_points 错误 LNK2019:函数 main 中引用了无法解析的外部符号 __imp_gst_rtsp_server_attach

这是我正在尝试构建的代码

#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>

int main(int argc, char* argv[])
{
    gst_init(&argc, &argv);

    // Create the RTSP server
    GstRTSPServer* server = gst_rtsp_server_new();

    // Get the mount points for the server
    GstRTSPMountPoints* mounts = gst_rtsp_server_get_mount_points(server);

    // Create the RTSP media factory
    GstRTSPMediaFactory* factory = gst_rtsp_media_factory_new();

    // Set the launch string for the media factory
    gst_rtsp_media_factory_set_launch(factory, "uridecodebin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm ! videoconvert ! x264enc ! rtph264pay name=pay0");

    // Mount the factory to the "/test" path
    gst_rtsp_mount_points_add_factory(mounts, "/test", factory);

    // Release the reference to the mounts
    g_object_unref(mounts);

    // Attach the server to a specific port
    int port = 8554; // Choose the desired port number
    gchar* address = "192.168.0.100"; // Set the desired IP address or "0.0.0.0" for any address
    gst_rtsp_server_attach(server, NULL, port, &address);

    // Start the main loop
    GMainLoop* loop = g_main_loop_new(NULL, FALSE);
    g_main_loop_run(loop);

    // Clean up
    g_main_loop_unref(loop);
    gst_object_unref(server);

    return 0;
}

我按照此问题中提供的步骤在 Visual Studio 中配置 gstreamer 如何配置 Visual Studio 2017 来运行 Gstreamer 教程?我能够构建并运行教程,但我仍然不知道缺少什么或者如何解决问题

c++ visual-studio gstreamer
1个回答
0
投票

根据链接,没有添加gstrtspserver-1.0.lib。您需要在 Linker->Input 中添加它

© www.soinside.com 2019 - 2024. All rights reserved.