Visual Studio 带有Gstreamer的RTSP服务器

oprakyz7  于 2023-10-23  发布在  其他
关注(0)|答案(1)|浏览(207)

我尝试在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
这是我试图构建的代码

  1. #include <gst/gst.h>
  2. #include <gst/rtsp-server/rtsp-server.h>
  3. int main(int argc, char* argv[])
  4. {
  5. gst_init(&argc, &argv);
  6. // Create the RTSP server
  7. GstRTSPServer* server = gst_rtsp_server_new();
  8. // Get the mount points for the server
  9. GstRTSPMountPoints* mounts = gst_rtsp_server_get_mount_points(server);
  10. // Create the RTSP media factory
  11. GstRTSPMediaFactory* factory = gst_rtsp_media_factory_new();
  12. // Set the launch string for the media factory
  13. 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");
  14. // Mount the factory to the "/test" path
  15. gst_rtsp_mount_points_add_factory(mounts, "/test", factory);
  16. // Release the reference to the mounts
  17. g_object_unref(mounts);
  18. // Attach the server to a specific port
  19. int port = 8554; // Choose the desired port number
  20. gchar* address = "192.168.0.100"; // Set the desired IP address or "0.0.0.0" for any address
  21. gst_rtsp_server_attach(server, NULL, port, &address);
  22. // Start the main loop
  23. GMainLoop* loop = g_main_loop_new(NULL, FALSE);
  24. g_main_loop_run(loop);
  25. // Clean up
  26. g_main_loop_unref(loop);
  27. gst_object_unref(server);
  28. return 0;
  29. }

我按照这个问题中提供的步骤在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中。

相关问题