GstMultifilesink消息后回调 [英] GstMultifilesink post-messages callback

查看:177
本文介绍了GstMultifilesink消息后回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用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:

g_signal_connect (bus, "message::element", G_CALLBACK (my_bus_callback), NULL);

文档没有很清楚地提及它,但是显然有不同的信号名称,例如 message :: eos .您正在寻找元素消息.

The documentation doesn't mention it very clearly, but apparently there are different signal names, like message::eos. You're looking for element messages.

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

接下来需要更改的是添加 GMainLoop 并调用 g_main_loop_run .显然,这是驱动所有消息传递的原因.

The next thing you need to change is to add a 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.

这篇关于GstMultifilesink消息后回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆