From: Wim T. <wt...@us...> - 2002-02-23 14:02:47
|
CVS Root: /cvsroot/gstreamer Module: gstreamer Changes by: wtay Date: Sat Feb 23 2002 06:02:42 PST Log message: Iterate until we find the real pad when creating a ghostpad make a copy of the event in the default dispatcher. Modified files: gst : gstpad.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstpad.c.diff?r1=1.149&r2=1.150 ====Begin Diffs==== Index: gstpad.c =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/gst/gstpad.c,v retrieving revision 1.149 retrieving revision 1.150 diff -u -d -r1.149 -r1.150 --- gstpad.c 21 Feb 2002 10:38:18 -0000 1.149 +++ gstpad.c 23 Feb 2002 14:02:29 -0000 1.150 @@ -2233,13 +2233,20 @@ GstPad *pad) { GstGhostPad *ghostpad; + GstRealPad *realpad; g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (GST_IS_PAD (pad), NULL); ghostpad = g_object_new (gst_ghost_pad_get_type () ,NULL); gst_pad_set_name (GST_PAD (ghostpad), name); - GST_GPAD_REALPAD (ghostpad) = GST_PAD_REALIZE (pad); + + realpad = (GstRealPad *) pad; + + while (!GST_IS_REAL_PAD (realpad)) { + realpad = GST_PAD_REALIZE (realpad); + } + GST_GPAD_REALPAD (ghostpad) = realpad; GST_PAD_PADTEMPLATE (ghostpad) = GST_PAD_PADTEMPLATE (pad); /* add ourselves to the real pad's list of ghostpads */ @@ -2264,12 +2271,12 @@ /* for all pads in the opposite direction that are connected */ if (GST_PAD_DIRECTION (eventpad) != GST_PAD_DIRECTION (pad) && GST_PAD_IS_CONNECTED (eventpad)) { if (GST_PAD_DIRECTION (eventpad) == GST_PAD_SRC) { - gst_pad_push (eventpad, GST_BUFFER (gst_event_new (GST_EVENT_TYPE (event)))); + gst_pad_push (eventpad, GST_BUFFER (gst_event_copy (event))); } else { GstPad *peerpad = GST_PAD_CAST (GST_RPAD_PEER (eventpad)); - gst_pad_send_event (peerpad, gst_event_new (GST_EVENT_TYPE (event))); + gst_pad_send_event (peerpad, gst_event_copy (event)); } } } @@ -2293,14 +2300,12 @@ case GST_EVENT_EOS: gst_element_set_eos (element); gst_pad_event_default_dispatch (pad, element, event); - gst_event_free (event); /* we have to try to schedule another element because this one is disabled */ gst_element_yield (element); break; case GST_EVENT_FLUSH: default: gst_pad_event_default_dispatch (pad, element, event); - gst_event_free (event); break; } } |