1
我有一個應用程序正在讀取一個電影文件,並且我想在到達流末尾時重置流到其初始位置。如何通過GMainLoop訪問管道?
所以我已經得到了以往的結構,我添加了一個總線觀看事件
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_watch (bus, bus_call, loop);
gst_object_unref (bus);
這裏是bus_call功能
static gboolean bus_call (GstBus *bus,
GstMessage *msg,
gpointer data)
{
GMainLoop *loop = (GMainLoop *) data;
switch (GST_MESSAGE_TYPE (msg))
{
case GST_MESSAGE_EOS:
g_print ("End of stream\n");
g_main_loop_quit (loop);
break;
default:
break;
}
return TRUE;
}
左右的snipet現在,當我到達流的結束我剛剛退出循環。 我可以通過循環訪問我的管道嗎? 感謝您的閱讀,請讓我知道如果我試圖做一些不可能的事
ps:我想避免將我的管道設置爲全局變量,或傳遞給bus_call包含我的管道和循環的結構,因爲它感覺不對。