Visual Studio 带有Gstreamer的RTSP服务器

oprakyz7  于 8个月前  发布在  其他
关注(0)|答案(1)|浏览(120)

我尝试在Visual Studio中使用GStreamer构建RTSP服务器,但遇到了一些错误。
错误LNK2019:函数主错误LNK 2019中引用的未解析外部符号__imp_gst_rtsp_media_factory_new:函数主错误LNK 2019中引用的未解析外部符号__imp_gst_rtsp_media_factory_set_launch:函数主错误LNK 2019中引用的未解析外部符号__imp_gst_rtsp_mount_points_add_factory:函数主错误LNK 2019中引用的未解析外部符号__imp_gst_rtsp_server_new:函数主错误LNK 2019中引用的未解析外部符号__imp_gst_rtsp_server_get_mount_points:函数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 How do I configure Visual Studio 2017 to run Gstreamer tutorials?中配置gstreamer,我能够构建和运行教程,但我仍然不知道缺少什么或如何解决问题

vwhgwdsa

vwhgwdsa1#

根据上面的链接,没有添加gstrtspserver-1.0.lib。您需要在Linker->Input中添加它。
要运行该程序,需要将gstreamer\<version>\msvc_x86_64\bin文件夹添加到系统环境变量PATH中。

相关问题