From fab05276803ffd9328934e7e4aa519d0e9ab8ceb Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 21 Jul 2005 20:01:46 +0000 Subject: [PATCH] gst/playback/: Refcount fix and more comments. Original commit message from CVS: * gst/playback/gstplaybasebin.c: (gen_preroll_element): * gst/playback/gstplaybin.c: (setup_sinks), (gst_play_bin_change_state): Refcount fix and more comments. --- ChangeLog | 7 +++++++ gst/playback/gstplaybasebin.c | 8 +++++--- gst/playback/gstplaybin.c | 4 ++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a721c212ca..f7092fe04c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-21 Wim Taymans + + * gst/playback/gstplaybasebin.c: (gen_preroll_element): + * gst/playback/gstplaybin.c: (setup_sinks), + (gst_play_bin_change_state): + Refcount fix and more comments. + 2005-07-21 Zaheer Abbas Merali * sys/ximage/Makefile.am: diff --git a/gst/playback/gstplaybasebin.c b/gst/playback/gstplaybasebin.c index 681c1fae43..6ffca4e07c 100644 --- a/gst/playback/gstplaybasebin.c +++ b/gst/playback/gstplaybasebin.c @@ -560,17 +560,17 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin, g_return_if_reached (); /* create stream selector */ + selector = g_object_new (GST_TYPE_STREAM_SELECTOR, NULL); padname = gst_pad_get_name (pad); name = g_strdup_printf ("selector_%s_%s", prename, padname); - selector = g_object_new (GST_TYPE_STREAM_SELECTOR, NULL); gst_object_set_name (GST_OBJECT (selector), name); g_free (name); /* create preroll queue */ name = g_strdup_printf ("preroll_%s_%s", prename, padname); preroll = gst_element_factory_make ("queue", name); - g_free (padname); g_free (name); + g_free (padname); g_object_set (G_OBJECT (preroll), "max-size-buffers", 0, "max-size-bytes", @@ -611,9 +611,11 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin, /* listen for EOS */ preroll_pad = gst_element_get_pad (preroll, "src"); gst_pad_add_event_probe (preroll_pad, G_CALLBACK (probe_triggered), info); + gst_object_unref (preroll_pad); /* add to group list */ - /* FIXME refcount elements */ + /* FIXME refcount elements, after bin_add, object refs are invalid since + * it takes ownership. */ group->type[type - 1].selector = selector; group->type[type - 1].preroll = preroll; if (type == GST_STREAM_TYPE_TEXT && play_base_bin->subtitle) { diff --git a/gst/playback/gstplaybin.c b/gst/playback/gstplaybin.c index 7053081bc8..e56e0d5677 100644 --- a/gst/playback/gstplaybin.c +++ b/gst/playback/gstplaybin.c @@ -827,6 +827,8 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group) gst_object_unref (pad); } + /* remove the sinks now, pipeline get_state will now wait for the + * sinks to preroll */ if (play_bin->fakesink) { gst_bin_remove (GST_BIN (play_bin), play_bin->fakesink); play_bin->fakesink = NULL; @@ -846,6 +848,8 @@ gst_play_bin_change_state (GstElement * element) switch (transition) { case GST_STATE_READY_TO_PAUSED: + /* this really is the easiest way to make the state change return + * ASYNC until we added the sinks */ if (!play_bin->fakesink) { play_bin->fakesink = gst_element_factory_make ("fakesink", "test"); gst_bin_add (GST_BIN (play_bin), play_bin->fakesink);