/* GStreamer
- * (c) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * (c) 2006 Jürg Billeter <j@bitron.ch>
- * (c) 2007 Jan Schmidt <thaytan@noraisin.net>
+ * Copyright (c) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (c) 2006 Jürg Billeter <j@bitron.ch>
+ * Copyright (c) 2007 Jan Schmidt <thaytan@noraisin.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
}
static gboolean
-gst_switch_commit_new_kid (GstSwitchSink * sink)
+gst_switch_sink_commit_new_kid (GstSwitchSink * sink)
{
GstPad *targetpad;
GstState kid_state;
else
kid_state = GST_STATE (sink);
- new_kid = sink->new_kid;
+ new_kid = sink->new_kid ? gst_object_ref (sink->new_kid) : NULL;
sink->new_kid = NULL;
GST_OBJECT_UNLOCK (sink);
GST_INFO_OBJECT (sink, "Forwarding kid error: %" GST_PTR_FORMAT, msg);
gst_element_post_message (GST_ELEMENT (sink), msg);
}
- /* FIXME: need a translated error message that tells the user to check
- * her GConf audio/video settings */
GST_ELEMENT_ERROR (sink, CORE, STATE_CHANGE, (NULL),
("Failed to set state on new child."));
gst_element_set_bus (new_kid, NULL);
/* FIXME: Push new-segment info and pre-roll buffer(s) into the kid */
- /* Unblock the target pad if necessary */
- if (sink->awaiting_block) {
- gst_pad_set_blocked (sink->pad, FALSE);
- sink->awaiting_block = FALSE;
- }
-
return TRUE;
}
p_kid = &sink->new_kid;
gst_object_replace ((GstObject **) p_kid, (GstObject *) new_kid);
GST_OBJECT_UNLOCK (sink);
+ if (new_kid)
+ gst_object_unref (new_kid);
/* Sometime, it would be lovely to allow sink changes even when
* already running, but this involves sending an appropriate new-segment
return TRUE;
}
- return gst_switch_commit_new_kid (sink);
+ return gst_switch_sink_commit_new_kid (sink);
}
static GstStateChangeReturn
/* GStreamer
- * (c) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
- * (c) 2007 Jan Schmidt <thaytan@mad.scientist.com>
+ * Copyright (c) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+ * Copyright (c) 2007 Jan Schmidt <thaytan@mad.scientist.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
GstElement *new_kid;
GstPad *pad;
- /* Track incoming segment info for switchover */
- GstSegment segment;
-
/* If a custom child has been set... */
gboolean have_kid;
-
- /* If waiting for a pad block to complete on the ghost pad */
- gboolean awaiting_block;
} GstSwitchSink;
typedef struct _GstSwitchSinkClass {
}
static gboolean
-gst_switch_commit_new_kid (GstSwitchSrc * src)
+gst_switch_src_commit_new_kid (GstSwitchSrc * src)
{
GstPad *targetpad;
GstState kid_state;
else
kid_state = GST_STATE (src);
- new_kid = src->new_kid;
+ new_kid = src->new_kid ? gst_object_ref (src->new_kid) : NULL;
src->new_kid = NULL;
GST_OBJECT_UNLOCK (src);
GST_INFO_OBJECT (src, "Forwarding kid error: %" GST_PTR_FORMAT, msg);
gst_element_post_message (GST_ELEMENT (src), msg);
}
- /* FIXME: need a translated error message that tells the user to check
- * her GConf audio/video settings */
GST_ELEMENT_ERROR (src, CORE, STATE_CHANGE, (NULL),
("Failed to set state on new child."));
gst_element_set_bus (new_kid, NULL);
gst_element_set_state (old_kid, GST_STATE_NULL);
gst_bin_remove (GST_BIN (src), old_kid);
gst_object_unref (old_kid);
- /* Don't lose the SINK flag */
- GST_OBJECT_FLAG_SET (src, GST_ELEMENT_IS_SINK);
}
/* re-attach ghostpad */
gst_object_unref (targetpad);
GST_DEBUG_OBJECT (src, "done changing child of switchsrc");
- /* Unblock the target pad if necessary */
- if (src->awaiting_block) {
- gst_pad_set_blocked (src->pad, FALSE);
- src->awaiting_block = FALSE;
- }
-
return TRUE;
}
p_kid = &src->new_kid;
gst_object_replace ((GstObject **) p_kid, (GstObject *) new_kid);
GST_OBJECT_UNLOCK (src);
+ if (new_kid)
+ gst_object_unref (new_kid);
/* Sometime, it would be lovely to allow src changes even when
* already running */
return TRUE;
}
- return gst_switch_commit_new_kid (src);
+ return gst_switch_src_commit_new_kid (src);
}
static GstStateChangeReturn
/* If a custom child has been set... */
gboolean have_kid;
-
- /* If waiting for a pad block to complete on the ghost pad */
- gboolean awaiting_block;
} GstSwitchSrc;
typedef struct _GstSwitchSrcClass {