[gst-devel] bus-sync-handler vs bus-watch vs both.

wl2776 wl2776 at gmail.com
Thu Apr 1 14:19:56 CEST 2010



wl2776 wrote:
> 
> My player sets both the bus-sync-signal-handler and the bus-watch.
> And, it seems, bus-watch is not called at all.
> 
> And the code, processing the messages, is identical in these handlers. The
> difference is only in the return values.
> 
> So, is it necessary to set up both handlers?
> If no, what should I choose?
> 

Found. The documentation says, the bus-sync-signal-handler "is usually only
called by the creator of the bus. Applications should handle messages
asynchronously using the gst_bus watch and poll functions."

However, my player has to pause the pipeline after the first frame is
displayed, I can only do this in the bus-sync-handler.

The question remains, why my bus watch isn't called at all?

My bus-sync-handler consists of only one switch operator: 

GstBusSyncReply bus_sync_handler(GstBus * bus, GstMessage * message)
{
  switch (GST_MESSAGE_TYPE (message)) {
    case GST_MESSAGE_EOS:
      // process eos, just prints.
      break;
    case GST_MESSAGE_BUFFERING:
      // process BUFFERING message, again just prints
      break;
    case GST_MESSAGE_ELEMENT:
      if (!gst_structure_has_name (message->structure,
"prepare-xwindow-id"))
        return GST_BUS_PASS;
      if(/* we have hwnd of a window, where to draw  */)
        gst_x_overlay_set_xwindow_id (GST_X_OVERLAY
(GST_MESSAGE_SRC(message)),m_hwnd);
      else 
        return GST_BUS_PASS;
      break;
    case GST_MESSAGE_ERROR:
     // again, just print error info and debug details
      break;
    case GST_MESSAGE_DURATION:		
      //query stream duration
      break;
    case GST_MESSAGE_STATE_CHANGED:
      gst_message_state_changed(bus,message);  
      // again, just check message owner and set the m_player to paused
state
      break;
    default:
      GST_DEBUG("message %s(%d) from %s",
          GST_MESSAGE_TYPE_NAME(message),
          GST_MESSAGE_TYPE(message),
          GST_MESSAGE_SRC_NAME(message));
      return GST_BUS_PASS;
  }
  gst_message_unref (message);
  return GST_BUS_DROP;	
}

-- 
View this message in context: http://n4.nabble.com/bus-sync-handler-vs-bus-watch-vs-both-tp1747921p1747994.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list