* </variablelist>
*
* A #GstBin will by default forward any event sent to it to all sink elements.
- * If all the sinks return TRUE, the bin will also return TRUE, else FALSE is
- * returned. If no sinks are in the bin, the event handler will return TRUE.
+ * If all the sinks return %TRUE, the bin will also return %TRUE, else %FALSE is
+ * returned. If no sinks are in the bin, the event handler will return %TRUE.
*
* </para>
* </refsect2>
- *
- * Last reviewed on 2012-03-28 (0.11.3)
*/
#include "gst_private.h"
gboolean message_forward;
gboolean posted_eos;
+ gboolean posted_playing;
GList *contexts;
};
static GstStateChangeReturn gst_bin_change_state_func (GstElement * element,
GstStateChange transition);
-static void gst_bin_state_changed (GstElement * element, GstState oldstate,
- GstState newstate, GstState pending);
+static gboolean gst_bin_post_message (GstElement * element, GstMessage * msg);
static GstStateChangeReturn gst_bin_get_state_func (GstElement * element,
GstState * state, GstState * pending, GstClockTime timeout);
static void bin_handle_async_done (GstBin * bin, GstStateChangeReturn ret,
/**
* GstBin:async-handling:
*
- * If set to #TRUE, the bin will handle asynchronous state changes.
+ * 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 children on its own.
*/
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_bin_change_state_func);
- gstelement_class->state_changed = GST_DEBUG_FUNCPTR (gst_bin_state_changed);
+ gstelement_class->post_message = GST_DEBUG_FUNCPTR (gst_bin_post_message);
gstelement_class->get_state = GST_DEBUG_FUNCPTR (gst_bin_get_state_func);
#if 0
gstelement_class->get_index = GST_DEBUG_FUNCPTR (gst_bin_get_index_func);
*
* MT safe.
*
- * Returns: TRUE if the element could be added, FALSE if
+ * Returns: %TRUE if the element could be added, %FALSE if
* the bin does not want to accept the element.
*/
gboolean
*
* MT safe.
*
- * Returns: TRUE if the element could be removed, FALSE if
+ * Returns: %TRUE if the element could be removed, %FALSE if
* the bin does not want to remove the element.
*/
gboolean
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or NULL
+ * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
*/
GstIterator *
gst_bin_iterate_elements (GstBin * bin)
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or NULL
+ * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
*/
GstIterator *
gst_bin_iterate_recurse (GstBin * bin)
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or NULL
+ * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
*/
GstIterator *
gst_bin_iterate_sinks (GstBin * bin)
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or NULL
+ * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
*/
GstIterator *
gst_bin_iterate_sources (GstBin * bin)
*
* MT safe. Caller owns returned value.
*
- * Returns: (transfer full): a #GstIterator of #GstElement, or NULL
+ * Returns: (transfer full): a #GstIterator of #GstElement, or %NULL
*/
GstIterator *
gst_bin_iterate_sorted (GstBin * bin)
return res;
}
-static void
-gst_bin_state_changed (GstElement * element, GstState oldstate,
- GstState newstate, GstState pending)
+static gboolean
+gst_bin_post_message (GstElement * element, GstMessage * msg)
{
GstElementClass *pklass = (GstElementClass *) parent_class;
+ gboolean ret;
+
+ ret = pklass->post_message (element, gst_message_ref (msg));
+
+ if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_STATE_CHANGED &&
+ GST_MESSAGE_SRC (msg) == GST_OBJECT_CAST (element)) {
+ GstState newstate, pending;
- if (newstate == GST_STATE_PLAYING && pending == GST_STATE_VOID_PENDING)
- bin_do_eos (GST_BIN_CAST (element));
+ gst_message_parse_state_changed (msg, NULL, &newstate, &pending);
+ if (newstate == GST_STATE_PLAYING && pending == GST_STATE_VOID_PENDING) {
+ GST_BIN_CAST (element)->priv->posted_playing = TRUE;
+ bin_do_eos (GST_BIN_CAST (element));
+ } else {
+ GST_BIN_CAST (element)->priv->posted_playing = FALSE;
+ }
+ }
- if (pklass->state_changed)
- pklass->state_changed (element, oldstate, newstate, pending);
+ gst_message_unref (msg);
+
+ return ret;
}
static GstStateChangeReturn
*/
eos = GST_STATE (bin) == GST_STATE_PLAYING
&& GST_STATE_PENDING (bin) == GST_STATE_VOID_PENDING
- && is_eos (bin, &seqnum);
+ && bin->priv->posted_playing && is_eos (bin, &seqnum);
GST_OBJECT_UNLOCK (bin);
if (eos
* Gets the element with the given name from a bin. This
* function recurses into child bins.
*
- * Returns NULL if no element with the given name is found in the bin.
+ * Returns %NULL if no element with the given name is found in the bin.
*
* MT safe. Caller owns returned reference.
*
- * Returns: (transfer full): the #GstElement with the given name, or NULL
+ * Returns: (transfer full): the #GstElement with the given name, or %NULL
*/
GstElement *
gst_bin_get_by_name (GstBin * bin, const gchar * name)
* Gets the element with the given name from this bin. If the
* element is not found, a recursion is performed on the parent bin.
*
- * Returns NULL if:
+ * Returns %NULL if:
* - no element with the given name is found in the bin
*
* MT safe. Caller owns returned reference.
*
- * Returns: (transfer full): the #GstElement with the given name, or NULL
+ * Returns: (transfer full): the #GstElement with the given name, or %NULL
*/
GstElement *
gst_bin_get_by_name_recurse_up (GstBin * bin, const gchar * name)
* MT safe. Caller owns returned value.
*
* Returns: (transfer full): a #GstIterator of #GstElement for all elements
- * in the bin implementing the given interface, or NULL
+ * in the bin implementing the given interface, or %NULL
*/
GstIterator *
gst_bin_iterate_all_by_interface (GstBin * bin, GType iface)