gstream资源

本文详细介绍了GStreamer中的消息机制,包括如何使用gst_bus_post发送消息以及在gst-launch中处理message的方法。同时,文章提及了MicroDrop,一个用于数字微流控系统控制的图形用户界面,其依赖于matplotlib、pygst、pygtk和特定版本的pymunk等Python包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

官网资料:http://gstreamer.freedesktop.org

消息机制: http://blog.sina.com.cn/s/blog_80ce3a550100y2oh.html

//把message发到bus上

gboolean gst_bus_post (GstBus *bus, GstMessage * message)


例子:

    s =gst_structure_new ("test_message", "msg_id", G_TYPE_INT, i,NULL);
    m =gst_message_new_element (NULL, s);
    GST_LOG("posting element message");
    gst_bus_post(test_bus, m);



在gst-launch中,由application直接去处理message,

 static EventLoopResult
event_loop (GstElement * pipeline, gboolean blocking, GstStatetarget_state)

{

   bus = gst_element_get_bus(GST_ELEMENT (pipeline));

   while (TRUE) {
    message =gst_bus_poll (bus, GST_MESSAGE_ANY, blocking ? -1 :0);//从bus上获取message再处理

    switch (GST_MESSAGE_TYPE (message)) {
     case GST_MESSAGE_NEW_CLOCK:
     {
       GstClock *clock;

       gst_message_parse_new_clock (message,&clock);

       PRINT ("New clock: %s\n", (clock ? GST_OBJECT_NAME (clock) :"NULL"));
       break;
     }
     case GST_MESSAGE_CLOCK_LOST:
       PRINT ("Clock lost, selecting a new one\n");
       gst_element_set_state (pipeline, GST_STATE_PAUSED);
       gst_element_set_state (pipeline, GST_STATE_PLAYING);
       break;

     。。。。。。

}

另外一种message处理方法:

由于bus的存在,而message都需要通过bus传输给application,另外一种方法就是在bus上增加watch函数

来处理pipeline发给application的message:

    bus =gst_pipeline_get_bus (GST_PIPELINE (play));
   gst_bus_add_watch (bus, my_bus_callback, loop);
   gst_object_unref (bus);

static gboolean
my_bus_callback(GstBus    *bus,
       GstMessage *message,
       gpointer   data)
{
  GMainLoop *loop = data;

  switch (GST_MESSAGE_TYPE (message)) {
    caseGST_MESSAGE_ERROR: {
     GError *err;
     gchar *debug;

     gst_message_parse_error (message, &err,&debug);
     g_print ("Error: %s\n", err->message);
     g_error_free (err);
     g_free (debug);

     g_main_loop_quit (loop);
     break;
    }
    caseGST_MESSAGE_EOS:
     
     g_main_loop_quit (loop);
     break;

 .....

}


其他:

MicroDrop

Microdrop is a graphical user interface for the [DropBot][1] digitalmicrofluidics control system (described in detail in [Fobel et al., Appl. Phys.Lett. 102, 193513 (2013)][2]). If you use this information in work that youpublish, please cite as appropriate.

Binary package dependencies

In addition to the package dependencies listed in setup.py, the MicroDropapplication requires the following Python packages to be installed:

  • matplotlib: Used to plot feedback results, etc.
  • pygst: Used for video-processing in the device view.
  • pygtk: [GTK][3] bindings for user-interface.
  • pyopencv: Used to transform incoming video feed to register the device inthe device view to the overlay perspective.
  • pymunk==2.1.0 _(not the latest)_: Used for detecting the electrodecorresponding to each click on the device view_(i.e., [collision detection][4])_.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值