我正在尝试通过线程中的 gst-rtsp-server 通过一些视频文件进行流式传输。我试图了解 gst-rtsp-server lib 的使用是否需要使用 GMainLoop。例如,您应该采用的框架如下:
GMainLoop *loop;
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
// do whatever u need
// create and set rtsp server, mount point
// connect signal and create callback
// ..........
g_main_loop_run (loop);
或者你不能使用 GMainLoop 吗?了解在 Gstreamer 中,使用 GMainLoop 和 g_main_loop_run() 不是必须的,而是为了方便起见,即您可以编写类似的代码
int main()
{
// do whatever u need
// create and set rtsp server, mount point
// connect signal and create callback
// ..........
while(1)
{
//wait for event and respond accordingly
}
}
额外的查询,您是否还需要创建一个新的 GMainContext 并为此线程设置?我不太熟悉 Glib 和 Gobject 的编码
谢谢