GstMultifilesink消息后回调 [英] GstMultifilesink post-messages callback
问题描述
我想知道如何使用post-messages = TRUE属性从gstreamer multifilesink元素获取回调?在下面的代码中,永远不会调用my_bus_callback函数.
I would like to know how to get a callback from the gstreamer multifilesink element using post-messages=TRUE property? In the code below my_bus_callback function is never called.
Multifilesink文档说:如果"post-messages"属性为TRUE,则在写入每个缓冲区后会发送名为"GstMultiFileSink"的应用程序消息.
Multifilesink docs say: If the "post-messages" property is TRUE, it sends an application message named "GstMultiFileSink" after writing each buffer.
好,我收到了消息,其中对您的代码进行了两次更改.在您的信号上使用此: OK I got messages coming in with two changes to your code. On your signal use this: 文档没有很清楚地提及它,但是显然有不同的信号名称,例如 The documentation doesn't mention it very clearly, but apparently there are different signal names, like http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-bus.html http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-bus-message-types.html 接下来需要更改的是添加 The next thing you need to change is to add a 更新 这篇关于GstMultifilesink消息后回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!推荐答案
g_signal_connect (bus, "message::element", G_CALLBACK (my_bus_callback), NULL);
message :: eos
.您正在寻找元素消息.message::eos
. You're looking for element messages. GMainLoop
并调用 g_main_loop_run
.显然,这是驱动所有消息传递的原因.GMainLoop
and call to g_main_loop_run
. This is apparently what drives all the message passing.gboolean end_my_pipeline_somehow(gpointer data) {
//end the pipeline
return TRUE;
}
g_timeout_add_seconds(35, end_my_pipeline_somehow, pipeline);
GMainLoop* loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(loop);
message :: element
是有效信号;它允许总线监听元素发布的消息.message::element
is a valid signal; it allows the bus to listen for messages posted by elements.