+2005-11-19 Wim Taymans <wim@fluendo.com>
+
+ * docs/design/part-TODO.txt:
+ * gst/gstbin.c: (gst_bin_class_init), (gst_bin_provide_clock_func),
+ (gst_bin_add_func), (gst_bin_remove_func), (bin_bus_handler),
+ (gst_bin_handle_message_func):
+ * gst/gstbin.h:
+ Make message handling overridable.
+
2005-11-19 Andy Wingo <wingo@pobox.com>
* gst/gstpad.h (GST_PAD_IS_USABLE): Removed. Fixes #321235.
- convert framerate to GstFraction in GstCaps.
-- implement latency calculation for live sources.
-
-- implement master/slave clocks.
-
-- implement QOS.
-
-- implement BUFFERSIZE.
-
-- make bin_bus_handler a vmethod so subclasses can use their own implementation
- or chain to the parent.
-
- make it possible to seek on other formats than bytes in basesrc.
- GstFormat, GstQuery quarks, get_name.
IMPLEMENTATION
--------------
-- implement clock selection as explained in part-gstpipeline.txt.
+- implement latency calculation for live sources.
+
+- implement master/slave clocks.
+
+- implement QOS.
+
+- implement BUFFERSIZE.
DESIGN
static GstClock *gst_bin_provide_clock_func (GstElement * element);
static void gst_bin_set_clock_func (GstElement * element, GstClock * clock);
+static void gst_bin_handle_message_func (GstBin * bin, GstMessage * message);
static gboolean gst_bin_send_event (GstElement * element, GstEvent * event);
static GstBusSyncReply bin_bus_handler (GstBus * bus,
GstMessage * message, GstBin * bin);
klass->add_element = GST_DEBUG_FUNCPTR (gst_bin_add_func);
klass->remove_element = GST_DEBUG_FUNCPTR (gst_bin_remove_func);
+ klass->handle_message = GST_DEBUG_FUNCPTR (gst_bin_handle_message_func);
GST_DEBUG ("creating bin thread pool");
err = NULL;
}
gst_object_replace ((GstObject **) & bin->provided_clock,
(GstObject *) result);
- gst_object_replace ((GstObject **) & bin->ABI.clock_provider,
+ gst_object_replace ((GstObject **) & bin->clock_provider,
(GstObject *) provider);
bin->clock_dirty = FALSE;
GST_DEBUG_OBJECT (bin, "provided new clock %p", result);
/* if the clock provider for this element is removed, we lost
* the clock as well, we need to inform the parent of this
* so that it can select a new clock */
- if (bin->ABI.clock_provider == element) {
+ if (bin->clock_provider == element) {
GST_DEBUG_OBJECT (bin, "element \"%s\" provided the clock", elem_name);
bin->clock_dirty = TRUE;
clock_message =
static GstBusSyncReply
bin_bus_handler (GstBus * bus, GstMessage * message, GstBin * bin)
{
+
+ GstBinClass *bclass;
+
+ bclass = GST_BIN_GET_CLASS (bin);
+ if (bclass->handle_message)
+ bclass->handle_message (bin, message);
+ else
+ gst_message_unref (message);
+
+ return GST_BUS_DROP;
+}
+
+static void
+gst_bin_handle_message_func (GstBin * bin, GstMessage * message)
+{
GST_DEBUG_OBJECT (bin, "[msg %p] handling child message of type %s",
message, gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
goto forward;
}
- return GST_BUS_DROP;
+ return;
forward:
{
/* Send all other messages upward */
GST_DEBUG_OBJECT (bin, "posting message upward");
gst_element_post_message (GST_ELEMENT_CAST (bin), message);
- return GST_BUS_DROP;
+ return;
}
}
* @state_dirty: the bin needs to recalculate its state
* @clock_dirty: the bin needs to select a new clock
* @provided_clock: the last clock selected
+ * @clock_provider: the element that provided @provided_clock
*
* The GstBin base class. Subclasses can access these fields provided
* the LOCK is taken.
gboolean clock_dirty;
GstClock *provided_clock;
+ GstElement *clock_provider;
/*< private >*/
- union {
- struct {
- GstElement *clock_provider;
- } ABI;
- gpointer _gst_reserved[GST_PADDING+1-1];
- };
+ gpointer _gst_reserved[GST_PADDING];
};
/**
* @parent_class: bin parent class
* @add_element: method to add an element to a bin
* @remove_element: method to remove an element from a bin
+ * @handle_message: method to handle a message from the children
*
* Subclasses can override the @add_element and @remove_element to
* update the list of children in the bin.
+ *
+ * The @handle_message method can be overriden to implement custom
+ * message handling.
*/
struct _GstBinClass {
GstElementClass parent_class;
gboolean (*add_element) (GstBin *bin, GstElement *element);
gboolean (*remove_element) (GstBin *bin, GstElement *element);
+ void (*handle_message) (GstBin *bin, GstMessage *message);
+
/*< private >*/
gpointer _gst_reserved[GST_PADDING];
};