/* for the pad cache */
#include "gstpad.h"
-/* for GstBus */
-#include "gstbus.h"
-
G_BEGIN_DECLS
/* used by gstparse.c and grammar.y */
extern gboolean _gst_disable_registry_cache;
#endif
-/* Secret API used by GstBin to set the bus in child bus mode
- * without sockets and everything. See bug #646624.
- */
-void _priv_gst_bus_set_child_mode (GstBus * bus);
-
/* provide inline gst_g_value_get_foo_unchecked(), used in gststructure.c */
#define DEFINE_INLINE_G_VALUE_GET_UNCHECKED(ret_type,name_type,v_field) \
static inline ret_type \
bin->clock_dirty = FALSE;
/* Set up a bus for listening to child elements */
- bus = gst_bus_new ();
+ bus = g_object_new (GST_TYPE_BUS, "enable-async", FALSE, NULL);
bin->child_bus = bus;
GST_DEBUG_OBJECT (bin, "using bus %" GST_PTR_FORMAT " to listen to children",
bus);
gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bin_bus_handler, bin);
- _priv_gst_bus_set_child_mode (bus);
bin->priv = GST_BIN_GET_PRIVATE (bin);
bin->priv->asynchandling = DEFAULT_ASYNC_HANDLING;
LAST_SIGNAL
};
+#define DEFAULT_ENABLE_ASYNC (TRUE)
+
+enum
+{
+ PROP_0,
+ PROP_ENABLE_ASYNC
+};
+
static void gst_bus_dispose (GObject * object);
static GstObjectClass *parent_class = NULL;
GCond *queue_cond;
GSource *watch_id;
+ gboolean enable_async;
GstPoll *poll;
GPollFD pollfd;
};
}
static void
+gst_bus_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+ GstBus *bus = GST_BUS_CAST (object);
+
+ switch (prop_id) {
+ case PROP_ENABLE_ASYNC:
+ bus->priv->enable_async = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gst_bus_constructed (GObject * object)
+{
+ GstBus *bus = GST_BUS_CAST (object);
+
+ if (bus->priv->enable_async) {
+ bus->priv->poll = gst_poll_new_timer ();
+ gst_poll_get_read_gpollfd (bus->priv->poll, &bus->priv->pollfd);
+ }
+}
+
+static void
gst_bus_class_init (GstBusClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
parent_class = g_type_class_peek_parent (klass);
gobject_class->dispose = gst_bus_dispose;
+ gobject_class->set_property = gst_bus_set_property;
+ gobject_class->constructed = gst_bus_constructed;
+
+ /* GstBus:enable-async:
+ *
+ * Enable async message delivery support for bus watches,
+ * gst_bus_pop() and similar API. Without this only the
+ * synchronous message handlers are called.
+ *
+ * This property is used to create the child element buses
+ * in #GstBin.
+ *
+ * Since: 0.10.33
+ */
+ g_object_class_install_property (gobject_class, PROP_ENABLE_ASYNC,
+ g_param_spec_boolean ("enable-async", "Enable Async",
+ "Enable async message delivery for bus watches and gst_bus_pop()",
+ DEFAULT_ENABLE_ASYNC,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
/**
* GstBus::sync-message:
bus->priv = G_TYPE_INSTANCE_GET_PRIVATE (bus, GST_TYPE_BUS, GstBusPrivate);
bus->priv->queue_cond = g_cond_new ();
- bus->priv->poll = gst_poll_new_timer ();
- gst_poll_get_read_gpollfd (bus->priv->poll, &bus->priv->pollfd);
+ bus->priv->enable_async = DEFAULT_ENABLE_ASYNC;
GST_DEBUG_OBJECT (bus, "created");
}
return;
}
}
-
-/* Secret API used by GstBin to set the bus in child bus mode
- * without sockets and everything. See bug #646624.
- */
-void
-_priv_gst_bus_set_child_mode (GstBus * bus)
-{
- if (bus->priv->poll)
- gst_poll_free (bus->priv->poll);
- bus->priv->poll = NULL;
-}