*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
/**
*
* Note that a #GstPipeline will set its bus into flushing state when changing
* from READY to NULL state.
- *
- * Last reviewed on 2012-03-28 (0.11.3)
*/
#include "gst_private.h"
* A message has been posted on the bus. This signal is emitted from the
* thread that posted the message so one has to be careful with locking.
*
- * This signal will not be emitted by default, you have to set up
- * gst_bus_sync_signal_handler() as a sync handler if you want this
- * signal to be emitted when a message is posted on the bus, like this:
- * <programlisting>
- * gst_bus_set_sync_handler (bus, gst_bus_sync_signal_handler, yourdata);
- * </programlisting>
+ * This signal will not be emitted by default, you have to call
+ * gst_bus_enable_sync_message_emission() before.
*/
gst_bus_signals[SYNC_MESSAGE] =
g_signal_new ("sync-message", G_TYPE_FROM_CLASS (klass),
* Post a message on the given bus. Ownership of the message
* is taken by the bus.
*
- * Returns: TRUE if the message could be posted, FALSE if the bus is flushing.
+ * Returns: %TRUE if the message could be posted, %FALSE if the bus is flushing.
*
* MT safe.
*/
* Check if there are pending messages on the bus that
* should be handled.
*
- * Returns: TRUE if there are messages on the bus to be handled, FALSE
+ * Returns: %TRUE if there are messages on the bus to be handled, %FALSE
* otherwise.
*
* MT safe.
*
* If @flushing, flush out and unref any messages queued in the bus. Releases
* references to the message origin objects. Will flush future messages until
- * gst_bus_set_flushing() sets @flushing to #FALSE.
+ * gst_bus_set_flushing() sets @flushing to %FALSE.
*
* MT safe.
*/
* matching message was posted on the bus.
*
* Returns: (transfer full): a #GstMessage matching the filter in @types,
- * or NULL if no matching message was found on the bus until the timeout
+ * or %NULL if no matching message was found on the bus until the timeout
* expired. The message is taken from the bus and needs to be unreffed
* with gst_message_unref() after usage.
*
message, GST_MESSAGE_TYPE_NAME (message),
GST_MESSAGE_SRC_NAME (message), (guint) types);
if ((GST_MESSAGE_TYPE (message) & types) != 0) {
- /* exit the loop, we have a message */
- goto beach;
- } else {
- GST_DEBUG_OBJECT (bus, "discarding message, does not match mask");
- gst_message_unref (message);
- message = NULL;
+ /* Extra check to ensure extended types don't get matched unless
+ * asked for */
+ if ((GST_MESSAGE_TYPE_IS_EXTENDED (message) == FALSE)
+ || (types & GST_MESSAGE_EXTENDED)) {
+ /* exit the loop, we have a message */
+ goto beach;
+ }
}
+
+ GST_DEBUG_OBJECT (bus, "discarding message, does not match mask");
+ gst_message_unref (message);
+ message = NULL;
}
/* no need to wait, exit loop */
* posted on the bus.
*
* Returns: (transfer full): the #GstMessage that is on the bus after the
- * specified timeout or NULL if the bus is empty after the timeout expired.
+ * specified timeout or %NULL if the bus is empty after the timeout expired.
* The message is taken from the bus and needs to be unreffed with
* gst_message_unref() after usage.
*
* Get a message matching @type from the bus. Will discard all messages on
* the bus that do not match @type and that have been posted before the first
* message that does match @type. If there is no message matching @type on
- * the bus, all messages will be discarded.
+ * the bus, all messages will be discarded. It is not possible to use message
+ * enums beyond #GST_MESSAGE_EXTENDED in the @events mask.
*
* Returns: (transfer full): the next #GstMessage matching @type that is on
- * the bus, or NULL if the bus is empty or there is no message matching
+ * the bus, or %NULL if the bus is empty or there is no message matching
* @type. The message is taken from the bus and needs to be unreffed with
* gst_message_unref() after usage.
*
*
* Get a message from the bus.
*
- * Returns: (transfer full): the #GstMessage that is on the bus, or NULL if the
+ * Returns: (transfer full): the #GstMessage that is on the bus, or %NULL if the
* bus is empty. The message is taken from the bus and needs to be unreffed
* with gst_message_unref() after usage.
*
* on the bus' message queue. A reference is returned, and needs to be unreffed
* by the caller.
*
- * Returns: (transfer full): the #GstMessage that is on the bus, or NULL if the
+ * Returns: (transfer full): the #GstMessage that is on the bus, or %NULL if the
* bus is empty.
*
* MT safe.
* should handle messages asynchronously using the gst_bus watch and poll
* functions.
*
- * You cannot replace an existing sync_handler. You can pass NULL to this
+ * You cannot replace an existing sync_handler. You can pass %NULL to this
* function, which will clear the existing handler.
*/
void
* When @func is called, the message belongs to the caller; if you want to
* keep a copy of it, call gst_message_ref() before leaving @func.
*
- * The watch can be removed using g_source_remove() or by returning FALSE
+ * The watch can be removed using g_source_remove() or by returning %FALSE
* from @func.
*
* MT safe.
* There can only be a single bus watch per bus, you must remove it before you
* can set a new one.
*
- * The watch can be removed using g_source_remove() or by returning FALSE
+ * The watch can be removed using g_source_remove() or by returning %FALSE
* from @func.
*
* Returns: The event source id.
* gst_bus_poll:
* @bus: a #GstBus
* @events: a mask of #GstMessageType, representing the set of message types to
- * poll for.
+ * poll for (note special handling of extended message types below)
* @timeout: the poll timeout, as a #GstClockTime, or #GST_CLOCK_TIME_NONE to poll
* indefinitely.
*
* @timeout is negative, this function will block indefinitely.
*
* All messages not in @events will be popped off the bus and will be ignored.
+ * It is not possible to use message enums beyond #GST_MESSAGE_EXTENDED in the
+ * @events mask
*
* Because poll is implemented using the "message" signal enabled by
* gst_bus_add_signal_watch(), calling gst_bus_poll() will cause the "message"
* better handled by setting up an asynchronous bus watch and doing things
* from there.
*
- * Returns: (transfer full): the message that was received, or NULL if the
+ * Returns: (transfer full): the message that was received, or %NULL if the
* poll timed out. The message is taken from the bus and needs to be
* unreffed with gst_message_unref() after usage.
*/
* A helper #GstBusFunc that can be used to convert all asynchronous messages
* into signals.
*
- * Returns: TRUE
+ * Returns: %TRUE
*/
gboolean
gst_bus_async_signal_func (GstBus * bus, GstMessage * message, gpointer data)
gst_bus_disable_sync_message_emission (GstBus * bus)
{
g_return_if_fail (GST_IS_BUS (bus));
- g_return_if_fail (bus->priv->num_signal_watchers == 0);
+ g_return_if_fail (bus->priv->num_sync_message_emitters > 0);
GST_OBJECT_LOCK (bus);
bus->priv->num_sync_message_emitters--;