From: Benjamin O. <co...@us...> - 2003-04-11 00:01:01
|
CVS Root: /cvsroot/gstreamer Module: gstreamer Changes by: company Date: Thu Apr 10 2003 17:01:00 PDT Log message: general fixes: - changed newly added locked_state API to work like GStreamer does - added gst_element_sync_state_with_parent function - revert: pad linking does not require non-playing state - updated spider and pipeline parsing to link elements in playing state - bugfix: pads are now activated when added to a playing element (broke above change) Modified files: gst/autoplug : gstspider.c gstspideridentity.c gst/parse : grammar.y Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/autoplug/gstspider.c.diff?r1=1.28&r2=1.29 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/autoplug/gstspideridentity.c.diff?r1=1.34&r2=1.35 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/parse/grammar.y.diff?r1=1.15&r2=1.16 ====Begin Diffs==== Index: gstspider.c =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/gst/autoplug/gstspider.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- gstspider.c 8 Apr 2003 08:02:35 -0000 1.28 +++ gstspider.c 11 Apr 2003 00:00:45 -0000 1.29 @@ -516,6 +516,7 @@ } else { element = gst_element_factory_create ((GstElementFactory *) plugpath->data, NULL); gst_bin_add (GST_BIN (spider), element); + gst_element_sync_state_with_parent (element); } /* insert and link new element */ if (!gst_element_link (conn->current, element)) Index: gstspideridentity.c =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/gst/autoplug/gstspideridentity.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- gstspideridentity.c 8 Apr 2003 08:02:36 -0000 1.34 +++ gstspideridentity.c 11 Apr 2003 00:00:46 -0000 1.35 @@ -181,8 +181,8 @@ if (conn->current != (GstElement *) conn->src) { GST_DEBUG (GST_CAT_AUTOPLUG, "sending EOS to unconnected element %s from %s", GST_ELEMENT_NAME (conn->src), GST_ELEMENT_NAME (ident)); - gst_element_set_eos (GST_ELEMENT (conn->src)); gst_pad_push (conn->src->src, GST_BUFFER (gst_event_new (GST_EVENT_EOS))); + gst_element_set_eos (GST_ELEMENT (conn->src)); } } } @@ -203,8 +203,6 @@ GstSpiderIdentity* gst_spider_identity_new_src (gchar *name) { - //GstSpiderIdentity *ret = (GstSpiderIdentity *) g_object_new (gst_spider_identity_get_type (), NULL); - //GST_ELEMENT_NAME (ret) = name; GstSpiderIdentity *ret = (GstSpiderIdentity *) gst_element_factory_make ("spideridentity", name); /* set the right functions */ gst_element_set_loop_function (GST_ELEMENT (ret), (GstElementLoopFunction) GST_DEBUG_FUNCPTR (gst_spider_identity_src_loop)); @@ -214,9 +212,6 @@ GstSpiderIdentity* gst_spider_identity_new_sink (gchar *name) { - //GstSpiderIdentity *ret = (GstSpiderIdentity *) g_object_new (gst_spider_identity_get_type (), NULL); - - //GST_ELEMENT_NAME (ret) = name; GstSpiderIdentity *ret = (GstSpiderIdentity *) gst_element_factory_make ("spideridentity", name); /* set the right functions */ @@ -417,7 +412,6 @@ GstBuffer *typefindbuf = NULL; gboolean getmorebuf = TRUE; GList *type_list; - gboolean restart_spider = FALSE; GstCaps *caps; /* this should possibly be a property */ @@ -519,17 +513,9 @@ gst_caps_debug (caps, "spider starting caps"); gst_caps_sink (caps); - /* pause the autoplugger */ - if (gst_element_get_state (GST_ELEMENT (GST_ELEMENT_PARENT(ident))) == GST_STATE_PLAYING) { - gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT(ident)), GST_STATE_PAUSED); - restart_spider = TRUE; - } + gst_spider_identity_plug (ident); - /* restart autoplugger */ - if (restart_spider){ - gst_element_set_state (GST_ELEMENT (GST_ELEMENT_PARENT(ident)), GST_STATE_PLAYING); - } goto end; } Index: grammar.y =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/gst/parse/grammar.y,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- grammar.y 10 Apr 2003 01:32:56 -0000 1.15 +++ grammar.y 11 Apr 2003 00:00:46 -0000 1.16 @@ -306,23 +306,23 @@ GList *walk = (GList *) gst_element_get_pad_list (element); gboolean unlocked_peer = FALSE; - if (gst_element_is_state_locked (element) == lock) + if (gst_element_is_locked_state (element) == lock) return; /* check if we have an unlocked peer */ while (walk) { pad = (GstPad *) GST_PAD_REALIZE (walk->data); walk = walk->next; if (GST_PAD_IS_SINK (pad) && GST_PAD_PEER (pad) && - !gst_element_is_state_locked (GST_PAD_PARENT (GST_PAD_PEER (pad)))) { + !gst_element_is_locked_state (GST_PAD_PARENT (GST_PAD_PEER (pad)))) { unlocked_peer = TRUE; break; } } - if (lock && !unlocked_peer) { - gst_element_lock_state (element); - } else if (!lock) { - gst_element_unlock_state (element); + if (!(lock && unlocked_peer)) { + gst_element_set_locked_state (element, lock); + if (!lock) + gst_element_sync_state_with_parent (element); } else { return; } @@ -334,7 +334,7 @@ walk = walk->next; if (GST_PAD_IS_SRC (pad) && GST_PAD_PEER (pad)) { GstElement *next = GST_ELEMENT (GST_OBJECT_PARENT (GST_PAD_PEER (pad))); - if (gst_element_is_state_locked (next) != lock) + if (gst_element_is_locked_state (next) != lock) gst_parse_element_lock (next, lock); } } @@ -343,35 +343,23 @@ gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data) { DelayedLink *link = (DelayedLink *) data; - gboolean restart = FALSE; GST_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s", GST_ELEMENT_NAME (src), link->src_pad, GST_ELEMENT_NAME (link->sink), link->sink_pad); - if (gst_element_get_state (src) == GST_STATE_PLAYING) { - restart = TRUE; - gst_element_set_state (src, GST_STATE_PAUSED); - } - + if (gst_element_link_pads_filtered (src, link->src_pad, link->sink, link->sink_pad, link->caps)) { /* do this here, we don't want to get any problems later on when unlocking states */ GST_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked", GST_ELEMENT_NAME (src), link->src_pad, GST_ELEMENT_NAME (link->sink), link->sink_pad); - if (restart) { - gst_element_set_state (src, GST_STATE_PLAYING); - } g_signal_handler_disconnect (src, link->signal_id); g_free (link->src_pad); g_free (link->sink_pad); gst_caps_unref (link->caps); - if (!gst_element_is_state_locked (src)) + if (!gst_element_is_locked_state (src)) gst_parse_element_lock (link->sink, FALSE); g_free (link); - } else { - if (restart) { - gst_element_set_state (src, GST_STATE_PLAYING); - } } } /* both padnames and the caps may be NULL */ @@ -427,7 +415,7 @@ if (gst_element_link_pads_filtered (src, srcs ? (const gchar *) srcs->data : NULL, sink, sinks ? (const gchar *) sinks->data : NULL, link->caps)) { - gst_parse_element_lock (sink, gst_element_is_state_locked (src)); + gst_parse_element_lock (sink, gst_element_is_locked_state (src)); goto success; } else { if (gst_parse_perform_delayed_link (src, srcs ? (const gchar *) srcs->data : NULL, @@ -449,7 +437,7 @@ srcs = g_slist_next (srcs); sinks = g_slist_next (sinks); if (gst_element_link_pads_filtered (src, src_pad, sink, sink_pad, link->caps)) { - gst_parse_element_lock (sink, gst_element_is_state_locked (src)); + gst_parse_element_lock (sink, gst_element_is_locked_state (src)); continue; } else { if (gst_parse_perform_delayed_link (src, src_pad, |