From: <bi...@ke...> - 2007-05-22 11:10:05
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: bilboed Date: Tue May 22 2007 11:09:57 UTC Log message: * docs/gst/gstreamer-sections.txt: * gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), (gst_bin_dispose), (gst_bin_set_property), (gst_bin_get_property), (gst_bin_remove_func), (gst_bin_handle_message_func): * gst/gstbin.h: Add a property for bins that handle the state change of their childs. Fixes #435880 Modified files: . : ChangeLog docs/gst : gstreamer-sections.txt gst : gstbin.c gstbin.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.3226&r2=1.3227 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/docs/gst/gstreamer-sections.txt.diff?r1=1.299&r2=1.300 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstbin.c.diff?r1=1.351&r2=1.352 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstbin.h.diff?r1=1.94&r2=1.95 ====Begin Diffs==== Index: gstreamer-sections.txt =================================================================== RCS file: /cvs/gstreamer/gstreamer/docs/gst/gstreamer-sections.txt,v retrieving revision 1.299 retrieving revision 1.300 diff -u -d -r1.299 -r1.300 --- gstreamer-sections.txt 27 Apr 2007 08:30:59 -0000 1.299 +++ gstreamer-sections.txt 22 May 2007 11:09:44 -0000 1.300 @@ -80,6 +80,7 @@ <SUBSECTION Private> gst_bin_get_type gst_bin_flags_get_type +GstBinPrivate </SECTION> Index: ChangeLog RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.3226 retrieving revision 1.3227 diff -u -d -r1.3226 -r1.3227 --- ChangeLog 22 May 2007 09:56:24 -0000 1.3226 +++ ChangeLog 22 May 2007 11:09:44 -0000 1.3227 @@ -1,3 +1,13 @@ +2007-05-22 Edward Hervey <ed...@fl...> + + * docs/gst/gstreamer-sections.txt: + * gst/gstbin.c: (gst_bin_class_init), (gst_bin_init), + (gst_bin_dispose), (gst_bin_set_property), (gst_bin_get_property), + (gst_bin_remove_func), (gst_bin_handle_message_func): + * gst/gstbin.h: + Add a property for bins that handle the state change of their childs. + Fixes #435880 2007-05-22 Sebastian Dröge <sl...@ci...> * libs/gst/controller/gstinterpolation.c: Index: gstbin.c RCS file: /cvs/gstreamer/gstreamer/gst/gstbin.c,v retrieving revision 1.351 retrieving revision 1.352 diff -u -d -r1.351 -r1.352 --- gstbin.c 21 May 2007 12:05:14 -0000 1.351 +++ gstbin.c 22 May 2007 11:09:45 -0000 1.352 @@ -195,8 +195,18 @@ "Simple container object", "Erik Walthinsen <om...@cs...>," "Wim Taymans <wi...@fl...>"); +struct _GstBinPrivate +{ + gboolean asynchandling; +}; static void gst_bin_dispose (GObject * object); +static void gst_bin_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_bin_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); static GstStateChangeReturn gst_bin_change_state_func (GstElement * element, GstStateChange transition); static GstStateChangeReturn gst_bin_get_state_func (GstElement * element, @@ -242,7 +252,8 @@ enum { - PROP_0 + PROP_0, + PROP_ASYNC_HANDLING /* FILL ME */ }; @@ -368,6 +379,24 @@ parent_class = g_type_class_peek_parent (klass); + gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_bin_set_property); + gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_bin_get_property); + /** + * GstBin:async-handling + * + * If set to #TRUE, the bin will handle asynchronous state changes. + * This should be used only if the bin subclass is modifying the state + * of its childs on its own. + * Since: 0.10.13 + **/ + g_object_class_install_property (gobject_class, PROP_ASYNC_HANDLING, + g_param_spec_boolean ("async-handling", "Async Handling", + "The bin will handle Asynchronous state changes", + FALSE, G_PARAM_READWRITE)); /** * GstBin::element-added: * @bin: the #GstBin @@ -444,6 +473,9 @@ 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); + bin->private = g_new0 (GstBinPrivate, 1); + bin->private->asynchandling = FALSE; } static void @@ -470,6 +502,11 @@ GST_STR_NULL (GST_OBJECT_NAME (object))); } + if (bin->private) { + g_free (bin->private); + bin->private = NULL; + } G_OBJECT_CLASS (parent_class)->dispose (object); @@ -487,6 +524,46 @@ return gst_element_factory_make ("bin", name); +static void +gst_bin_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) + GstBin *gstbin; + gstbin = GST_BIN (object); + switch (prop_id) { + case PROP_ASYNC_HANDLING: + GST_OBJECT_LOCK (gstbin); + gstbin->private->asynchandling = g_value_get_boolean (value); + GST_OBJECT_UNLOCK (gstbin); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +} +gst_bin_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) + g_value_set_boolean (value, gstbin->private->asynchandling); /* set the index on all elements in this bin * * MT safe @@ -931,6 +1008,8 @@ GList *walk, *next; gboolean other_async = FALSE, this_async = FALSE, cont = FALSE; + GST_DEBUG_OBJECT (bin, "element :%s", GST_ELEMENT_NAME (element)); GST_OBJECT_LOCK (element); /* Check if the element is already being removed and immediately * return */ @@ -1012,7 +1091,7 @@ if (!other_async && this_async) { GST_DEBUG_OBJECT (bin, "we removed the last async element"); - cont = GST_OBJECT_PARENT (bin) == NULL; + cont = ((GST_OBJECT_PARENT (bin) == NULL) || bin->private->asynchandling); if (!cont) { bin_handle_async_done (bin, &smessage); async_message = gst_message_new_async_done (GST_OBJECT_CAST (bin)); @@ -2685,7 +2764,7 @@ bin_handle_async_start (bin, &smessage); /* prepare an ASYNC_START message */ - if (GST_OBJECT_PARENT (bin)) { + if (GST_OBJECT_PARENT (bin) && (!bin->private->asynchandling)) { forward = TRUE; message = gst_message_new_async_start (GST_OBJECT_CAST (bin), new_base_time); @@ -2740,7 +2819,8 @@ /* nothing found, remove all old ASYNC_DONE messages */ bin_remove_messages (bin, NULL, GST_MESSAGE_ASYNC_DONE); done = TRUE; - toplevel = GST_OBJECT_PARENT (bin) == NULL; + toplevel = bin->private->asynchandling + || (GST_OBJECT_PARENT (bin) == NULL); if (!toplevel) bin_handle_async_done (bin, &smessage); } Index: gstbin.h RCS file: /cvs/gstreamer/gstreamer/gst/gstbin.h,v retrieving revision 1.94 retrieving revision 1.95 diff -u -d -r1.94 -r1.95 --- gstbin.h 10 Feb 2007 18:31:12 -0000 1.94 +++ gstbin.h 22 May 2007 11:09:45 -0000 1.95 @@ -54,6 +54,7 @@ typedef struct _GstBin GstBin; typedef struct _GstBinClass GstBinClass; +typedef struct _GstBinPrivate GstBinPrivate; /** * GST_BIN_NUMCHILDREN: @@ -113,8 +114,10 @@ GstClock *provided_clock; GstElement *clock_provider; + GstBinPrivate *private; /*< private >*/ - gpointer _gst_reserved[GST_PADDING]; + gpointer _gst_reserved[GST_PADDING - 1]; |