gstream资源

来源:互联网 发布:铁路局知乎 编辑:程序博客网 时间:2024/06/18 08:17

官网资料: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])_.

0 0
原创粉丝点击