mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 11:45:25 +00:00
gconf: Fix ref handling of new child elements and minor cleanup
This commit is contained in:
parent
40a2cdb154
commit
f25420323a
4 changed files with 15 additions and 38 deletions
|
@ -1,7 +1,7 @@
|
|||
/* 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
|
||||
|
@ -118,7 +118,7 @@ gst_switch_sink_dispose (GObject * object)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_switch_commit_new_kid (GstSwitchSink * sink)
|
||||
gst_switch_sink_commit_new_kid (GstSwitchSink * sink)
|
||||
{
|
||||
GstPad *targetpad;
|
||||
GstState kid_state;
|
||||
|
@ -136,7 +136,7 @@ gst_switch_commit_new_kid (GstSwitchSink * sink)
|
|||
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);
|
||||
|
||||
|
@ -175,8 +175,6 @@ gst_switch_commit_new_kid (GstSwitchSink * 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);
|
||||
|
@ -213,12 +211,6 @@ gst_switch_commit_new_kid (GstSwitchSink * sink)
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
@ -239,6 +231,8 @@ gst_switch_sink_set_child (GstSwitchSink * sink, GstElement * new_kid)
|
|||
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
|
||||
|
@ -251,7 +245,7 @@ gst_switch_sink_set_child (GstSwitchSink * sink, GstElement * new_kid)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
return gst_switch_commit_new_kid (sink);
|
||||
return gst_switch_sink_commit_new_kid (sink);
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* 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
|
||||
|
@ -45,14 +45,8 @@ typedef struct _GstSwitchSink {
|
|||
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 {
|
||||
|
|
|
@ -112,7 +112,7 @@ gst_switch_src_dispose (GObject * object)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_switch_commit_new_kid (GstSwitchSrc * src)
|
||||
gst_switch_src_commit_new_kid (GstSwitchSrc * src)
|
||||
{
|
||||
GstPad *targetpad;
|
||||
GstState kid_state;
|
||||
|
@ -130,7 +130,7 @@ gst_switch_commit_new_kid (GstSwitchSrc * src)
|
|||
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);
|
||||
|
||||
|
@ -168,8 +168,6 @@ gst_switch_commit_new_kid (GstSwitchSrc * 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);
|
||||
|
@ -193,8 +191,6 @@ gst_switch_commit_new_kid (GstSwitchSrc * src)
|
|||
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 */
|
||||
|
@ -204,12 +200,6 @@ gst_switch_commit_new_kid (GstSwitchSrc * src)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -230,6 +220,8 @@ gst_switch_src_set_child (GstSwitchSrc * src, GstElement * new_kid)
|
|||
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 */
|
||||
|
@ -241,7 +233,7 @@ gst_switch_src_set_child (GstSwitchSrc * src, GstElement * new_kid)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
return gst_switch_commit_new_kid (src);
|
||||
return gst_switch_src_commit_new_kid (src);
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
|
|
|
@ -43,9 +43,6 @@ typedef struct _GstSwitchSrc {
|
|||
|
||||
/* 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 {
|
||||
|
|
Loading…
Reference in a new issue